Anonymous user
Runge-Kutta method: Difference between revisions
Stronger static typing in the D entry
(+ D entry) |
(Stronger static typing in the D entry) |
||
Line 88:
=={{header|D}}==
{{trans|Ada}}
<lang d>import std.stdio, std.math, std.typecons;
alias real FP;
alias Typedef!(FP[101]) FPs;
void runge(in FP function(in FP, in FP) pure nothrow yp_func,
foreach (n; 0 .. t.length - 1) {
FP dy1 = dt * yp_func(t[n], y[n]);
Line 111 ⟶ 112:
void main() {
enum FP dt = 0.10;
t_arr[0] = 0.0;
|