Expand description
Dual Numbers
Fully-featured Dual Number implementation with features for automatic differentiation of multivariate vectorial functions into gradients.
§Usage
extern crate dual_num;
use dual_num::{Dual, Float, differentiate};
fn main() {
// find partial derivative at x=4.0
println!("{:.5}", differentiate(4.0f64, |x| {
x.sqrt() + Dual::from_real(1.0)
})); // 0.25000
}
§Previous Work
Modules§
Structs§
- Dual
- Dual Number structure
Traits§
- Float
- Generic trait for floating point numbers
- Float
Const - Num
- The base trait for numeric types, covering
0
and1
values, comparisons, basic numeric operations, and string conversion. - One
- Defines a multiplicative identity element for
Self
. - Scalar
- The basic scalar type for all structures of
nalgebra
. - Zero
- Defines an additive identity element for
Self
.
Functions§
- differentiate
- Evaluates the function using dual numbers to get the partial derivative at the input point
- partials
- Computes the state and partials of the provided function.
- partials_
t - Computes the state and the partials matrix of the provided function with a preliminary time parameter.