Compute the first derivative using a forward difference. This is Equation 1 from Reference [1].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
procedure(func) | :: | f | ||||
complex(kind=wp), | intent(in) | :: | x | |||
real(kind=wp), | intent(in) | :: | h | |||
real(kind=wp), | intent(out) | :: | dfdx |
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