Browse Source

Fix another typo in the Runge-Kutta solvers (the time-step was added rather than multiplied with the slope) (#531)

v3
Ksero 9 years ago
committed by Christoph Ruegg
parent
commit
350e37219c
  1. 2
      src/Numerics/OdeSolvers/RungeKutta.cs

2
src/Numerics/OdeSolvers/RungeKutta.cs

@ -116,7 +116,7 @@ namespace MathNet.Numerics.OdeSolvers
for (int i = 1; i < N; i++) for (int i = 1; i < N; i++)
{ {
k1 = f(t, y0); k1 = f(t, y0);
k2 = f(t, y0 + k1 + dt); k2 = f(t, y0 + k1 * dt);
y[i] = y0 + dt * 0.5 * (k1 + k2); y[i] = y0 + dt * 0.5 * (k1 + k2);
t += dt; t += dt;
y0 = y[i]; y0 = y[i];

Loading…
Cancel
Save