Class MacroDiffRules
- java.lang.Object
-
- com.singularsys.extensions.djep.diffRules.ChainRuleDiffRules
-
- com.singularsys.extensions.djep.diffRules.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 applieddiff(f(g(x),h(x)),x) -> df/dg dg/dx + df/dh dh/dx
for exampleDifferentiationVisitor dv = new DifferentiationVisitor(new TreeUtils(jep)); DiffRulesI rule = new MacroDiffRules(dv, "sin", "cos(x)");
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MacroDiffRules(DJep djep, java.lang.String funName, Node node)
Create a differentiation rule for function with 1 argumentMacroDiffRules(DJep djep, java.lang.String funName, PostfixMathCommandI pfmc, java.lang.String rule)
Create a differentiation rule for function with 1 argumentMacroDiffRules(DJep djep, java.lang.String funName, PostfixMathCommandI pfmc, java.lang.String[] inRules)
Create a differentiation rule for function with n arguments.MacroDiffRules(DJep djep, java.lang.String funName, PostfixMathCommandI pfmc, java.lang.String rule1, java.lang.String rule2)
Create a differentiation rule for function with 2 arguments.MacroDiffRules(DJep djep, java.lang.String funName, java.lang.String rule)
Create a differentiation rule for function with 1 argumentMacroDiffRules(DJep djep, java.lang.String funName, java.lang.String[] inRules)
Create a differentiation rule for function with n arguments.MacroDiffRules(DJep djep, java.lang.String funName, java.lang.String rule1, java.lang.String rule2)
Create a differentiation rule for function with 2 arguments.
-
Method Summary
-
Methods inherited from class com.singularsys.extensions.djep.diffRules.ChainRuleDiffRules
differentiate, getArgNames, getDescriptions, getLightWeightInstance, getName, getNumRules, getPfmc, getRule, init, setup, setup, setup, toString
-
-
-
-
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 instancefunName
- name of functionnode
- 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 instancefunName
- name of functionrule
- 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 instancefunName
- name of functionpfmc
- PostfixMathCommandI for functionrule
- 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 instancefunName
- name of functionpfmc
- PostfixMathCommandI for functionrule1
- 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 functionrule1
- 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 instancefunName
- name of functionpfmc
- 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 functioninRules
- an array of strings representing differentiation of function wrt "x1",...- Throws:
ParseException
-
-