Class Derivative

java.lang.Object
math.differentialcalculus.Derivative

public class Derivative extends Object
  • Field Details

    • builder

    • baseVariable

      protected String baseVariable
      The base variable that the top level expression is to be differentiated with respect to.
  • Constructor Details

    • Derivative

      Derivative(String expression) throws Exception
      Accepted format...diff(expr);or diff(diffName)...where diffName is the name of a stored Differentiable. e.g. diff(sin(3*x+1))
      Parameters:
      expression - The expression to be parsed into mathExpr and variable.
      Throws:
      Exception
  • Method Details

    • getMathExpr

      public String getMathExpr(String expression) throws Exception
      Throws:
      Exception
    • translateToBaseTerms

      public ArrayList<String> translateToBaseTerms(Differentiable d)
      Parameters:
      d - The Differentiable item
      Returns:
      an ArrayList containing this object's data in terms of the base variable.
    • translateToBaseTerms_1

      public ArrayList<String> translateToBaseTerms_1(Differentiable d)
      Returns:
      an ArrayList containing this object's data in terms of the base variable.
    • differentiate

      public String differentiate()
      Differentiates the expression.
      Returns:
      the derivative as a string of characters.
    • differentiateAsList

      public ArrayList<String> differentiateAsList()
      Differentiates the expression.
      Returns:
      the derivative as a list of scanned tokens.
    • isBaseVariable

      public boolean isBaseVariable(String name)
      Parameters:
      name - The name to check.
      Returns:
      true if the name is automatically generated and so, most likely refers to a stored Differentiable.
    • eval

      public static String eval(String expr)
      Parameters:
      expr - The expression to differentiate. It must have the form: diff(@(x)sin(x),2) or diff(@(x)sin(x),2,3) If the diff(@(x)sin(x),2) form is specified, then the function is differentiated 2 times and the result is returned. If the diff(@(x)sin(x),2,3) form is specified, then the function is differentiated 3 times and the result is evaluated at x = 2 and then the value is returned.
    • main

      public static void main(String[] args)
      Parameters:
      args -