Created
March 3, 2014 09:09
-
-
Save tatyusa/9321192 to your computer and use it in GitHub Desktop.
Simulation of van der pol equation
This file contains hidden or 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
{- | |
van der Pol Equation | |
http://mathworld.wolfram.com/vanderPolEquation.html | |
dx/dt = y | |
dy/dt = m(1-x^2)y - x | |
-} | |
type R2 = (Double, Double) --(x, y) | |
van_der_pol :: Double -> Double -> R2 -> R2 | |
van_der_pol mu dt (x, y) = (x+dx, y+dy) | |
where | |
dx = dt * y | |
dy = dt * (mu*(1-x**2)*y - x) | |
main = do | |
let result = let expansion = van_der_pol 0.5 0.01 | |
in take 5000 $ iterate expansion (2,2) | |
mapM_ putStrLn $ map form result | |
where form (x,y) = (show x)++", "++(show y) |
Author
tatyusa
commented
Mar 3, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment