# -*- coding: utf-8 -*-
"""
Created on Sat Sep  7 10:14:04 2024

@author: user
"""

import scipy.integrate as sp
import matplotlib.pyplot as plt
import numpy as np


a=3
b=1
w0=7

def F_vanderpol(x,t):
    return (x[1],(-x[1]*x[0]*(a/b)+a-(w0**2))*x[0])

t=np.linspace(0,10,1000)
y0=0
y1=0.1   # vitesse angulaire initiale   
xini=(y0,y1)
xsol=sp.odeint(F_vanderpol,xini,t)
y=xsol[:,0]
yprime=xsol[:,1]



# tracé

plt.figure()
plt.plot(t,y)
plt.xlabel("t(s)")
plt.ylabel("y(rad)")
plt.legend()
plt.grid()
plt.show()