import numpy as np
import matplotlib.pyplot as plt

A= 1
w=62.8
c=1

def onde(x,t):                                            # Fonction d'onde
    return(A*np.exp(-(t-x/c)**2)*np.cos(w*(t-x/c)))
    
x=np.linspace(-2,8,1000)

for t in np.arange(0,4,0.05):

    plt.clf()
    plt.axis([-2,8,-1.5,1.5])
    plt.xlabel('abscisse x')
    plt.ylabel("fonction d'onde s")  
    plt.plot(x,onde(x,t))
    plt.grid()
    plt.pause(0.0001)
    
