Learn R Programming

mosaic (version 0.1-51)

.oldD: Old Versions of Derivative and Anti-derivative operators

Description

Operators for computing numerical derivatives and anti-derivatives as functions. Use the new D and antiD instead.

Usage

.oldD(f, n=1, h = 1e-04)
.oldAntiD(f, input0 = 0, val0 = 0, init = c(input0, val0), ...)

Arguments

f
a function that returns a numerical vector of the same length as its first (numerical) argument. All values are required to be finite.
h
horizontal distance between points used for secant slope calculation in .oldD().
n
order of derivative
input0
initial input to f unless init is used instead
val0
initial value of f unless init is used instead
init
a numerical vector of length 2 providing an initial input to and value of the function f
...
additional arguments to f

Value

  • A function.

Examples

Run this code
fplot(mosaic:::.oldD(sin),xlim=c(-2*pi,2*pi))
fplot(mosaic:::.oldAntiD(sin),xlim=c(-2*pi,2*pi))
fplot( list( sin, mosaic:::.oldD(sin), mosaic:::.oldD(sin,2) ), xlim=c(-2*pi, 2*pi) )
f <- mosaic:::.oldAntiD(cos)
f(1)
sin(1)

Run the code above in your browser using DataLab