// Copyright: Jonas Pleyer // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. use ode_integrate::concepts::errors::CalcError; use ode_integrate::solvers::fixed_step::{Euler}; use ode_integrate::concepts::steppers::Stepper; type C1 = num::complex::Complex; fn rhs_complex_f32(x: &C1, dx: &mut C1, _t: &f32, p: &f32) -> Result<(), CalcError> { *dx = - p * *x; Ok(()) } fn solve_complex_ode_f32() { let mut x = num::complex::Complex::new(10.0f32, 20.0f32); let p: f32 = 2.0; let dt: f32 = 0.1; let mut t: f32 = 0.0; let tmax: f32 = 2.0; let mut eu = Euler::from((&x, &t, &dt, &p)); while t