Package math.numericalmethods
Class NumericalDerivative
- java.lang.Object
-
- math.numericalmethods.NumericalDerivative
-
public class NumericalDerivative extends java.lang.Object- Author:
- JIBOYE Oluwagbemiro Olaoluwa
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classNumericalDerivative.Parser
-
Constructor Summary
Constructors Constructor Description NumericalDerivative()NumericalDerivative(java.lang.String expression)NumericalDerivative(Function function, double xPoint)
-
Method Summary
Modifier and Type Method Description static java.lang.Object[]extractFunctionStringFromExpression(java.lang.String expression)Analyzes the expression and extracts the Function string from it.java.lang.StringfindDerivativeByLimit(double dx)java.lang.StringfindDerivativeByPolynomialExpander()FunctiongetFunction()java.lang.StringgetVariable()doublegetxPoint()static voidmain(java.lang.String[] args)voidsetFunction(Function function)voidsetxPoint(double xPoint)
-
-
-
Constructor Detail
-
NumericalDerivative
public NumericalDerivative()
-
NumericalDerivative
public NumericalDerivative(java.lang.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 Detail
-
setFunction
public void setFunction(Function function)
-
getFunction
public Function getFunction()
-
setxPoint
public void setxPoint(double xPoint)
-
getxPoint
public double getxPoint()
-
findDerivativeByPolynomialExpander
public java.lang.String findDerivativeByPolynomialExpander()
- Returns:
- the numerical value of the derivative very near the given point.
-
findDerivativeByLimit
public java.lang.String findDerivativeByLimit(double dx)
- Parameters:
dx- The infinitesimal used to compute the numerical derivative at the given xPoint on the function.- Returns:
- the numerical value of the derivative very near the given point.
-
extractFunctionStringFromExpression
public static java.lang.Object[] extractFunctionStringFromExpression(java.lang.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(java.lang.String[] args)
-
getVariable
public java.lang.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.
-
-