Created
November 21, 2022 10:54
-
-
Save jdh30/ec0e2471158990571e74b83917df74b1 to your computer and use it in GitHub Desktop.
Lorenz attractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let trajectory p dt n = | |
let s, t, u = 10, 8/3, 28 in | |
Array.unfold [(x, y, z), i -> | |
if i=n then None else | |
let p = x+s*(y-x)*dt, y+(x*(u-z)-y)*dt, z+(x*y-t*z)*dt in | |
Some(p, (p, i+1))] (p, 0) | |
let () = | |
trajectory (10, 0, 20) (1/200) 2000 | |
@ Array.map [x, y, z -> x, y] | |
@ Chart.scatter "" "" "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment