Euler method: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Wren-trait -> Wren-iterate)
(added Arturo)
Line 245: Line 245:
done
done
</pre>
</pre>

=={{header|Arturo}}==

<syntaxhighlight lang="arturo">euler: function [f, y0, a, b, h][
[t,y]: @[a, y0]

while [t < b][
print [to :string .format:".3f" t, to :string .format:".3f" y]
t: t + h
y: y + h * call f @[t,y]
]
]

newtoncooling: function [ti, te]->
(neg 0.07) * te - 20

euler 'newtoncooling 100.0 0.0 100.0 10.0</syntaxhighlight>

{{out}}

<pre>0.000 100.000
10.000 44.000
20.000 27.200
30.000 22.160
40.000 20.648
50.000 20.194
60.000 20.058
70.000 20.017
80.000 20.005
90.000 20.002</pre>


=={{header|BASIC}}==
=={{header|BASIC}}==