Description Usage Arguments Details Value Author(s) References See Also Examples
Calculates the integral of a spline function s(x) of degree k, which is given in its normalized b-spline representation
1 2 |
expr |
An object of class |
from |
Lower integration bound. If |
to |
Upper integration bound. If |
... |
ignored |
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.
The value of the integral.
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.
Dierckx, P. (1991) Curve and Surface Fitting with Splines, Oxford Science Publications.
integral
,
curfit
,
deriv.dierckx
,
spline
,
smooth.spline
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.