Euler method: Difference between revisions

Updated D entry
(Updated D entry)
Line 497:
in double a, in double b, in double h) {
double y = y0;
foreach (immutable t; iota(a, b, h)) {
writefln("%.3f %.3f", t, y);
y += h * f(t, y);
Line 506:
void main() {
/// Example: Newton's cooling law
static newtonCoolingLaw(in double time, in double t) {
pure nothrow @nogc {
return -0.07 * (t - 20);
}