## math.numerics Class Derivative

```java.lang.Object
math.numerics.Derivative
```

`public class Derivativeextends java.lang.Object`

Class Integral defines various derivative algorithms. This class cannot be subclassed or instantiated because all methods are static.

Author:
Wolfgang Christian

Method Summary
`static double` ```centered(Function f, double x, double h)```
Calculates the derivative of a function using the centered difference approximation.
`static double` ```centeredPartial(MultiVarFunction f, double[] x, int n, double tol)```

`static double[][]` ```fillArray(Function f, double start, double stop, double tol, double[][] data)```
Fills an array with the derivatives of a function.
`static double[][]` ```fillArray(Function f, double start, double stop, double tol, int n)```

`static double` ```romberg(Function f, double x0, double h, double tol)```
Calculates the derivative using the Romberg scheme for Richardson extrapolation.
`static double` ```second(Function f, double x, double tol)```

`static double[][]` ```secondFillArray(Function f, double start, double stop, double tol, double[][] data)```
Fills an array with the second derivative of a function.
`static double[][]` ```secondFillArray(Function f, double start, double stop, double tol, int n)```
Fills an array with the second derivative of a function.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### romberg

```public static double romberg(Function f,
double x0,
double h,
double tol)```
Calculates the derivative using the Romberg scheme for Richardson extrapolation. This method runs until all Romberg rows are filled or until the step size drops below defaultNumericalPrecision or if the desired tolerance is reached.

Parameters:
`f` - the function
`x0` - where derivative is to be calculated
`h` - initial step size
`tol` - desired accuracy
Returns:

### centered

```public static double centered(Function f,
double x,
double h)```
Calculates the derivative of a function using the centered difference approximation.

Parameters:
`f` - the function
`x` - the x value
`h` -
Returns:

### centeredPartial

```public static double centeredPartial(MultiVarFunction f,
double[] x,
int n,
double tol)```

### second

```public static double second(Function f,
double x,
double tol)```

### secondFillArray

```public static double[][] secondFillArray(Function f,
double start,
double stop,
double tol,
int n)```
Fills an array with the second derivative of a function.

Parameters:
`f` -
`start` -
`stop` -
`tol` -
`n` -
Returns:

### secondFillArray

```public static double[][] secondFillArray(Function f,
double start,
double stop,
double tol,
double[][] data)```
Fills an array with the second derivative of a function.

Parameters:
`f` - Function
`start` - double
`stop` - double
`tol` - double
`data` - double[][]
Returns:
double[][]

### fillArray

```public static double[][] fillArray(Function f,
double start,
double stop,
double tol,
double[][] data)```
Fills an array with the derivatives of a function.

Parameters:
`f` -
`start` -
`stop` -
`tol` -
`data` -
Returns:

### fillArray

```public static double[][] fillArray(Function f,
double start,
double stop,
double tol,
int n)```