Package org.opensourcephysics.numerics
Class ParsedMultiVarFunction
java.lang.Object
org.opensourcephysics.numerics.ParsedMultiVarFunction
- All Implemented Interfaces:
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParsedMultiVarFunction
(String _fStr, String[] var, boolean allowUnkownIdentifiers) Constructs a ParsedFunction from the given string and independent variable. -
Method Summary
-
Field Details
-
isNull
public boolean isNull
-
-
Constructor Details
-
ParsedMultiVarFunction
public ParsedMultiVarFunction(String _fStr, String[] var, boolean allowUnkownIdentifiers) throws ParserException Constructs a ParsedFunction from the given string and independent variable.- Parameters:
_fStr
- the functionvar
- the independent variableallowUnknownIdentifiers
- always false- Throws:
ParserException
-
-
Method Details
-
evaluate
public double evaluate(double[] x) Evaluates the function, f.- Specified by:
evaluate
in interfaceMultiVarFunction
- Parameters:
x
- the value of the independent variable- Returns:
- the value of the function
-
toString
Represents the function as a string. -
getFunctionNames
Returns function names. Added by D. Brown 06 Jul 2008- Returns:
- array of function names
-
evaluatedToNaN
public boolean evaluatedToNaN()Determines if last evaluation resulted in NaN. Added by D Brown 15 Sep 2010.- Returns:
- true if result was converted from NaN to zero
-