numra_ide/lib.rs
1//! IDE (Integro-Differential Equation) solvers for Numra.
2//!
3//! This crate provides methods for solving Volterra integro-differential equations:
4//!
5//! ```text
6//! y'(t) = f(t, y) + ∫₀ᵗ K(t, s, y(s)) ds
7//! ```
8//!
9//! where K is the memory kernel representing history-dependent effects.
10//!
11//! # Memory Kernels
12//!
13//! The crate supports various kernel types:
14//! - **Exponential kernels**: K(t,s) = a * exp(-b*(t-s)), efficient via Prony series
15//! - **Power-law kernels**: K(t,s) = (t-s)^(-α), fractional memory
16//! - **Custom kernels**: User-defined kernel functions
17//!
18//! # Solvers
19//!
20//! - [`VolterraSolver`] - General Volterra IDE solver using quadrature
21//! - [`PronySolver`] - Efficient solver for sum-of-exponentials kernels
22//!
23//! # Example
24//!
25//! ```
26//! use numra_ide::{IdeSystem, VolterraSolver, IdeSolver, IdeOptions, Kernel};
27//! use numra_ide::kernels::ExponentialKernel;
28//!
29//! // Viscoelastic material: y' = -k*y + ∫ K(t-s)*y(s) ds
30//! struct Viscoelastic {
31//! k: f64,
32//! kernel: ExponentialKernel<f64>,
33//! }
34//!
35//! impl IdeSystem<f64> for Viscoelastic {
36//! fn dim(&self) -> usize { 1 }
37//!
38//! fn rhs(&self, _t: f64, y: &[f64], f: &mut [f64]) {
39//! f[0] = -self.k * y[0];
40//! }
41//!
42//! fn kernel(&self, t: f64, s: f64, y: &[f64], k: &mut [f64]) {
43//! k[0] = self.kernel.evaluate(t - s) * y[0];
44//! }
45//! }
46//! ```
47//!
48//! Author: Moussa Leblouba
49//! Date: 2 February 2026
50//! Modified: 2 May 2026
51
52pub use numra_core::Scalar;
53
54pub mod kernels;
55pub mod prony;
56mod system;
57mod volterra;
58
59pub use kernels::{ExponentialKernel, Kernel, PowerLawKernel, PronyKernel};
60pub use prony::{PronySolver, PronySystem};
61pub use system::{IdeOptions, IdeResult, IdeSolver, IdeStats, IdeSystem};
62pub use volterra::{VolterraRK4Solver, VolterraSolver};