Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
10
Task/Euler-method/OCaml/euler-method-1.ml
Normal file
10
Task/Euler-method/OCaml/euler-method-1.ml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
(* Euler integration by recurrence relation.
|
||||
* Given a function, and stepsize, provides a function of (t,y) which
|
||||
* returns the next step: (t',y'). *)
|
||||
let euler f ~step (t,y) = ( t+.step, y +. step *. f t y )
|
||||
|
||||
(* newton_cooling doesn't use time parameter, so _ is a placeholder *)
|
||||
let newton_cooling ~k ~tr _ y = -.k *. (y -. tr)
|
||||
|
||||
(* analytic solution for Newton cooling *)
|
||||
let analytic_solution ~k ~tr ~t0 t = tr +. (t0 -. tr) *. exp (-.k *. t)
|
||||
Loading…
Add table
Add a link
Reference in a new issue