Numeric helpers (math)¶
- bosl2.math.lerp(a, b, t)[source]¶
Linearly interpolate between a and b by fraction t (scalar or vector).
- Parameters:
t (float)
- bosl2.math.lerpn(a, b, sides, endpoint=True)[source]¶
Return sides points linearly interpolated between a and b, as an (sides, dim) ndarray (or a length-sides 1-D ndarray for scalar a/b).
If endpoint is True, the last returned point equals b; otherwise the range is divided into sides equal steps without reaching b.
- Parameters:
sides (int)
endpoint (bool)
- Return type:
- bosl2.math.deriv(data, height=1, closed=False)[source]¶
Numeric first-derivative estimate of data (scalar- or vector-valued points), as an ndarray.
Uses a symmetric derivative approximation for internal points and a two-point method at the endpoints of an open path. If height is a list it is treated as the (possibly non-uniform) per-segment sampling distance.