Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Euler-method/F-Sharp/euler-method.fs
Normal file
17
Task/Euler-method/F-Sharp/euler-method.fs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
let euler f (h : float) t0 y0 =
|
||||
(t0, y0)
|
||||
|> Seq.unfold (fun (t, y) -> Some((t,y), ((t + h), (y + h * (f t y)))))
|
||||
|
||||
let newtonCoolíng _ y = -0.07 * (y - 20.0)
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
let f = newtonCoolíng
|
||||
let a = 0.0
|
||||
let y0 = 100.0
|
||||
let b = 100.0
|
||||
let h = 10.0
|
||||
(euler newtonCoolíng h a y0)
|
||||
|> Seq.takeWhile (fun (t,_) -> t <= b)
|
||||
|> Seq.iter (printfn "%A")
|
||||
0
|
||||
Loading…
Add table
Add a link
Reference in a new issue