Learn R Programming

ComplexAnalysis (version 1.0)

derv: Derivative using the Cauchy integral formula.

Description

Evaluates n-th order derivative of a real- or complex-valued function where n is a non-zero natural number.

Usage

derv(func, x0, n = 1, complex = FALSE , tol= .Machine$double.eps^0.5)

Arguments

func
A real- or complex-valued function. The function must be analytic at z0.
x0
A scalar or vector at which the derivative is evaluated.
n
A non-zero natural number.
complex
If TRUE, complex-valued output is returned. If the evaluated derivative is complex but complex=TRUE, only the real part is returned.
tol
Relative tolerance in calculating the integral. This is the one in the R built-in function integrate.

Value

A real- or complex-valued scalar or vector.

Details

Derivative using the Cauchy integral formula.

Examples

Run this code
derv(function(x){x^3},x0=2,n=2)
derv(function(z){sin(z^2)/cos(1/z)},1)

Run the code above in your browser using DataLab