Skip to content

Commit

Permalink
Update basic example
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris00 committed Aug 17, 2023
1 parent 3d7ef8e commit 86bffde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ function (t,u) ↦ 1 using Adams' method.

```rust
use sundials::CVode;
let f = |t, u: &[f64; 1], du: &mut [f64; 1]| { *du = [1.] };
let ode = CVode::adams(f, 0., &[0.])?;
let mut u1 = [f64::NAN];
ode.solve(1., &mut u1);
let mut ode = CVode::adams(0., &[0.], |t, u, du| *du = [1.])?;
let (u1, _) = ode.solution(1.);
assert_eq!(u1[0], 1.);
```

Then `u[0]` contains the solution u at time t=1 and `u[1]` the
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
//! use sundials::CVode;
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut ode = CVode::adams(0., &[0.], |t, u, du| *du = [1.])?;
//! let mut u1 = [f64::NAN];
//! ode.solve(1., &mut u1);
//! let (u1, _) = ode.solution(1.);
//! assert_eq!(u1[0], 1.);
//! # Ok(()) }
//! ```
Expand Down

0 comments on commit 86bffde

Please sign in to comment.