|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.webcompmath.functions.NumIntParser
public class NumIntParser
The NumIntParser class makes it possible to use numerical definite integrals, such as numInt(xx,0,5,xx^2) in a Parser. The numerical integral psedu-function has four parameters: (1) The integration variable, which must be an identifier and should be different than other variables registered with the parser; (2) The lower limit for the integral, given as an expression (which can involve variables); (3) The upper limit for the integral, given as an expression (which can involve variables); and (4) the expression that is the integrand. The expression in the fourth parameter can (and presumably will) use the integration variable (as well as other identifiers known to the parser). You can also provide an optional 5th parameter to specify the number of intervals used in the computation (the default is 1000).
You can take the derivative of a function defined using numInt() and the lower and upper limits can depend on the variable that the derivative is being taken with respect to. For example you could take the derivative of a function defined by "numInt(z,0,x,z^2)" with respect to x. Note that the integrand cannot depend on the wrt variable, because that would require symbolic integration (which is not supported).
To use numerical integrals with a Parser p, just say p.add(new NumIntParser()). It's unlikely that you will ever need to do anything else with NumIntParsers. If you want to use a name other than "numInt", you can change the name after creating the NumIntParser object but before adding it to a parser.
Constructor Summary | |
---|---|
NumIntParser()
|
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 integration subexpression. |
java.lang.String |
getName()
Get the name, which will be used in place of "numInt" in expressions. |
void |
setName(java.lang.String name)
Set the name, which will be used in place of "numInt" in expressions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumIntParser()
Method Detail |
---|
public void setName(java.lang.String name)
setName
in interface MathObject
name
- name of numerical integralpublic 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 |