Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.lsmp.djep.djep
Class DJep

    java.lang.Object
      org.nfunk.jep.JEP
          org.lsmp.djep.xjep.XJep
              org.lsmp.djep.djep.DJep

Direct Known Subclasses:
  MatrixJep

    public class DJep

extends XJep

Adds differentation facilities to JEP. For example

     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);

Author:
  Rich Morris Created on 16-Nov-2003

Field Summary
`protected DifferentiationVisitor` | `dv`

Fields inherited from class org.lsmp.djep.xjep.XJep
`commandv, copier, nf, pv, simpv, subv, tu`

Fields inherited from class org.nfunk.jep.JEP
`allowAssignment, allowUndeclared, errorList, ev, funTab, implicitMul, numberFactory, opSet, parser, symTab`

Constructor Summary
`` | `DJep()` Standard constructor.
`protected` | `DJep(DJep j)`

Method Summary
`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, java.lang.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.

Methods inherited from class org.lsmp.djep.xjep.XJep
`addComplex, addStandardConstants, addStandardFunctions, calcVarValue, continueParsing, deepCopy, evaluate, getNodeFactory, getPrintVisitor, getTreeUtils, getVarsInEquation, preprocess, print, print, println, println, recursiveGetVarsInEquation, restartParser, restartParser, simplify, substitute, substitute, toString`

Methods inherited from class org.nfunk.jep.JEP
`addConstant, 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, setVarValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dv

    protected DifferentiationVisitor dv

Constructor Detail

### DJep

    public DJep()

  Standard constructor. Use this instead of JEP or XJep if differentation facilities are required.

### DJep

    protected DJep(DJep j)

Method Detail

### differentiate

    public Node differentiate(Node node,
                              java.lang.String name)
                       throws ParseException

  Differentiate an equation with respect to a variable.

  Parameters:
    `node` - top node of the expression tree to differentiate.
    `name` - differentiate with respect to this variable.
  Returns:
    the top node of a new parse tree representing the derivative.
  Throws:
    `ParseException` - if for some reason equation cannot be differentiated, usually if it has not been taught how to differentiate a particular function.

### newInstance

    public XJep newInstance()

  Description copied from class: `XJep`
  Creates a new instance of XJep with the same components as this one. Sub classes should overwrite this method to create objects of the correct type.

  Overrides:
    `newInstance` in class `XJep`

### newInstance

    public XJep newInstance(SymbolTable st)

  Description copied from class: `XJep`
  Creates a new instance of XJep with the same components as this one and the specified symbol table. Sub classes should overwrite this method to create objects of the correct type.

  Overrides:
    `newInstance` in class `XJep`

### getDifferentationVisitor

    public DifferentiationVisitor getDifferentationVisitor()

  Returns the visitor used for differentiation. Allows more advanced functions.

### addStandardDiffRules

    public boolean addStandardDiffRules()

  Adds the standard set of differentation rules. Corresponds to all standard functions in the JEP plus a few more.

       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

  Returns:
    false on error

### addDiffRule

    public void addDiffRule(DiffRulesI rule)

  Adds a rule with instruction on how to differentiate a function.

  Parameters:
    `rule` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

http://www.singularsys.com/jep Copyright © 2007 Singular Systems