RosettaCodeData/Task/Euler-method/Arturo/euler-method.arturo
2023-07-01 13:44:08 -04:00

14 lines
307 B
Text

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