integral.dierckx: Spline Integration

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

Description

Calculates the integral of a spline function s(x) of degree k, which is given in its normalized b-spline representation

Usage

1
2
## S3 method for class 'dierckx'
integral(expr, from = NULL, to = NULL, ...)

Arguments

expr

An object of class dierckx.

from

Lower integration bound. If NULL, the minimum knot value is used.

to

Upper integration bound. If NULL, the maximum knot value is used.

...

ignored

Details

s(x) is considered to be identically zero outside the interval (t(k+1),t(n-k)), where t are the knot values. For this reason, from and to are forced to be in or on the boundaries of the knots.

Value

The value of the integral.

Author(s)

Sundar Dorai-Raj with help from William Venables on how to eliminate a conflict between the generic integral functions in the PolynomF and DierckxSpline packages.

References

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

See Also

integral, curfit, deriv.dierckx, spline, smooth.spline

Examples

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

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

(answer <- integrate(function(x) (1 - x)^3, 0, 1))
#0.25 with absolute error < 2.8e-15
integral(z)-answer$value
# 0

(ans2 <- integrate(function(x) (1 - x)^3, 0.5, 0.6))
#0.009225 with absolute error < 1.0e-16
integral(z, 0.5, 0.6)-ans2$value
# 6e-9

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