Hacker News new | past | comments | ask | show | jobs | submit login

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

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)



Euler's method is non-conservative, you ought to be using a hire order method e.g. leap frog or Backward Time, Centered Space Method.


or for ODEs a higher order method.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: