This module defines some functions that perform common calculus operations, including differentiating, integrating, and interpolating discretized data.
Calculates the mean value of a real-valued array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Real-valued array |
Mean value
Calculates the mean value of a complex-valued array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:) | :: | x |
Complex-valued array |
Mean value
Calculates the numerical derivative of an array y wrt. x using central differences at the interior points and forward/backward differences at the exterior points. All three approaches yield two-point approximations of the derivatives, thus the mesh spacing does not 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
Complex version of differentiate_array_re.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Variable x |
|
complex(kind=wp), | intent(in), | dimension(size(x)) | :: | y |
Function y(x) |
Derivative dy/dx
Calculates the integral of an array y wrt. x using the trapezoid method. The mesh spacing 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) |
Integral ∫y(x)·dx
Complex version of integrate_array_re.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Variable x |
|
complex(kind=wp), | intent(in), | dimension(size(x)) | :: | y |
Function y(x) |
Integral ∫y(x)·dx
Constructs a piecewise hermitian cubic interpolation of an array y(x) from discrete numerical data, and then integrates the interpolation in the range (a, b). The mesh spacing does not 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) |
|
real(kind=wp), | intent(in) | :: | a |
Left endpoint |
||
real(kind=wp), | intent(in) | :: | b |
Right endpoint |
Integral ∫y(x)·dx
Complex version of integrate_range_re.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Variable x |
|
complex(kind=wp), | intent(in), | dimension(size(x)) | :: | y |
Function y(x) |
|
real(kind=wp), | intent(in) | :: | a |
Left endpoint |
||
real(kind=wp), | intent(in) | :: | b |
Right endpoint |
Integral ∫y(x)·dx
Constructs a piecewise hermitian cubic interpolation of an array y(x) based on discrete numerical data and evaluates the interpolation at p. Note that the mesh spacing 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) |
|
real(kind=wp), | intent(in), | dimension(:) | :: | p |
Point array p |
Interpolation y(p)
Complex version of interpolate_array_re.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Variable x |
|
complex(kind=wp), | intent(in), | dimension(size(x)) | :: | y |
Function y(x) |
|
real(kind=wp), | intent(in), | dimension(:) | :: | p |
Point array p |
Interpolation y(p)
Wrapper for interpolate_array_re that accepts scalar arguments.
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) |
|
real(kind=wp), | intent(in) | :: | p |
Single point p |
Interpolation y(p)
Complex version of interpolate_point_re.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Variable x |
|
complex(kind=wp), | intent(in), | dimension(size(x)) | :: | y |
Function y(x) |
|
real(kind=wp), | intent(in) | :: | p |
Single point p |
Interpolation y(p)
Interpolates a matrix function using Catmull-Rom splines.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | x |
Variable x |
|
real(kind=wp), | intent(in), | dimension(:, :, :) | :: | y |
Function y(x) |
|
real(kind=wp), | intent(in) | :: | p |
Single point p |
Interpolation y(p)
Populates an array with elements from first
to last
, inclusive.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(out), | dimension(:) | :: | array |
Output array to populate |
|
real(kind=wp), | intent(in) | :: | first |
Value of first element |
||
real(kind=wp), | intent(in) | :: | last |
Value of last element |