forward_diff Subroutine

private subroutine forward_diff(f, x, h, dfdx)

Compute the first derivative using a forward difference. This is Equation 1 from Reference [1].

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f
complex(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: h
real(kind=wp), intent(out) :: dfdx

Called by

proc~~forward_diff~~CalledByGraph proc~forward_diff complex_step_module::forward_diff proc~complex_step_test complex_step_module::complex_step_test proc~complex_step_test->proc~forward_diff

Source Code

    subroutine forward_diff(f,x,h,dfdx)

    implicit none

    procedure(func)        :: f
    complex(wp),intent(in) :: x
    real(wp),intent(in)    :: h
    real(wp),intent(out)   :: dfdx

    dfdx = (f(x+h) - f(x)) / h

    end subroutine forward_diff