## Class Calculus

• java.lang.Object
• ### Field Summary

Fields
Modifier and Type Field Description
`static int` `GENERAL_DERIVATIVE`
`static int` `LEFT_DERIVATIVE`
Derivative type specification
`static int` `RIGHT_DERIVATIVE`
• ### Constructor Summary

Constructors
Constructor Description
`Calculus()`
• ### Method Summary

Modifier and Type Method Description
`static double` ```backwardDifference​(Expression f, double h, Argument x)```
Backward difference(h) operator (at the current value of the argument x)
`static double` ```backwardDifference​(Expression f, double h, Argument x, double x0)```
Backward difference(h) operator (at x = x0)
`static double` ```backwardDifference​(Expression f, Argument x)```
Backward difference(1) operator (at current value of argument x)
`static double` ```backwardDifference​(Expression f, Argument x, double x0)```
Backward difference(1) operator (at x = x0).
`static double` ```derivative​(Expression f, Argument x, double x0, int derType, double eps, int maxSteps)```
Numerical derivative at x = x0
`static double` ```derivativeNth​(Expression f, double n, Argument x, double x0, int derType, double eps, int maxSteps)```
Numerical n-th derivative at x = x0 (you should avoid calculation of derivatives with order higher than 2).
`static double` ```forwardDifference​(Expression f, double h, Argument x)```
Forward difference(h) operator (at the current value of the argument x)
`static double` ```forwardDifference​(Expression f, double h, Argument x, double x0)```
Forward difference(h) operator (at x = x0)
`static double` ```forwardDifference​(Expression f, Argument x)```
Forward difference(1) operator (at current value of argument x)
`static double` ```forwardDifference​(Expression f, Argument x, double x0)```
Forward difference(1) operator (at x = x0)
`static double` ```integralTrapezoid​(Expression f, Argument x, double a, double b, double eps, int maxSteps)```
Trapezoid numerical integration
`static double` ```solveBrent​(Expression f, Argument x, double a, double b, double eps, double maxSteps)```
Brent solver (Brent root finder)
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### LEFT_DERIVATIVE

`public static final int LEFT_DERIVATIVE`
Derivative type specification
Constant Field Values
• #### RIGHT_DERIVATIVE

`public static final int RIGHT_DERIVATIVE`
Constant Field Values
• #### GENERAL_DERIVATIVE

`public static final int GENERAL_DERIVATIVE`
Constant Field Values
• ### Constructor Detail

• #### Calculus

`public Calculus()`
• ### Method Detail

• #### integralTrapezoid

```public static final double integralTrapezoid​(Expression f,
Argument x,
double a,
double b,
double eps,
int maxSteps)```
Trapezoid numerical integration
Parameters:
`f` - the expression
`x` - the argument
`a` - form a ...
`b` - ... to b
`eps` - the epsilon (error)
`maxSteps` - the maximum number of steps
Returns:
Integral value as double.
`Expression`
• #### derivative

```public static final double derivative​(Expression f,
Argument x,
double x0,
int derType,
double eps,
int maxSteps)```
Numerical derivative at x = x0
Parameters:
`f` - the expression
`x` - the argument
`x0` - at point x = x0
`derType` - derivative type (LEFT_DERIVATIVE, RIGHT_DERIVATIVE, GENERAL_DERIVATIVE
`eps` - the epsilon (error)
`maxSteps` - the maximum number of steps
Returns:
Derivative value as double.
`Expression`
• #### derivativeNth

```public static final double derivativeNth​(Expression f,
double n,
Argument x,
double x0,
int derType,
double eps,
int maxSteps)```
Numerical n-th derivative at x = x0 (you should avoid calculation of derivatives with order higher than 2).
Parameters:
`f` - the expression
`n` - the deriviative order
`x` - the argument
`x0` - at point x = x0
`derType` - derivative type (LEFT_DERIVATIVE, RIGHT_DERIVATIVE, GENERAL_DERIVATIVE
`eps` - the epsilon (error)
`maxSteps` - the maximum number of steps
Returns:
Derivative value as double.
`Expression`
• #### forwardDifference

```public static final double forwardDifference​(Expression f,
Argument x,
double x0)```
Forward difference(1) operator (at x = x0)
Parameters:
`f` - the expression
`x` - the argument name
`x0` - x = x0
Returns:
Forward difference(1) value calculated at x0.
`Expression`, `Argument`
• #### forwardDifference

```public static final double forwardDifference​(Expression f,
Argument x)```
Forward difference(1) operator (at current value of argument x)
Parameters:
`f` - the expression
`x` - the argument name
Returns:
Forward difference(1) value calculated at the current value of argument x.
`Expression`, `Argument`
• #### backwardDifference

```public static final double backwardDifference​(Expression f,
Argument x,
double x0)```
Backward difference(1) operator (at x = x0).
Parameters:
`f` - the expression
`x` - the argument name
`x0` - x = x0
Returns:
Backward difference value calculated at x0.
`Expression`, `Argument`
• #### backwardDifference

```public static final double backwardDifference​(Expression f,
Argument x)```
Backward difference(1) operator (at current value of argument x)
Parameters:
`f` - the expression
`x` - the argument name
Returns:
Backward difference(1) value calculated at the current value of argument x.
`Expression`, `Argument`
• #### forwardDifference

```public static final double forwardDifference​(Expression f,
double h,
Argument x,
double x0)```
Forward difference(h) operator (at x = x0)
Parameters:
`f` - the expression
`h` - the difference
`x` - the argument name
`x0` - x = x0
Returns:
Forward difference(h) value calculated at x0.
`Expression`, `Argument`
• #### forwardDifference

```public static final double forwardDifference​(Expression f,
double h,
Argument x)```
Forward difference(h) operator (at the current value of the argument x)
Parameters:
`f` - the expression
`h` - the difference
`x` - the argument name
Returns:
Forward difference(h) value calculated at at the current value of the argument x.
`Expression`, `Argument`
• #### backwardDifference

```public static final double backwardDifference​(Expression f,
double h,
Argument x,
double x0)```
Backward difference(h) operator (at x = x0)
Parameters:
`f` - the expression
`h` - the difference
`x` - the argument name
`x0` - x = x0
Returns:
Backward difference(h) value calculated at x0.
`Expression`, `Argument`
• #### backwardDifference

```public static final double backwardDifference​(Expression f,
double h,
Argument x)```
Backward difference(h) operator (at the current value of the argument x)
Parameters:
`f` - the expression
`h` - the difference
`x` - the argument name
Returns:
Backward difference(h) value calculated at at the current value of the argument x.
`Expression`, `Argument`
• #### solveBrent

```public static final double solveBrent​(Expression f,
Argument x,
double a,
double b,
double eps,
double maxSteps)```
Brent solver (Brent root finder)
Parameters:
`f` - Function given in the Expression form
`x` - Argument
`a` - Left limit
`b` - Right limit
`eps` - Epsilon value (accuracy)
`maxSteps` - Maximum number of iterations
Returns:
Function root - if found, otherwise Double.NaN.