Skip to main content

wave_equation_1d

Function wave_equation_1d 

Source
pub fn wave_equation_1d(
    u0: &[f64],
    v0: &[f64],
    length: f64,
    speed: f64,
    dt: f64,
    steps: usize,
) -> Result<Vec<f64>, ErrorsJSL>
Expand description

Advances u_tt = c² u_xx with fixed ends u = 0 from displacement u0 and velocity v0 on a uniform grid spanning [0, length], by leapfrog with a Taylor first step; returns the displacement after steps steps of size dt.