Class NumericalDerivative

java.lang.Object
com.github.gbenroscience.math.numericalmethods.NumericalDerivative

public class NumericalDerivative extends Object
Author:
JIBOYE Oluwagbemiro Olaoluwa
  • Constructor Details

    • NumericalDerivative

      public NumericalDerivative()
    • NumericalDerivative

      public NumericalDerivative(String expression)
      Parameters:
      expression - An expression containing information about the function whose derivative is to be evaluated and the point at which the derivative is to be evaluated. For example: function,4....means find the derivative of the function at the point where x=4 on the curve. Direct examples would be: diff(@(x)sin(x+1),4) diff(F,5.32) and so on.
    • NumericalDerivative

      public NumericalDerivative(Function function, double xPoint)
  • Method Details

    • setFunction

      public void setFunction(Function function)
    • getFunction

      public Function getFunction()
    • setxPoint

      public void setxPoint(double xPoint)
    • getxPoint

      public double getxPoint()
    • findDerivativeChebyshev

      public double findDerivativeChebyshev()
      Returns:
      the numerical value of the derivative very near the given point.
    • extractFunctionStringFromExpression

      public static Object[] extractFunctionStringFromExpression(String expression)
      Analyzes the expression and extracts the Function string from it.
      Parameters:
      expression - The expression to be analyzed. Direct examples would be: diff(@sin(x+1),4) diff(F,5.32) where F is a function that has been defined before in the workspace.. and so on.
      Returns:
      an Object array containing at index 0, the function string,which may or may not be anonymous, and in index 1, the horizontal coordinate of type double where the derivative is needed.
    • main

      public static void main(String[] args)
    • getVariable

      public String getVariable()
      Returns:
      the independent variable in a 2D function e.g. f(x)=sin(x). If the function is more than 2D then it returns the first independent variable alone.