wiggle: Wiggliness of a Spline function

View source: R/wiggle.R

wiggleR Documentation

Wiggliness of a Spline function

Description

Calculate the integral of the squared second derivative of the spline function.

Usage

wiggle(object, lower, upper, stop.on.error = FALSE, ...)

Arguments

object

a cpr_cp object

lower

the lower limit of the integral

upper

the upper limit of the integral

stop.on.error

default to FALSE, see integrate.

...

additional arguments passed to integrate

Details

The wiggliness of the spline function is defined as

\int \left( \frac{\mathrm{d}^2}{\mathrm{d}x^2} f \left(x \right) \right)^2 \mathrm{d}x.

Value

Same as integrate.

See Also

cp, integrate, sign_changes

Examples

xvec <- seq(0, 6, length = 500)

# Define the basis matrix
bmat1 <- bsplines(x = xvec, iknots = c(1, 1.5, 2.3, 4, 4.5))
bmat2 <- bsplines(x = xvec)

# Define the control vertices ordinates
theta1 <- c(1, 0, 3.5, 4.2, 3.7, -0.5, -0.7, 2, 1.5)
theta2 <- c(1, 3.4, -2, 1.7)

# build the two control polygons
cp1 <- cp(bmat1, theta1)
cp2 <- cp(bmat2, theta2)
plot(cp1, cp2, show_cp = FALSE, show_spline = TRUE)

wiggle(cp1)
wiggle(cp2)


dewittpe/cpr documentation built on Feb. 16, 2024, 1:11 p.m.