Skip to contents

Computes the coefficients \(\alpha_j\) in the truncated power representation of a B-spline basis function of degree k, valid for k = 0, 1, 2. These coefficients allow the basis function to be expressed as a linear combination of truncated power functions over the relevant knot interval.

Usage

bspline_alpha_rule(knots, i, k)

Arguments

knots

A numeric vector of knots.

i

An integer index indicating the position in the knot sequence for which to compute the coefficients.

k

The degree of the B-spline basis function (must be 0, 1, or 2).

Value

A numeric vector of coefficients \(\alpha_j\) for the truncated power expansion.

Details

For:

  • k = 0, returns \((1, -1)\) for the characteristic function over a single interval.

  • k = 1, returns a 3-vector corresponding to linear B-spline basis functions.

  • k = 2, returns a 4-vector for quadratic B-spline basis functions.

The function throws an error if any required knot difference is zero (i.e. repeated knots), or if k > 2.

Examples

knots <- c(0, 1, 2, 3, 4, 5)
bspline_alpha_rule(knots, i = 1, k = 1)
#> [1]  1 -2  1