Expand description
Nonlinear solvers for Numra.
This crate provides iterative methods for solving systems of nonlinear equations:
- Newton-Raphson with line search for globalization
- Support for both analytical and numerical (finite difference) Jacobians
§Example
use numra_nonlinear::{Newton, NewtonOptions, NonlinearSystem};
// Solve x^2 = 2 (find sqrt(2))
struct SquareRoot;
impl NonlinearSystem<f64> for SquareRoot {
fn dim(&self) -> usize { 1 }
fn eval(&self, x: &[f64], f: &mut [f64]) {
f[0] = x[0] * x[0] - 2.0;
}
}
let solver = Newton::default_solver();
let result = solver.solve(&SquareRoot, &[1.5]).unwrap();
assert!((result.x[0] - std::f64::consts::SQRT_2).abs() < 1e-10);Author: Moussa Leblouba Date: 8 February 2026 Modified: 2 May 2026
Re-exports§
pub use line_search::wolfe_line_search;pub use line_search::LineSearchError;pub use line_search::LineSearchResult;pub use line_search::WolfeOptions;pub use newton::newton_solve;pub use newton::Newton;pub use newton::NewtonOptions;pub use newton::NewtonResult;pub use newton::NonlinearSystem;
Modules§
- line_
search - Wolfe line search for globalized optimization.
- newton
- Newton-Raphson solver with optional line search.
Enums§
- Linalg
Error - Linear algebra specific errors.