Is there a variable type function in java? I need to be able to deal with functions like matlab does.

For example:

Then evaluate the function at a point, for example:Code:`function x = "X^2";`

Is this possible?Code:`x(10);`

Thanks.

Printable View

- 07-25-2007, 05:59 PMrominaI need to be able to deal with functions like matlab
Is there a variable type function in java? I need to be able to deal with functions like matlab does.

For example:

Code:`function x = "X^2";`

Code:`x(10);`

Thanks. - 08-07-2007, 05:37 AMbarney
What's wrong with doing:

Code:`public double f(double x) {`

return x*x;

}

System.out.println(f(10));