Package math.numericalmethods
Class NumericalDerivative
java.lang.Object
math.numericalmethods.NumericalDerivative
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNumericalDerivative
(String expression) NumericalDerivative
(Function function, double xPoint) -
Method Summary
Modifier and TypeMethodDescriptionstatic Object[]
extractFunctionStringFromExpression
(String expression) Analyzes the expression and extracts the Function string from it.findDerivativeByLimit
(double dx) double
static void
void
setFunction
(Function function) void
setxPoint
(double xPoint)
-
Field Details
-
function
The function to differentiate. -
xPoint
private double xPointThe x coordinate of the point on the function where we need to find the derivative.
-
-
Constructor Details
-
NumericalDerivative
public NumericalDerivative() -
NumericalDerivative
- 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
-
-
Method Details
-
setFunction
-
getFunction
-
setxPoint
public void setxPoint(double xPoint) -
getxPoint
public double getxPoint() -
findDerivativeByPolynomialExpander
- Returns:
- the numerical value of the derivative very near the given point.
-
findDerivativeByLimit
- 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
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
-
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.
-