deriv.dierckx: Spline Differentiation

Description Usage Arguments Value Author(s) References See Also Examples

Description

Evaluates in a number of points x(i),i=1,2,...,m the derivative of order nu of a spline s(x) of degree k,given in its b-spline representation.

Usage

1
2
## S3 method for class 'dierckx'
deriv(expr, at = NULL, order = 1, ...)

Arguments

expr

An object of class dierckx.

at

Optional numeric vector where the derivatives should be calculated. If missing, the initial abscissa values are used.

order

Order of the derivative of the derivative to calculate. Default is 1 (first derivative). Valid values are 0<=order<=k.

...

ignored

Value

A numeric vector the same length as at containing the derivatives.

Author(s)

Sundar Dorai-Raj

References

Dierckx, P. (1991) Curve and Surface Fitting with Splines, Oxford Science Publications.

See Also

curfit, integral.dierckx, spline, smooth.spline

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
x <- seq(0, 1, 0.1)
y <- (1 - x)^3
z <- curfit(x, y, method = "ls", knots = seq(0, 1, 0.2), k = 3)

plot(x, y, type = "p")
lines(x, fitted(z), col = "blue")

D1 <- deriv(z, order = 1)
D2 <- deriv(~(1 - x)^3, "x", func = TRUE)(z$x)
D3 <- numericDeriv(quote((1 - x)^3), "x")
D4 <- -3 * (1 - z$x)^2
cbind(D1 = D1,
     D2 = attr(D2, "gradient")[, 1],
     D3 = diag(attr(D3, "gradient")),
     D4 = D4)

DierckxSpline documentation built on May 2, 2019, 6:30 p.m.