NNS Numerical Differentiation

Share:

Description

Determines numerical derivative of a given function using projected secant lines on the y-axis. These projected points infer finite steps h, in the finite step method.

Usage

1
NNS.diff(f, point, h = 0.1, tol = 1e-10, print.trace = FALSE)

Arguments

f

Function to be derived. Does not have to be defined f<-...

point

Point to be evaluated for derivative of a given function f.

h

Initial step for secant projection. Defaults to 0.1.

tol

Sets the tolerance for the stopping condition of the inferred h.

print.trace

Displays the iteration, lower y-intercept, upper y-intercept and inferred h. Defaults to print.trace=FALSE.

Value

Returns a matrix of values, intercepts, derivatives, inferred step sizes for multiple methods of estimation.

Author(s)

Fred Viole, OVVO Financial Systems

References

Viole, F. and Nawrocki, D. (2013) "Nonlinear Nonparametric Statistics: Using Partial Moments" http://amzn.com/1490523995

Examples

1
2
3
4
5
f<- function(x) sin(x)/x
NNS.diff(f,4.1)

g<- function(x) sin(x)
NNS.diff(g,1)