Euler method: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 1,672: | Line 1,672: | ||
Step 10: 100.000 44.000 27.200 22.160 20.648 20.194 20.058 20.017 20.005 20.002 20.000 |
Step 10: 100.000 44.000 27.200 22.160 20.648 20.194 20.058 20.017 20.005 20.002 20.000 |
||
</pre> |
</pre> |
||
=={{header|Lambdatalk}}== |
|||
Translation of Python |
|||
<lang scheme> |
|||
{def eulersMethod |
|||
{def eulersMethod.r |
|||
{lambda {:f :b :h :t :y} |
|||
{if {<= :t :b} |
|||
then {tr {td :t} {td {/ {round {* :y 1000}} 1000}}} |
|||
{eulersMethod.r :f :b :h {+ :t :h} {+ :y {* :h {:f :t :y}}}} |
|||
else}}} |
|||
{lambda {:f :y0 :a :b :h} |
|||
{table {eulersMethod.r :f :b :h :a :y0}}}} |
|||
{def cooling |
|||
{lambda {:time :temp} |
|||
{* -0.07 {- :temp 20}}}} |
|||
{eulersMethod cooling 100 0 100 10} |
|||
-> |
|||
0 100 |
|||
10 44 |
|||
20 27.2 |
|||
30 22.16 |
|||
40 20.648 |
|||
50 20.194 |
|||
60 20.058 |
|||
70 20.017 |
|||
80 20.005 |
|||
90 20.002 |
|||
100 20 |
|||
</lang> |
|||
=={{header|Lua}}== |
=={{header|Lua}}== |