Exemplo n.º 1
0
 protected void setUp() {
   j = new DJep();
   j.addStandardConstants();
   j.addStandardFunctions();
   j.addComplex();
   // j.setTraverse(true);
   j.setAllowAssignment(true);
   j.setAllowUndeclared(true);
   j.setImplicitMul(true);
   ((DJep) j).addStandardDiffRules();
 }
Exemplo n.º 2
0
  /**
   * differentiate the expression and simplify
   *
   * @param var variable used for differentiation
   */
  public void diff(String var) {
    String name = proxy.getName();

    DJep j = new DJep();
    j.addStandardConstants();
    j.addStandardFunctions();
    j.addComplex();
    j.setAllowUndeclared(true);
    j.setAllowAssignment(true);
    j.setImplicitMul(true);
    // Sets up standard rules for differentiating sin(x) etc.
    j.addStandardDiffRules();

    try {
      // parse the string
      node = j.parse(name);
      diff = j.differentiate(node, var);
      simp = j.simplify(diff);
    } catch (ParseException e) {
      ErrorMessage("Error in parsing " + name);
    }
  }