finite_differences Module

Module for finite difference calculus



Interfaces

public interface diff

Approximate the derivative of a function using finite differences

  • private pure function diff_at_point_i(y, x, i) result(dy)

    Returns the derivative of y with respect to x at point x(i) using a second order finite difference scheme x: array of x values y: array of y values i: index of the point at which the derivative is computed (must be between 1 and size(x)) returns: the derivative of y with respect to x at point x(i)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: y(:)
    real(kind=real64), intent(in) :: x(:)
    integer, intent(in) :: i

    Return Value real(kind=real64)

  • private pure function diff_at_all_points(y, x) result(dy)

    Returns the derivative of y with respect to x at all points using a second order finite difference scheme x: array of x values y: array of y values returns: the derivative of y with respect to x at all points

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: y(:)
    real(kind=real64), intent(in) :: x(:)

    Return Value real(kind=real64), (size(x))

public interface diff2

Approximate the second derivative of a function using finite differences

  • private pure function diff2_at_point_i(y, x, i) result(d2y)

    Returns the second derivative of y with respect to x at point x(i) using a second order finite difference scheme x: array of x values y: array of y values i: index of the point at which the derivative is computed (must be between 1 and size(x)) returns: the second derivative of y with respect to x at point x(i)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: y(:)
    real(kind=real64), intent(in) :: x(:)
    integer, intent(in) :: i

    Return Value real(kind=real64)

  • private pure function diff2_at_all_points(y, x) result(d2y)

    Returns the second derivative of y with respect to x at all points using a second order finite difference scheme x: array of x values y: array of y values returns: the second derivative of y with respect to x at all points

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: y(:)
    real(kind=real64), intent(in) :: x(:)

    Return Value real(kind=real64), (size(x))


Functions

public pure function integral(f, x) result(y)

Returns the integral of f with respect to x using integrated Taylor expansion f: array of f values x: array of x values returns: the integral of f with respect to x

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: f(:)
real(kind=real64), intent(in) :: x(:)

Return Value real(kind=real64)

public pure function primitive_function(f, x) result(y)

Returns the integral of f with respect to x using integrated Taylor expansion f: array of f values x: array of x values returns: the integral of f with respect to x

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: f(:)
real(kind=real64), intent(in) :: x(:)

Return Value real(kind=real64), (size(x))