cheby
ActiveChebyshev interpolation tools for scientific and numerical work.
2 stars
0 forks
Rust
AGPL-3.0
Updated 6 days ago
Why it exists
cheby makes it easier to build and evaluate Chebyshev approximations without a lot of surrounding boilerplate. It is handy for ephemerides and other piecewise numerical kernels.
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.4.0"
# 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