Class PowerDiffRule
- java.lang.Object
-
- com.singularsys.extensions.djep.diffRules.PowerDiffRule
-
- All Implemented Interfaces:
DiffRulesI
,JepComponent
,java.io.Serializable
public class PowerDiffRule extends java.lang.Object implements DiffRulesI
Differentiates a powery^z
with respect to a variable. If z is a constant numberdiff(y^z,x) -> z * y^(z-1)
If y is a constant numberdiff(y^z,x) -> y^z * ln(z) * diff(z,x)
otherwisediff(y^z,x) -> z * y^(z-1) * diff(y,x) + y^z * ln(z) * diff(z,x)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PowerDiffRule(DJep djep, Operator op)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
differentiate(ASTFunNode node, java.lang.String var, Node[] children, Node[] dchildren)
Returns the top node of of the derivative of this function wrt to variable var.java.lang.Object
getEvalue()
JepComponent
getLightWeightInstance()
Gets a light-weight instance suitable for using in multiple threads.java.lang.String
getName()
Returns the name of the function.void
init(Jep djep)
Initialize the component.void
setEvalue(java.lang.Object eValue)
Sets the value used to detect if a constant is e, default Math.Ejava.lang.String
toString()
Returns a string representation of the rule.
-
-
-
Method Detail
-
init
public void init(Jep djep)
Description copied from interface:JepComponent
Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.- Specified by:
init
in interfaceJepComponent
- Parameters:
djep
- the current Jep instance
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Description copied from interface:JepComponent
Gets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstance
in interfaceJepComponent
- Returns:
- either an new instance, null or 'this'.
-
toString
public java.lang.String toString()
Description copied from interface:DiffRulesI
Returns a string representation of the rule.- Specified by:
toString
in interfaceDiffRulesI
- Overrides:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()
Description copied from interface:DiffRulesI
Returns the name of the function. Used as index in hashtable and as way of linking with standard Jep functions. You probably want to specify the in the constructors.- Specified by:
getName
in interfaceDiffRulesI
-
differentiate
public Node differentiate(ASTFunNode node, java.lang.String var, Node[] children, Node[] dchildren) throws JepException
Description copied from interface:DiffRulesI
Returns the top node of of the derivative of this function wrt to variable var.- Specified by:
differentiate
in interfaceDiffRulesI
var
- The name of variable to differentiate wrt to.children
- the arguments of the functiondchildren
- the derivatives of each argument of the function.- Returns:
- top node of and expression tree for the derivative.
- Throws:
ParseException
- if there is some problem in compiling the derivative.JepException
-
getEvalue
public java.lang.Object getEvalue()
-
setEvalue
public void setEvalue(java.lang.Object eValue)
Sets the value used to detect if a constant is e, default Math.E- Parameters:
eValue
- value to use will be tested using values equals method.
-
-