B1#
- class splinebox.basis_functions.B1#
Basis function for a linear (\(1^{\text{st}}\) order) polynomial basis spline.
For a detailed theoretical description – including the equation and a plot of the function – refer to the Polynomial basis (B-spline) section in the documentation.
The constructor does not require any arguments.
Methods
__call__(t[, derivative])Evaluate the function at position(s) t.
Returns a filtered version of the input s, used to convert knots into control points for a closed spline.
Returns a filtered version of the input s, used to convert knots into control points for an open spline.
This function is needed for local refinement (see [Badoual2016]).
Examples
>>> import splinebox >>> import numpy as np >>> import matplotlib.pyplot as plt
Create a basis function object:
>>> basis_function = splinebox.basis_functions.B1()
Evaluate the basis function at a single position:
>>> basis_function(0.5) 0.5
Evaluate the basis function at multiple positions simultaneously:
>>> t = np.array([-0.2, 0, 0.5]) >>> basis_function(t) array([0.8, 1. , 0.5])
Compute the first derivative of the basis function at multiple positions:
>>> basis_function(t, derivative=1) array([ 1., nan, -1.])
>>> t = np.linspace(-1.4, 1.4, 500) >>> plt.plot(t, basis_function(t)) >>> plt.show()