math.numerics
Class ParsedMultiVarFunction

java.lang.Object
  extended by math.numerics.ParsedMultiVarFunction
All Implemented Interfaces:
MultiVarFunction

public final class ParsedMultiVarFunction
extends java.lang.Object
implements MultiVarFunction

ParsedMultiVarFunction defines a function of multiple variables using a String. This function is immutable. That is, once an instance is created with a particular function string, the function cannot be changed. Because immutable objects cannot change, they are thread safe and can be freely shared in a Java program.

Author:
Wolfgang Christian

Constructor Summary
ParsedMultiVarFunction(java.lang.String _fStr, java.lang.String[] var)
          Constructs a ParsedFunction from the given string and independent variable.
 
Method Summary
 double evaluate(double[] x)
          Evaluates the function, f.
 java.lang.String toString()
          Represents the function as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParsedMultiVarFunction

public ParsedMultiVarFunction(java.lang.String _fStr,
                              java.lang.String[] var)
                       throws ParserException
Constructs a ParsedFunction from the given string and independent variable.

Parameters:
_fStr - the function
var - the independent variable
Throws:
ParserException
Method Detail

evaluate

public double evaluate(double[] x)
Evaluates the function, f.

Specified by:
evaluate in interface MultiVarFunction
Parameters:
x - the value of the independent variable
Returns:
the value of the function

toString

public java.lang.String toString()
Represents the function as a string.

Overrides:
toString in class java.lang.Object
Returns:
the string