Class MacroDiffRules

java.lang.Object
com.singularsys.extensions.djep.diffRules.ChainRuleDiffRules
com.singularsys.extensions.djep.diffRules.MacroDiffRules
All Implemented Interfaces:
DiffRulesI, JepComponent, Serializable

public class MacroDiffRules extends ChainRuleDiffRules
Rules are specified by an expression string or a trees of nodes. The standard chain rule is applied
 diff(f(g(x),h(x)),x) -> df/dg dg/dx + df/dh dh/dx
 
for example
 DifferentiationVisitor dv = new DifferentiationVisitor(new TreeUtils(jep));
 DiffRulesI rule = new MacroDiffRules(dv, "sin", "cos(x)");
 
See Also:
  • Constructor Details

    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, Node node) throws ParseException
      Create a differentiation rule for function with 1 argument
      Parameters:
      djep - djep instance
      funName - name of function
      node - a tree representing differentiation of function wrt "x"
      Throws:
      ParseException
    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, String rule) throws ParseException
      Create a differentiation rule for function with 1 argument
      Parameters:
      djep - djep instance
      funName - name of function
      rule - a string representing differentiation of a function wrt "x"
      Throws:
      ParseException
    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, PostfixMathCommandI pfmc, String rule) throws ParseException
      Create a differentiation rule for function with 1 argument
      Parameters:
      djep - djep instance
      funName - name of function
      pfmc - PostfixMathCommandI for function
      rule - a string representing differentiation of function wrt "x"
      Throws:
      ParseException
    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, PostfixMathCommandI pfmc, String rule1, String rule2) throws ParseException
      Create a differentiation rule for function with 2 arguments. The rules must be in terms of "x" and "y"
      Parameters:
      djep - djep instance
      funName - name of function
      pfmc - PostfixMathCommandI for function
      rule1 - a string representing differentiation of function wrt "x"
      rule2 - a string representing differentiation of function wrt "y"
      Throws:
      ParseException
    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, String rule1, String rule2) throws ParseException
      Create a differentiation rule for function with 2 arguments. The rules must be in terms of "x" and "y"
      Parameters:
      funName - name of function
      rule1 - a string representing differentiation of function wrt "x"
      rule2 - a string representing differentiation of function wrt "y"
      Throws:
      ParseException
    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, PostfixMathCommandI pfmc, String[] inRules) throws ParseException
      Create a differentiation rule for function with n arguments. The rules must be in terms of "x1", "x2", ... "xn"
      Parameters:
      djep - djep instance
      funName - name of function
      pfmc - PostfixMathCommandI for function
      Throws:
      ParseException
    • MacroDiffRules

      public MacroDiffRules(DJep djep, String funName, String[] inRules) throws ParseException
      Create a differentiation rule for function with n arguments. The rules must be in terms of "x1", "x2", ... "xn"
      Parameters:
      funName - name of function
      inRules - an array of strings representing differentiation of function wrt "x1",...
      Throws:
      ParseException