integral.dierckx {DierckxSpline}R Documentation

Spline Integration

Description

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

Usage

integral(x, ...)
## S3 method for class 'dierckx':
integral(x, from = NULL, to = NULL, ...)

Arguments

x 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

References

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

See Also

curfit, deriv.dierckx, spline, smooth.spline

Examples

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

[Package DierckxSpline version 1.0-9 Index]