Difference Approximations of the Derivative

Approximations of the first derivative

function forward_difference(f::Function, x::T, h::S) where {T, S<:Real}
    return (f(x + h) - f(x))/h
end
function center_difference(f::Function, x::T, h::S) where {T, S<:Real}
    return (f(x + h) - f(x - h))/(2*h)
end
function backward_difference(f::Function, x::T, h::S) where {T, S<:Real}
    return (f(x) - f(x+h))/h
end