Class PowerDiffRule

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

public class PowerDiffRule extends Object implements DiffRulesI
Differentiates a power y^z with respect to a variable. If z is a constant number diff(y^z,x) -> z * y^(z-1) If y is a constant number diff(y^z,x) -> y^z * ln(z) * diff(z,x) otherwise diff(y^z,x) -> z * y^(z-1) * diff(y,x) + y^z * ln(z) * diff(z,x)
See Also:
  • Constructor Details

    • PowerDiffRule

      public PowerDiffRule(DJep djep, Operator op)
  • Method Details

    • init

      public void init(Jep djep)
      Description copied from interface: JepComponent
      Initialize the component. This method 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 interface JepComponent
      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 interface JepComponent
      Returns:
      either a new instance, null or 'this'.
    • toString

      public String toString()
      Description copied from interface: DiffRulesI
      Returns a string representation of the rule.
      Specified by:
      toString in interface DiffRulesI
      Overrides:
      toString in class Object
    • getName

      public 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 interface DiffRulesI
    • differentiate

      public Node differentiate(ASTFunNode node, String var, Node[] children, Node[] dchildren) throws JepException
      Description copied from interface: DiffRulesI
      Returns the top node of the derivative of this function wrt to variable var.
      Specified by:
      differentiate in interface DiffRulesI
      Parameters:
      var - The name of variable to differentiate wrt to.
      children - the arguments of the function
      dchildren - the derivatives of each argument of the function.
      Returns:
      top node of and expression tree for the derivative.
      Throws:
      JepException
    • getEvalue

      public Object getEvalue()
    • setEvalue

      public void setEvalue(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.