Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Euler-method/Icon/euler-method.icon
Normal file
22
Task/Euler-method/Icon/euler-method.icon
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
invocable "newton_cooling" # needed to use the 'proc' procedure
|
||||
|
||||
procedure euler (f, y0, a, b, h)
|
||||
t := a
|
||||
y := y0
|
||||
until (t >= b) do {
|
||||
write (right(t, 4) || " " || left(y, 7))
|
||||
t +:= h
|
||||
y +:= h * (proc(f) (t, y)) # 'proc' applies procedure named in f to (t, y)
|
||||
}
|
||||
write ("DONE")
|
||||
end
|
||||
|
||||
procedure newton_cooling (time, T)
|
||||
return -0.07 * (T - 20)
|
||||
end
|
||||
|
||||
procedure main ()
|
||||
# generate data for all three step sizes [2, 5, 10]
|
||||
every (step_size := ![2,5,10]) do
|
||||
euler ("newton_cooling", 100, 0, 100, step_size)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue