chebeval¶
- rubin_sim.moving_objects.chebeval(x, p, interval=(-1.0, 1.0), do_velocity=True, mask=False)¶
Evaluate a Chebyshev series and first derivative at points x.
If p is of length n + 1, this function returns: y_hat(x) = p_0 * T_0(x*) + p_1 * T_1(x*) + … + p_n * T_n(x*) where T_n(x*) are the orthogonal Chebyshev polynomials of the first kind, defined on the interval [-1, 1] and p_n are the coefficients. The scaled variable x* is defined on the [-1, 1] interval such that (x*) = (2*x - a - b)/(b - a), and x is defined on the [a, b] interval.
- Parameters:
- x: `scalar` or `np.ndarray`
Points at which to evaluate the polynomial.
- p: `np.ndarray`
Chebyshev polynomial coefficients, as returned by chebfit.
- interval: 2-element list/tuple
Bounds the x-interval on which the Chebyshev coefficients were fit.
- do_velocity: `bool`
If True, compute the first derivative at points x.
- mask: `bool`
If True, return Nans when the x goes beyond ‘interval’. If False, extrapolate fit beyond ‘interval’ limits.
- Returns
- ——-
- y, v: `float` or `np.ndarray`, `float` or `np.ndarray` (or None)
Y (position) and velocity values (if computed)