A Python implementation of Chebfun
Project description
ChebPy
A Python implementation of Chebfun
🔬 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.
Table of Contents
✨ Features
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
📥 Installation
Using pip (recommended)
pip install chebpy
From source (development)
git clone https://github.com/chebpy/chebpy.git
cd chebpy
pip install -e .
Note: Use
-eflag for editable installation during development
🛠️ 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
Development Tools
- Testing: pytest with coverage reporting
- Formatting: ruff for code formatting and linting
- Notebooks: marimo for interactive development
- Task Management: Taskfile for build automation
Quick Start
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)
More Examples
# 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
Documentation
- 📚 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
📄 License
ChebPy is licensed under the 3-Clause BSD License.
📜 See the full license in the LICENSE.rst file.
👥 Contributing
We welcome contributions! 🎉
Whether you're fixing bugs, adding features, or improving documentation, your help makes ChebPy better for everyone.
Quick Start for Contributors
- 🍴 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
Resources
Acknowledgments 🙏
- 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! ⭐
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chebfun-0.7.1.tar.gz.
File metadata
- Download URL: chebfun-0.7.1.tar.gz
- Upload date:
- Size: 649.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
278b95aadd01fb33034dacccf4d422bd0b48d0298eb96b85cb9ab61993968e0c
|
|
| MD5 |
ad8da8894f9f16d2e651db8b7fbdefb4
|
|
| BLAKE2b-256 |
1705248519c9d3b26eb6d19c237fadc58b33450eb31368f522a608e1a6bfed37
|
Provenance
The following attestation bundles were made for chebfun-0.7.1.tar.gz:
Publisher:
rhiza_release.yml on chebpy/chebpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chebfun-0.7.1.tar.gz -
Subject digest:
278b95aadd01fb33034dacccf4d422bd0b48d0298eb96b85cb9ab61993968e0c - Sigstore transparency entry: 1154687584
- Sigstore integration time:
-
Permalink:
chebpy/chebpy@be247d949983f05efb878295107677f2dbc04dfb -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/chebpy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
rhiza_release.yml@be247d949983f05efb878295107677f2dbc04dfb -
Trigger Event:
push
-
Statement type:
File details
Details for the file chebfun-0.7.1-py3-none-any.whl.
File metadata
- Download URL: chebfun-0.7.1-py3-none-any.whl
- Upload date:
- Size: 69.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa6cdd230ca7925fbb0ce995dac8953b03ddf9747c3e98ccfc102f0c8a28c913
|
|
| MD5 |
de0242891390f6c71df3d42b0fd1da72
|
|
| BLAKE2b-256 |
87c97328e216773020e45949c243acb5c8dc3c0ea78464c64a56bb080acae4a8
|
Provenance
The following attestation bundles were made for chebfun-0.7.1-py3-none-any.whl:
Publisher:
rhiza_release.yml on chebpy/chebpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chebfun-0.7.1-py3-none-any.whl -
Subject digest:
aa6cdd230ca7925fbb0ce995dac8953b03ddf9747c3e98ccfc102f0c8a28c913 - Sigstore transparency entry: 1154687585
- Sigstore integration time:
-
Permalink:
chebpy/chebpy@be247d949983f05efb878295107677f2dbc04dfb -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/chebpy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
rhiza_release.yml@be247d949983f05efb878295107677f2dbc04dfb -
Trigger Event:
push
-
Statement type: