Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Euler-method/Nim/euler-method.nim
Normal file
13
Task/Euler-method/Nim/euler-method.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import strutils
|
||||
|
||||
proc euler(f: proc (x,y: float): float; y0, a, b, h: float) =
|
||||
var (t,y) = (a,y0)
|
||||
while t < b:
|
||||
echo formatFloat(t, ffDecimal, 3), " ", formatFloat(y, ffDecimal, 3)
|
||||
t += h
|
||||
y += h * f(t,y)
|
||||
|
||||
proc newtoncooling(time, temp: float): float =
|
||||
-0.07 * (temp - 20)
|
||||
|
||||
euler(newtoncooling, 100.0, 0.0, 100.0, 10.0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue