Class JxnMultivariateFunction

java.lang.Object
  extended by JxnMultivariateFunction
All Implemented Interfaces:
MultivariateFunction

public class JxnMultivariateFunction
extends java.lang.Object
implements MultivariateFunction

Wrapper used to pass a method definition to Commons Math algorithms. Computes a command given as a String.

See JxnMultivariateFunction_Optimization~Demo.jxn for an example.


Constructor Summary
JxnMultivariateFunction(KmgFormelInterpreter fi, java.lang.String cmd)
          Constructs a MultivariateFunction instance to be used by Commons Math algorithms.
JxnMultivariateFunction(java.lang.String cmd, KmgFormelInterpreter fi)
          Deprecated. replaced by JxnMultivariateFunction(KmgFormelInterpreter, String)
 
Method Summary
 java.lang.String toString()
          Returns the command cmd passed to the constructor.
 double value(double[] x)
          Internally called by Commons Math algorithms: Computes the function value using the given argument x.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JxnMultivariateFunction

public JxnMultivariateFunction(KmgFormelInterpreter fi,
                               java.lang.String cmd)
Constructs a MultivariateFunction instance to be used by Commons Math algorithms.
Example:
    mvf = @JxnMultivariateFunction( $this, "( $x[0]^2 + 2.5 $x[1]^2 - $x[1] ) * Math.exp( 1 - $x[0]^2 - $x[1]^2 );" )

Parameters:
fi - an internal copy of fi is used to execute cmd
cmd - one or more statements separated by ';'. The command cmd must use the array double[] $x to compute a result of type double. If cmd ends with ';', log output of intermediate steps is suppressed.

JxnMultivariateFunction

public JxnMultivariateFunction(java.lang.String cmd,
                               KmgFormelInterpreter fi)
Deprecated. replaced by JxnMultivariateFunction(KmgFormelInterpreter, String)

Method Detail

value

public double value(double[] x)
Internally called by Commons Math algorithms: Computes the function value using the given argument x.

Specified by:
value in interface MultivariateFunction

toString

public java.lang.String toString()
Returns the command cmd passed to the constructor.

Overrides:
toString in class java.lang.Object