Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
25
Task/Euler-method/Pluto/euler-method.pluto
Normal file
25
Task/Euler-method/Pluto/euler-method.pluto
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
local fmt = require "fmt"
|
||||
|
||||
local function euler(f, y, step, finish)
|
||||
fmt.write(" Step %2d: ", step)
|
||||
for t = 0, finish, step do
|
||||
if t % 10 == 0 then fmt.write(" %7.3f", y) end
|
||||
y += step * f(y)
|
||||
end
|
||||
print()
|
||||
end
|
||||
|
||||
local function analytic()
|
||||
io.write(" Time: ")
|
||||
for t = 0, 100, 10 do fmt.write(" %7d", t) end
|
||||
io.write("\nAnalytic: ")
|
||||
for t = 0, 100, 10 do
|
||||
fmt.write(" %7.3f", 20 + 80 * math.exp(-0.07 * t))
|
||||
end
|
||||
print()
|
||||
end
|
||||
|
||||
local cooling = |temp| -> -0.07 * (temp - 20)
|
||||
|
||||
analytic()
|
||||
for {2, 5, 10} as i do euler(cooling, 100, i, 100) end
|
||||
Loading…
Add table
Add a link
Reference in a new issue