|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.webcompmath.functions.DerivParser
public class DerivParser
The DerivParser class makes it possible to use symbolic derivatives such as Deriv(x,0,x^2) in a Parser. The derivative psedu-function has four 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; (3) the expression that is to have its derivative taken; and (4) an optional expression indicating whether to take the first, second, etc. derivative. The expression in the third parameter can (and presumably will) use the variable (as well as other identifiers known to the parser). The default for the fourth parameter is 1 (i.e., the first derivative). Only derivatives up to the 100th are supported; if you try to take a larger derivative, Double.Nan is returned.
To use derivatives with a Parser p, just say p.add(new DerivParser()). It's unlikely that you will ever need to do anything else with DerivParsers. If you want to use a name other than "Deriv", you can change the name after creating the DerivParser object but before adding it to a parser.
Constructor Summary | |
---|---|
DerivParser()
|
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 "Deriv" in expressions. |
void |
setName(java.lang.String name)
Set the name, which will be used in place of "Deriv" in expressions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DerivParser()
Method Detail |
---|
public void setName(java.lang.String name)
setName
in interface MathObject
name
- name of 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 |