Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
13
Task/Euler-method/Elixir/euler-method.elixir
Normal file
13
Task/Euler-method/Elixir/euler-method.elixir
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
defmodule Euler do
|
||||
def method(_, _, t, b, _) when t>b, do: :ok
|
||||
def method(f, y, t, b, h) do
|
||||
:io.format "~7.3f ~7.3f~n", [t,y]
|
||||
method(f, y + h * f.(t,y), t + h, b, h)
|
||||
end
|
||||
end
|
||||
|
||||
f = fn _time, temp -> -0.07 * (temp - 20) end
|
||||
Enum.each([10, 5, 2], fn step ->
|
||||
IO.puts "\nStep = #{step}"
|
||||
Euler.method(f, 100.0, 0.0, 100.0, step)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue