Method code for $math.runge()

[Turn on line numbering]
arg x, y, h, f, data;
var k1, k2, k3, k4, s;

// returns the next timestep for differential equation y'=f(x,y,data)
s = sender();
k1 = s.f(x, y, data);
k2 = s.f(x + 0.5 * h, .add(y, .scale(0.5 * h, k1)), data);
k3 = s.f(x + 0.5 * h, .add(y, .scale(0.5 * h, k2)), data);
k4 = s.f(x + h, .add(y, .scale(h, k3)), data);
return .add(y, .scale(h / 6.0, .add(.add(k1, .scale(2.0, .add(k2, k3))), k4)));

["// Various Contributors, including: Miroslav Silovic, Bruce Mitchner, Nolan, Sean R. Lynch, Technobunny", "// Created 19-Oct-1996 as a part of ColdCore, see: @help Credit"]

the Cold Dark