ChebPy¶
A Python implementation of Chebfun — numerical computing with Chebyshev series approximations.
ChebPy is a Python implementation of Chebfun, bringing the power of Chebyshev polynomial approximations to Python. It allows you to work with functions as first-class objects, performing operations like differentiation, integration, and root-finding with machine precision accuracy.
Features¶
- Function Approximation — Automatic Chebyshev polynomial approximation of smooth functions
- Periodic Functions — Fourier-based approximation via
trigfunfor smooth periodic functions - Infinite Intervals — Functions on \([a, \infty)\), \((-\infty, b]\) or the full real line via
CompactFun - Calculus Operations — Differentiation, integration, and root-finding with machine precision
- Plotting — Beautiful function visualisations with matplotlib integration
- Arithmetic — Add, subtract, multiply, and compose functions naturally
- Adaptive — Automatically determines optimal polynomial degree for given tolerance
- Convolution — Convolve two Chebfun objects to produce a new function
- Quasimatrices — Continuous linear algebra via QR, SVD, and least-squares
- Gaussian Process Regression — GP posteriors returned as Chebfun objects
- Interoperability — Works seamlessly with NumPy and SciPy ecosystems
Quick Example¶
import numpy as np
from chebpy import chebfun
# Create a function
f = chebfun(lambda x: np.sin(x**2) + np.sin(x)**2, [0, 10])
# Differentiate, integrate, find roots
df = f.diff()
integral = f.sum()
roots = f.roots()
Quickstart¶
Head to the Quickstart guide for a hands-on introduction, or explore the API Reference for full documentation.
Acknowledgments¶
ChebPy is a direct port of the Chebfun project led by Nick Trefethen and the Chebfun development team at the University of Oxford. The mathematical design, algorithms, and naming conventions used here are adaptations of their decades of open scholarship, most notably:
- The original MATLAB Chebfun system (github.com/chebfun/chebfun).
- L. N. Trefethen, Approximation Theory and Approximation Practice, SIAM, 2013 (extended edition 2019).
- T. A. Driscoll, N. Hale, and L. N. Trefethen (eds.), Chebfun Guide, Pafnuty Publications, 2014.
We are grateful for their generosity in making this body of work freely available; any errors in translation or adaptation are ours alone.