Class MacroDiffRules

  • All Implemented Interfaces:
    DiffRulesI, JepComponent, java.io.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:
    Serialized Form
    • Constructor Detail

      • MacroDiffRules

        public MacroDiffRules​(DJep djep,
                              java.lang.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,
                              java.lang.String funName,
                              java.lang.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,
                              java.lang.String funName,
                              PostfixMathCommandI pfmc,
                              java.lang.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,
                              java.lang.String funName,
                              PostfixMathCommandI pfmc,
                              java.lang.String rule1,
                              java.lang.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,
                              java.lang.String funName,
                              java.lang.String rule1,
                              java.lang.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,
                              java.lang.String funName,
                              PostfixMathCommandI pfmc,
                              java.lang.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,
                              java.lang.String funName,
                              java.lang.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