Calculates the numerical derivative of a given array. A sixth-order accurate central difference stencil is used to calculate the derivative. Near the edges a sixth-order accurate forward and backward difference stencil is used for the left and right boundary, respectively. It is assumed that the x values are all equally spaced. If this is not the case, a polynomial interpolation on a uniform grid can be done and that one can be differentiated instead. The stencils are as follows:
Throws an error if x_values and y_values differ in size.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | x(:) | x-values against which to differentiate |
||
real(kind=dp), | intent(in) | :: | y(:) | array of y-values, assuming relation |
||
real(kind=dp), | intent(out) | :: | dy(size(y)) | derivative of with respect to , same size as input arrays |
||
real(kind=dp), | intent(in), | optional | :: | dxtol | optional tolerance for equally spaced arrays |