Integrate a Chebyshev series in Python

To integrate a Chebyshev series in Python, use the chebyshev.chebint() method from NumPy. This function returns the Chebyshev series coefficients integrated m times from a lower bound along a specified axis.

Syntax

numpy.polynomial.chebyshev.chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0)

Parameters

The function accepts the following parameters:

  • c: Array of Chebyshev series coefficients. For multidimensional arrays, different axes correspond to different variables.
  • m: Order of integration, must be positive (Default: 1)
  • k: Integration constant(s). If empty list (default), all constants are set to zero
  • lbnd: Lower bound of the integral (Default: 0)
  • scl: Scaling factor applied after each integration (Default: 1)
  • axis: Axis over which the integral is taken (Default: 0)

Basic Integration Example

Let's start with a simple Chebyshev series integration ?

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

# Create an array of Chebyshev series coefficients
c = np.array([1, 2, 3])

# Display the coefficient array
print("Original coefficient array:", c)
print("Dimensions:", c.ndim)
print("Shape:", c.shape)

# Integrate the Chebyshev series
result = C.chebint(c)
print("\nIntegrated coefficients:", result)
Original coefficient array: [1 2 3]
Dimensions: 1
Shape: (3,)

Integrated coefficients: [ 0.5 -0.5  0.5  0.5]

Integration with Custom Parameters

Here's how to use different integration orders and constants ?

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

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

# Single integration with integration constant
result1 = C.chebint(coeffs, m=1, k=2)
print("Integration with constant k=2:", result1)

# Double integration
result2 = C.chebint(coeffs, m=2)
print("Double integration:", result2)

# Integration with scaling
result3 = C.chebint(coeffs, scl=2)
print("Integration with scaling factor 2:", result3)
Integration with constant k=2: [ 2.5 -0.5  0.5  0.5]
Double integration: [ 0.125 -0.125 -0.125  0.125  0.125]
Integration with scaling factor 2: [ 1.  -1.   1.   1. ]

How It Works

The Chebyshev integration process follows these steps:

  1. For each integration, the degree of the polynomial increases by 1
  2. The result is multiplied by the scaling factor scl
  3. An integration constant k is added
  4. The process repeats m times
Original: [1, 2, 3] ? Integration Result: [0.5, -0.5, 0.5, 0.5] ? Degree increased from 2 to 3 ? Integration constant = 0 (default) ? Scaling factor = 1 (default)

Conclusion

The chebint() function provides flexible Chebyshev series integration with options for multiple integration orders, custom constants, and scaling factors. The integrated series has one degree higher than the original series.

Updated on: 2026-03-26T20:55:41+05:30

361 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements