Divide one Chebyshev series by another in Python

To divide one Chebyshev series by another, use the polynomial.chebyshev.chebdiv() method in Python NumPy. The method returns arrays of Chebyshev series coefficients representing the quotient and remainder.

The method returns the quotient-with-remainder of two Chebyshev series c1 / c2. The arguments are sequences of coefficients from lowest order "term" to highest, e.g., [1,2,3] represents the series T_0 + 2*T_1 + 3*T_2. The parameters c1 and c2 are 1-D arrays of Chebyshev series coefficients ordered from low to high.

Syntax

numpy.polynomial.chebyshev.chebdiv(c1, c2)

Parameters

  • c1 ? 1-D array of Chebyshev series coefficients (dividend)
  • c2 ? 1-D array of Chebyshev series coefficients (divisor)

Return Value

Returns a tuple (quotient, remainder) where both are arrays of Chebyshev series coefficients.

Example

Let's divide one Chebyshev series by another and examine the quotient and remainder ?

import numpy as np
from numpy.polynomial import chebyshev as C

# Create 1-D arrays of Chebyshev series coefficients
c1 = np.array([1, 2, 3])  # Dividend: T_0 + 2*T_1 + 3*T_2
c2 = np.array([3, 2, 1])  # Divisor: 3*T_0 + 2*T_1 + T_2

print("Dividend coefficients:", c1)
print("Divisor coefficients:", c2)

# Divide one Chebyshev series by another
quotient, remainder = C.chebdiv(c1, c2)

print("Quotient:", quotient)
print("Remainder:", remainder)
Dividend coefficients: [1 2 3]
Divisor coefficients: [3 2 1]
Quotient: [3.]
Remainder: [-8. -4.]

Understanding the Result

The division returns a quotient of [3.] and remainder of [-8., -4.]. This means ?

import numpy as np
from numpy.polynomial import chebyshev as C

c1 = np.array([1, 2, 3])
c2 = np.array([3, 2, 1])

quotient, remainder = C.chebdiv(c1, c2)

# Verify: c1 = c2 * quotient + remainder
verification = C.chebadd(C.chebmul(c2, quotient), remainder)
print("Original dividend:", c1)
print("Verification (c2*quotient + remainder):", verification)
print("Are they equal?", np.allclose(c1, verification))
Original dividend: [1 2 3]
Verification (c2*quotient + remainder): [1. 2. 3.]
Are they equal? True

Working with Higher Order Polynomials

Let's see division with higher degree polynomials ?

import numpy as np
from numpy.polynomial import chebyshev as C

# Higher degree dividend
dividend = np.array([1, 0, 2, 1, 3])  # T_0 + 2*T_2 + T_3 + 3*T_4
divisor = np.array([1, 1])            # T_0 + T_1

quotient, remainder = C.chebdiv(dividend, divisor)

print("Dividend coefficients:", dividend)
print("Divisor coefficients:", divisor)
print("Quotient coefficients:", quotient)
print("Remainder coefficients:", remainder)
Dividend coefficients: [1 0 2 1 3]
Divisor coefficients: [1 1]
Quotient coefficients: [ 1.   -1.    1.5   1.5]
Remainder coefficients: [-0.5]

Conclusion

The chebdiv() function performs polynomial long division on Chebyshev series, returning both quotient and remainder. This is useful for polynomial factorization and solving rational polynomial expressions in Chebyshev form.

Updated on: 2026-03-26T20:52:19+05:30

174 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements