Expand description
Numerical utilities for copula computations.
This module provides various numerical methods useful for copula analysis:
- Numerical integration (trapezoidal rule, Simpson’s rule)
- Root finding (bisection, Brent’s method)
- Numerical differentiation
- Interpolation methods
§Example
use copula_core::numerical::{bisection, trapezoid_integrate};
// Find root of f(x) = x^2 - 2 on [0, 2]
let root = bisection(|x| x * x - 2.0, 0.0, 2.0, 1e-10, 100).unwrap();
assert!((root - 2.0_f64.sqrt()).abs() < 1e-9);
// Integrate f(x) = x^2 from 0 to 1
let integral = trapezoid_integrate(|x| x * x, 0.0, 1.0, 1000);
assert!((integral - 1.0/3.0).abs() < 1e-6);Functions§
- bisection
- Find a root of f(x) = 0 using the bisection method.
- central_
diff - Numerical derivative using central difference (more accurate).
- forward_
diff - Numerical derivative using forward difference.
- linear_
interp - Linear interpolation between two points.
- log_
sum_ exp - Compute the log-sum-exp trick for numerical stability.
- second_
diff - Second derivative using central difference.
- simpson_
integrate - Numerical integration using Simpson’s rule.
- trapezoid_
integrate - Numerical integration using the trapezoidal rule.