cheby
ActiveChebyshev polynomial toolkit for scientific computing: node generation, coefficient fitting, Clenshaw evaluation, and piecewise segment tables.
0 stars
0 forks
Rust
AGPL-3.0
Updated 1 weeks ago
Why it exists
cheby provides a complete Chebyshev interpolation pipeline suitable for numerical kernels and ephemeris-style piecewise approximations. Its segment-table API offers O(1) lookup for high-accuracy function approximation over arbitrary intervals.
Key Features
- Node generation on [-1, 1] and mapped intervals
- DCT-based coefficient fitting
- Stable Clenshaw evaluation (value + derivative)
- Uniform piecewise segment tables with O(1) lookup
- Generic over ChebyScalar (works with qtty quantities)
Getting Started
# Add to your Cargo.toml
[dependencies]
cheby = "0.1"
# Interpolate sin(x) with Chebyshev polynomials
use cheby::{evaluate, fit_coeffs, nodes};
const N: usize = 9;
let xi: [f64; N] = nodes();
let values: [f64; N] = std::array::from_fn(|k| xi[k].sin());
let coeffs = fit_coeffs(&values);
let tau = 0.42;
let approx = evaluate(&coeffs, tau);
println!("sin({tau}) ~= {approx}"); Contributing
We welcome contributions! Here's how you can help:
- 1 Fork the repository and create your branch from
main - 2 Make your changes and add tests if applicable
- 3 Ensure all tests pass with
cargo test - 4 Submit a pull request with a clear description
License
This project is licensed under the AGPL-3.0 license. See the LICENSE file for details.
Quick Links
Tags
math interpolation chebyshev numerics rust