Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
15
Task/Euler-method/Futhark/euler-method.futhark
Normal file
15
Task/Euler-method/Futhark/euler-method.futhark
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
fun analytic(t0: f64) (time: f64): f64 =
|
||||
20.0 + (t0 - 20.0) * exp64(-0.07*time)
|
||||
|
||||
fun cooling(_time: f64) (temperature: f64): f64 =
|
||||
-0.07 * (temperature-20.0)
|
||||
|
||||
fun main(t0: f64) (a: f64) (b: f64) (h: f64): []f64 =
|
||||
let steps = int((b-a)/h)
|
||||
let temps = replicate steps 0.0
|
||||
loop ((t,temps)=(t0,temps)) = for i < steps do
|
||||
let x = a + f64(i) * h
|
||||
let temps[i] = abs(t-analytic t0 x)
|
||||
in (t + h * cooling x t,
|
||||
temps)
|
||||
in temps
|
||||
Loading…
Add table
Add a link
Reference in a new issue