3 ms·
It's possible to solve differential equations in 140 characters of javascript, here are some (e.g. Lorenz Attractor dynamical system "chaos butterfly") that gen
by rsiqueira 6y ago
It's possible to solve differential equations in 140 characters of javascript, here are some (e.g. Lorenz Attractor dynamical system "chaos butterfly") that generates 3D cool graphics and really solves ordinary differential equations (ODEs): https://www.dwitter.net/h/lorenz/top https://www.dwitter.net/h/lorenz/top
Here is one short code example using Euler's method where Y(n+1) = Yn + step_size * f(Xn,Yn,Zn)
c.width|=X=Y=Z=6;for(i=3e3;i--;)
X+=.1*(Y-X),
Y+=.01*(X*(29-Z)-Y),
Z+=.01*(X*Y-1.6*Z),
x.fillRect(960+X*30,Z*22,6,9)
- peterwoerner 6y agoEuler's method is non-conservative, you ought to be using a hire order method e.g. leap frog or Backward Time, Centered Space Method.
- peterwoerner 6y agoor for ODEs a higher order method.