Multiply a Chebyshev series by an independent variable in Python

To multiply a Chebyshev series by an independent variable, use the polynomial.chebyshev.chebmulx() method in NumPy. This method multiplies the Chebyshev polynomial by the variable x, effectively increasing the degree by 1.

Syntax

numpy.polynomial.chebyshev.chebmulx(c)

Parameters

c − 1-D array of Chebyshev series coefficients ordered from low to high degree.

Basic Example

Let's start with a simple example to understand how chebmulx() works ?

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

# Create a simple Chebyshev series [1, 2, 3]
# This represents: 1*T0(x) + 2*T1(x) + 3*T2(x)
coeffs = np.array([1, 2, 3])

print("Original coefficients:", coeffs)
print("Result after multiplying by x:", C.chebmulx(coeffs))
Original coefficients: [1 2 3]
Result after multiplying by x: [1.  2.5 1.  1.5]

How It Works

When you multiply a Chebyshev polynomial by x, the operation follows the recurrence relation. The degree increases by 1, and the coefficients are redistributed according to Chebyshev polynomial properties.

Working with Different Coefficient Arrays

Let's explore how the method works with different input arrays ?

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

# Single coefficient (constant term)
single_coeff = np.array([5])
print("Single coefficient [5]:")
print("Result:", C.chebmulx(single_coeff))

# Two coefficients
two_coeffs = np.array([1, 4])
print("\nTwo coefficients [1, 4]:")
print("Result:", C.chebmulx(two_coeffs))

# Four coefficients
four_coeffs = np.array([2, -1, 3, 1])
print("\nFour coefficients [2, -1, 3, 1]:")
print("Result:", C.chebmulx(four_coeffs))
Single coefficient [5]:
Result: [0. 5.]

Two coefficients [1, 4]:
Result: [2. 1. 2.]

Four coefficients [2, -1, 3, 1]:
Result: [-0.5  2.   0.5  1.5  0.5]

Array Properties Analysis

Let's examine the properties of the input and output arrays ?

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

# Create coefficient array
coeffs = np.array([1, 2, 3])

print("Input array:", coeffs)
print("Input dimensions:", coeffs.ndim)
print("Input shape:", coeffs.shape)
print("Input datatype:", coeffs.dtype)

# Apply chebmulx
result = C.chebmulx(coeffs)

print("\nOutput array:", result)
print("Output dimensions:", result.ndim)
print("Output shape:", result.shape)
print("Output datatype:", result.dtype)
Input array: [1 2 3]
Input dimensions: 1
Input shape: (3,)
Input datatype: int64

Output array: [1.  2.5 1.  1.5]
Output dimensions: 1
Output shape: (4,)
Output datatype: float64

Key Points

  • The output array has one more element than the input (degree increases by 1)
  • Input integers are converted to floats in the output
  • The method implements the mathematical operation x * P(x) for Chebyshev polynomials
  • Coefficients are ordered from lowest to highest degree

Conclusion

The chebmulx() method efficiently multiplies Chebyshev series by the independent variable x. This operation increases the polynomial degree by 1 and redistributes coefficients according to Chebyshev polynomial algebra rules.

Updated on: 2026-03-26T19:42:42+05:30

235 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements