๐ฌ Numerical computing with Chebyshev series approximations
Symbolic-numeric computation with functions
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
- ๐ฅ Installation
- ๐ ๏ธ Development
- ๐ Quick Start
- ๐ Documentation
- ๐ License
- ๐ฅ Contributing
Work with functions as easily as numbers
- ๐ข Function Approximation: Automatic Chebyshev polynomial approximation of smooth functions
- ๐ Calculus Operations: Differentiation, integration, and root-finding with machine precision
- ๐ Plotting: Beautiful function visualizations with matplotlib integration
- ๐งฎ Arithmetic: Add, subtract, multiply, and compose functions naturally
- ๐ฏ Adaptive: Automatically determines optimal polynomial degree for given tolerance
- ๐ Interoperability: Works seamlessly with NumPy and SciPy ecosystems
pip install chebpygit clone https://github.com/chebpy/chebpy.git
cd chebpy
pip install -e .Note: Use
-eflag for editable installation during development
For contributors and advanced users
ChebPy uses modern Python development tools for a smooth developer experience:
# ๐ฆ Install development dependencies
make install
# ๐งช Run tests with coverage
make test
# โจ Format and lint code
make fmt
make lint
# ๐ Start interactive notebooks
make marimo
# ๐ View test coverage report
make coverage- Testing: pytest with coverage reporting
- Formatting: ruff for code formatting and linting
- Notebooks: marimo for interactive development
- Task Management: Taskfile for build automation
This figure was generated with the following simple ChebPy code:
import numpy as np
from chebpy import chebfun
# Create functions as chebfuns on interval [0, 10]
f = chebfun(lambda x: np.sin(x**2) + np.sin(x)**2, [0, 10])
g = chebfun(lambda x: np.exp(-(x-5)**2/10), [0, 10])
# Find intersection points
roots = (f - g).roots()
# Plot both functions and mark intersections
ax = f.plot(label='f(x) = sin(xยฒ) + sinยฒ(x)')
g.plot(ax=ax, label='g(x) = exp(-(x-5)ยฒ/10)')
ax.plot(roots, f(roots), 'ro', markersize=8, label='Intersections')
ax.legend()
ax.grid(True, alpha=0.3)
# Differentiation and integration
f = chebfun(lambda x: np.exp(x) * np.sin(x), [-1, 1])
df_dx = f.diff() # Derivative
integral = f.sum() # Definite integral
# Root finding
g = chebfun(lambda x: x**3 - 2*x - 5, [-3, 3])
roots = g.roots() # All roots in the domain
# Function composition
# h = f + g # Addition
# product = f * g # Multiplication
- ๐ Interactive Notebooks: Explore ChebPy features with hands-on examples
- ๐ฏ API Reference: Complete function and class documentation
- ๐งช Test Suite: Comprehensive examples of usage patterns
- ๐ Codespaces: Try ChebPy in your browser
ChebPy is licensed under the 3-Clause BSD License.
๐ See the full license in the LICENSE.rst file.
We welcome contributions! ๐
Whether you're fixing bugs, adding features, or improving documentation, your help makes ChebPy better for everyone.
- ๐ด Fork the repository
- ๐ฟ Create your feature branch
git checkout -b feature/amazing-feature
- โจ Make your changes and add tests
- ๐งช Test your changes
make test - ๐ Commit your changes
git commit -m 'Add amazing feature' - ๐ Push to your branch
git push origin feature/amazing-feature
- ๐ฏ Open a Pull Request
- ๐ Contributing Guide
- ๐ค Code of Conduct
- ๐ Issue Tracker
- Jebel-Quant/rhiza for standardised CI/CD templates and project tooling
Made with โค๏ธ by the ChebPy community
โญ If you find ChebPy useful, please consider giving it a star! โญ
