how to solve Van der Pol equation using 'odeint'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yingzaji
    New Member
    • Mar 2008
    • 2

    how to solve Van der Pol equation using 'odeint'

    hi
    I was wondering about the odeint function in scipy.
    While I was solving the Van der pol equations, I found the function odeint
    is not suitable. I know there are some differences between Runge-kutta method and RKF method, and only the RKF method can be used to solve the Van der Pol system.
    But what should I do by the scipy function 'odeint'?
    Thanks a lot!

    The python program is given as follow,
    Code:
    #! /usr/bin/python
    # Filename:vaderpol.py
    
    
    from scipy import *
    from pylab import *
    u=0.1
    deriv= lambda y,t :array([y[1],y[0]-u*(y[0]**2-1)*y[1]])
    
    start=0
    end=20000
    numsteps=100000
    time=linspace(start,end,numsteps)
    from scipy import integrate
    y0=array([0.01,0.0])
    y=integrate.odeint(deriv,y0,time,hmax=0.2,hmin=0.001)
    plot(time,y[:,0])
    show()
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32668

    #2
    I'm assuming this is a Python question so moved it over. I found it in the Cafe.

    Comment

    Working...