Crate dual_num [−] [src]
Dual Numbers
This is a dual number implementation scavenged from other dual number libraries and articles around the web, including:
- https://github.com/FreeFull/dual_numbers
- https://github.com/ibab/rust-ad
- https://github.com/tesch1/cxxduals
The difference being is that I have checked each method against Wolfram Alpha for correctness and will
keep this implementation up to date and working with the latest stable Rust and num-traits
crate.
Usage
extern crate dual_num; use dual_num::{DualNumber, Float, differentiate}; fn main() { // find partial derivative at x=4.0 println!("{:.5}", differentiate(4.0f64, |x| { x.sqrt() + DualNumber::from_real(1.0) })); // 0.25000 }
Structs
DualNumber |
Dual Number structure |
Traits
Float |
Generic trait for floating point numbers |
FloatConst | |
Num |
The base trait for numeric types, covering |
One |
Defines a multiplicative identity element for |
Zero |
Defines an additive identity element for |
Functions
differentiate |
Evaluates the function using dual numbers to get the partial derivative at the input point |
Type Definitions
DualNumberF32 |
Convenience type |
DualNumberF64 |
Convenience type |