Euler method: Difference between revisions

Content added Content deleted
(Adding SequenceL)
No edit summary
Line 2,293: Line 2,293:
90 20.1469043822 20.0015746400
90 20.1469043822 20.0015746400
100 20.0729505571 20.0004723920</pre>
100 20.0729505571 20.0004723920</pre>


=={{header|Ring}}==
<lang ring>

decimals(3)
see euler("noutput = -0.07*(y-20)", 100, 0, 100, 2) + nl
see euler("noutput = -0.07*(y-20)", 100, 0, 100, 5) + nl
see euler("noutput = -0.07*(y-20)", 100, 0, 100, 10) + nl

func euler df, y, a, b, s
t = a
while t <= b
see "" + t + " " + y + nl
eval(df)
y += s * noutput
t += s
end
return y</lang>
Output:
<pre>
0 100
2 88.800
4 79.168
6 70.884
8 63.761
10 57.634
</pre>


=={{header|Ruby}}==
=={{header|Ruby}}==