Skip to contents

(f(x+h) - f(x-h)) / 2h with a Richardson extrapolation cross-check from the 2h estimate.

Usage

morie_geron_numerical_differentiation(f, x, h = 1e-05)

Arguments

f

Scalar-valued function.

x

Scalar or numeric vector.

h

Positive step.

Value

List with derivative, derivative_2h, richardson, step_error.

Examples

morie_geron_numerical_differentiation(function(t) sin(t)^2, 0.7)
#> $derivative
#> [1] 0.9854497
#> 
#> $derivative_2h
#> [1] 0.9854497
#> 
#> $richardson
#> [1] 0.9854497
#> 
#> $step_error
#> [1] 1.915135e-10
#> 
#> $estimate
#> [1] 0.9854497
#> 
#> $n
#> [1] 1
#>