Learn R Programming

cmna (version 0.1.2)

findiff: Finite Differences

Description

Finite differences formulas

Usage

findiff(f, x, h)
symdiff(f, x, h = tol * 10, tol = 0.001, m = 100)
findiff2(f, x, h)
rdiff(f, x, n = 10, h = 1e-04)

Arguments

f
function to differentiate
x
the x-value to differentiate at
h
the step-size for evaluation
tol
the error tolerance for symdiff
m
the maximum number of convergence steps in symdiff
n
the maximum number of convergence steps in rdiff

Value

the value of the derivative

Details

The findiff formula uses the finite differences formula to find the derivative of f at x. The value of h is the step size of the evaluation. The function findiff2 provides the second derivative.

Examples

Run this code
findiff(sin, pi, 1e-3)
symdiff(sin, pi, 1e-3)

Run the code above in your browser using DataLab