public class DJep extends XJep
DJep j = new DJep();
j.addStandardDiffRules();
....
Node node = j.parse("x^3");
Node diff = j.differentiate(node,"x");
Node simp = j.simplify(diff);
j.println(simp);
Node node2 = j.parse("diff(x^4,x)");
Node proc = j.preprocess(node2);
Node simp2 = j.simplify(proc);
j.println(simp2);
| Modifier and Type | Field and Description |
|---|---|
protected DifferentiationVisitor |
dv |
allowAssignment, allowUndeclared, errorList, ev, funTab, implicitMul, numberFactory, opSet, parser, symTab| Modifier | Constructor and Description |
|---|---|
|
DJep()
Standard constructor.
|
protected |
DJep(DJep j) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDiffRule(DiffRulesI rule)
Adds a rule with instruction on how to differentiate a function.
|
boolean |
addStandardDiffRules()
Adds the standard set of differentation rules.
|
Node |
differentiate(Node node,
String name)
Differentiate an equation with respect to a variable.
|
DifferentiationVisitor |
getDifferentationVisitor()
Returns the visitor used for differentiation.
|
XJep |
newInstance()
Creates a new instance of XJep with the same components as this one.
|
XJep |
newInstance(SymbolTable st)
Creates a new instance of XJep with the same components as this one and the specified symbol table.
|
addComplex, addStandardConstants, addStandardFunctions, calcVarValue, continueParsing, deepCopy, evaluate, getNodeFactory, getPrintVisitor, getTreeUtils, getVarsInEquation, preprocess, print, print, println, println, recursiveGetVarsInEquation, restartParser, restartParser, simplify, substitute, substitute, toStringaddConstant, addFunction, addVariable, addVariable, addVariable, evaluate, getAllowAssignment, getAllowUndeclared, getComplexValue, getErrorInfo, getEvaluatorVisitor, getFunctionTable, getImplicitMul, getNumberFactory, getOperatorSet, getParser, getSymbolTable, getTopNode, getTraverse, getValue, getValueAsObject, getVar, getVarValue, hasError, initFunTab, initSymTab, parse, parseExpression, removeFunction, removeVariable, setAllowAssignment, setAllowUndeclared, setImplicitMul, setTraverse, setVarValueprotected DifferentiationVisitor dv
public DJep()
protected DJep(DJep j)
public Node differentiate(Node node, String name) throws ParseException
node - top node of the expression tree to differentiate.name - differentiate with respect to this variable.ParseException - if for some reason equation cannot be differentiated,
usually if it has not been taught how to differentiate a particular function.public XJep newInstance()
XJepnewInstance in class XJeppublic XJep newInstance(SymbolTable st)
XJepnewInstance in class XJeppublic DifferentiationVisitor getDifferentationVisitor()
public boolean addStandardDiffRules()
sin,cos,tan,asin,acos,atan,sinh,cosh,tanh,asinh,acosh,atanh
sqrt,log,ln,abs,angle
sum,im,re are handled separately.
rand and mod currently un-handled
Also adds rules for functions not in JEP function list:
sec,cosec,cot,exp,pow,sgn
TODO include if, min, max, sgn
public void addDiffRule(DiffRulesI rule)
rule - Copyright © 2018. All rights reserved.