Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.4.0] - 2026-06-07

### Added

- `fit_dyn_from_fn` and `fit_coeffs_dyn` for dynamic Chebyshev fitting on normalized `[-1, 1]`.
- `ChebySeriesDyn<f64>::roots`, `roots_with`, and `tail_norm` for root finding on the unit interval via Durand–Kerner iteration with Chebyshev-node fallback for tangency roots.
- `ChebySeriesDyn<f64>::shifted_constant` and `shift_constant_in_place` for level-set root searches without refitting.
- `ChebySeriesDynOn<f64, X>::roots` and `roots_with` for domain-mapped roots.
- `RootOptions` with `validated` and `effective` tolerance sanitization.
- Comprehensive root-finding tests and benchmarks.

### Changed

- Shared fixed-size and dynamic coefficient fitting through a single `accumulate_coeffs` helper.
- Root finding converts Chebyshev coefficients to power basis, applies Durand–Kerner, verifies residuals against `RootOptions::zero_tol`, and falls back to node scanning when needed.
- Constant and identically-zero series return an empty root list.
- `fit_dyn_from_fn(0, …)` now produces a single-coefficient constant fit.

## [0.3.0] - 2026-05-18

Expand All @@ -28,21 +44,6 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht
`quadrature`, `spectral`, `serde`, `binary`, `fast-dct`, and `full`.
- The README, examples, benchmarks, and CI configuration were rewritten to
match the new crate architecture and release posture.

### Added

- `#![forbid(unsafe_code)]` at the crate root.
- Core abstractions:
`Domain<X>`, `ChebyError`, `ChebySeries<T, N>`, `ChebySeriesDyn<T>`,
`ChebySeriesOn<T, X, N>`, `ChebyScalar`, `ChebyTime`,
`DifferentiateWith<X>`, and `IntegrateWith<X>`.
- Chebyshev basis functions in `core::basis`:
`t(n, x)` and `u(n, x)`.
- First-class node families in `core::nodes`:
`Roots`, `Extrema`, `Lobatto`, `Gauss`, and `GaussLobatto`.
- Stable Clenshaw evaluation in `core::eval`:
`evaluate`, `evaluate_both`, and the compatibility `evaluate_derivative`.
- Approximation APIs in `approx`:
coefficient fitting, function fitting on normalized and typed domains,
barycentric interpolation, adaptive fitting with `FitReport`, coefficient-tail
error estimates, and a Remez-style minimax interface.
Expand Down
86 changes: 43 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cheby"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["VPRamon <vallespuigramon@gmail.com>"]
description = "Unit-safe Chebyshev approximation and spectral numerics for Rust."
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,40 @@ and segments apply the chain rule and use `qtty` multiplication/division so:
- velocity over time integrates to position,
- angular rate over time integrates to angle.

## Root finding

With the `alloc` feature, dynamic series support real root finding on the
normalized interval `[-1, 1]`:

```rust
use cheby::{fit_dyn_from_fn, RootOptions};

let series = fit_dyn_from_fn(12, |tau| tau * tau - 0.25).unwrap();
let roots = series.roots(); // normalized tau in [-1, 1]

let opts = RootOptions {
zero_tol: 1e-10,
..RootOptions::default()
};
let refined = series.roots_with(opts);
```

The solver converts the Chebyshev expansion to a monic power polynomial and finds
roots with a **Durand–Kerner** iteration, then verifies residuals on `[-1, 1]`.
When the primary pass misses roots (tangency, repeated roots), a fallback
Chebyshev-node scan uses Brent refinement and minimum search. Constant or
identically-zero series return an empty root list.

[`RootOptions`] controls bracket width (`unit_tol`), residual tolerance
(`zero_tol`), and deduplication (`dedupe_eps`). Root finding is intended for
moderate polynomial degrees and can be less stable than Clenshaw evaluation at
high degree.

Map normalized roots to a physical domain with [`ChebySeriesDynOn::roots`],
or shift the constant term without refitting via
[`ChebySeriesDyn::shifted_constant`] when searching multiple level sets of the
same fitted signal.

## Quadrature

`quadrature` contains Chebyshev-related rules only: Clenshaw-Curtis style
Expand Down
Loading
Loading