# make_cheb_matrix¶

rubin_sim.moving_objects.make_cheb_matrix(n_points, n_poly, weight=0.16)

Compute C1^(-1)C2 using Newhall89 approach.

Utility function for fitting chebyshev polynomials to x(t) and dx/dt(t) forcing equality at the end points. This function computes the matrix (C1^(-1)C2). Multiplying this matrix by the x and dx/dt values to be fit produces the chebyshev coefficient. This function need only be called once for a given polynomial degree and number of points.

The matrices returned are of shape(n_points+1)x(n_poly). The coefficients fitting the n_points+1 points, X, are found by: A = xMultiplier * x + dxMultiplier * dxdt if derivative information is known, or A = xMultiplier * x if no derivative information is known. The xMultiplier matrices are different, depending on whether derivative information is known. Use function make_cheb_matrix_only_x if derviative is not known. See Newhall, X. X. 1989, Celestial Mechanics, 45, p. 305-310 for details.

Parameters:
n_points: `int`

Number of point to be fits. Must be greater than 2.

n_poly: `int`

Number of polynomial terms. Polynomial degree + 1

weight: `float`, optional

Weight to allow control of relative effectos of position and velocity values. Newhall80 found best results are obtained with velocity weighted at 0.4 relative to position, giving W the form (1.0, 0.16, 1.0, 0.16,…)

Returns:
c1c2: `np.ndarray`

xMultiplier, C1^(-1)C2 even rows of shape (n_points+1)x(n_poly) to be multiplied by x values.

c1c2: `np.ndarray`

dxMultiplier, C1^(-1)C2 odd rows of shape (n_points+1)x(n_poly) to be multiplied by dx/dy values