Class JxnUnivariateFunction

java.lang.Object
  extended by JxnUnivariateFunction
All Implemented Interfaces:
UnivariateFunction

public class JxnUnivariateFunction
extends java.lang.Object
implements UnivariateFunction

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

See JxnUnivariateFunction_SolverOptimizer~Demo.jxn for examples.


Constructor Summary
JxnUnivariateFunction(KmgFormelInterpreter fi, java.lang.String cmd)
          Constructs an UnivariateFunction instance to be used by Commons Math algorithms.
JxnUnivariateFunction(java.lang.String cmd, KmgFormelInterpreter fi)
          Deprecated. replaced by JxnUnivariateFunction(KmgFormelInterpreter, String)
 
Method Summary
 java.lang.String toString()
          Returns the command cmd passed to the constructor.
 double value(double x)
          Internally called by CommonsMath 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

JxnUnivariateFunction

public JxnUnivariateFunction(KmgFormelInterpreter fi,
                             java.lang.String cmd)
Constructs an UnivariateFunction instance to be used by Commons Math algorithms.
Example:
    uvf = @JxnUnivariateFunction( $this, "Math.sin $x;" )

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 variable double $x to compute a result of type double. If cmd ends with ';', log output of intermediate steps is suppressed.

JxnUnivariateFunction

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

Method Detail

value

public double value(double x)
Internally called by CommonsMath algorithms: Computes the function value using the given argument x.

Specified by:
value in interface UnivariateFunction

toString

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

Overrides:
toString in class java.lang.Object