Skip to content

Commit

Permalink
Add multivariate dual numbers with arbitrary depth
Browse files Browse the repository at this point in the history
  • Loading branch information
benruijl committed Sep 23, 2024
1 parent 74b1d29 commit d4a948a
Show file tree
Hide file tree
Showing 4 changed files with 832 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/dual.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use symbolica::{
create_hyperdual_from_components,
domains::{float::NumericalFloatLike, rational::Rational},
};

create_hyperdual_from_components!(
Dual,
[
[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
[1, 1, 0],
[1, 0, 1],
[0, 1, 1],
[1, 1, 1],
[2, 0, 0]
]
);

fn main() {
let x = Dual::<Rational>::new_variable(0, (1, 1).into());
let y = Dual::new_variable(1, (2, 1).into());
let z = Dual::new_variable(2, (3, 1).into());

let t3 = x * y * z;

println!("{}", t3.inv());
}
1 change: 1 addition & 0 deletions src/domains.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod algebraic_number;
pub mod atom;
pub mod dual;
pub mod factorized_rational_polynomial;
pub mod finite_field;
pub mod float;
Expand Down
Loading

0 comments on commit d4a948a

Please sign in to comment.