|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.webcompmath.functions.NumDerivParser
public class NumDerivParser
The NumDerivParser class makes it possible to use numerical derivatives such as numDeriv(x,0,x^2) in a Parser. The numerical derivative psedu-function has three parameters: (1) The with-respect-to variable, which must be an identifier; (2) The value of the variable at which to evaluate the derivative, given as an expression; and (3) the expression that is to have its derivative taken. The expression in the third parameter can (and presumably will) use the variable (as well as other identifiers known to the parser). This uses a symmetric difference quotient with h = 0.001 to evaluate the derivative.
To use numerical derivatives with a Parser p, just say p.add(new NumDerivParser()). It's unlikely that you will ever need to do anything else with NumDerivParsers. If you want to use a name other than "numDeriv", you can change the name after creating the NumDerivParser object but before adding it to a parser.
Constructor Summary | |
---|---|
NumDerivParser()
|
Method Summary | |
---|---|
void |
doParse(Parser parser,
ParserContext context)
When the name of this ParserExtension is encountered by a parser with which the extension is registered, the parser calls this routine to parse the subexpression. |
java.lang.String |
getName()
Get the name, which will be used in place of "numDeriv" in expressions. |
void |
setName(java.lang.String name)
Set the name, which will be used in place of "numDeriv" in expressions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumDerivParser()
Method Detail |
---|
public void setName(java.lang.String name)
setName
in interface MathObject
name
- name of numerical derivativepublic java.lang.String getName()
getName
in interface MathObject
public void doParse(Parser parser, ParserContext context)
doParse
in interface ParserExtension
parser
- parser to usecontext
- context to use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |