TABLE OF CONTENTS
splineUtils/nBsmom [ Functions ]
NAME
nBsmom --- compute the N-th moment of a B-spline basis function
FUNCTION
Computes the N-th moment of the j-th B-spline basis function of order ord defined on the given set of knots.
SYNOPSIS
1540 nBsmom <- function(N, ord, j, knots)
INPUTS
N moment to compute ord order of the spline j which basis function to compute the moment for knots set of knots to use
OUTPUTS
double, containing the N-th B-spline moment
SOURCE
1543 { 1544 lknot <- knots[ki(knots, j - ord)] 1545 rknot <- knots[ki(knots, j)] 1546 if(lknot == rknot) return(rknot^N) 1547 # This is a magic recursive formula that can be computed easily using integration 1548 # by parts 1549 return(ord / (rknot - lknot) / (N + 1) * (-nBsmom(N + 1, ord - 1, j - 1, knots) + 1550 nBsmom(N + 1, ord - 1, j, knots))) 1551 }