This function calculates the numerical derivative of an array y with respect to x, using a central difference approximation at the interior points and forward/backward difference approximations at the exterior points. Note that since all the three approaches yield two-point approximations of the derivative, the mesh spacing of x does not necessarily have to be uniform.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x | Variable x |
|
real(kind=wp), | intent(in), | dimension(size(x)) | :: | y | Function y(x) |
Derivative dy/dx