Euler method: Difference between revisions
m
→{{header|Mathematica}} / {{header|Wolfram Language}}: formatting
(Added Wren) |
m (→{{header|Mathematica}} / {{header|Wolfram Language}}: formatting) |
||
Line 1,733:
Better methods for differential equation solving are built into Mathematica, so the typical user would omit the Method and StartingStepSize options in the code below. However since the task requests Eulers method, here is the bad solution...
<lang Mathematica>
euler[step_, val_] := NDSolve[
{T'[t] == -0.07 (T[t] - 20), T[0] == 100},
T, {t, 0, 100},
Method -> "ExplicitEuler",
StartingStepSize -> step
][[1, 1, 2]][val]
</lang>
{{out}}
|