#calcul de l'intensité avec N ondes qui interfèrent
import numpy as np
import matplotlib.pyplot as plt
def I(N,p):
    phi=2*np.pi*p
    A=np.sin(N*phi/2)/(N*np.sin(phi/2))
    return A*A
p = np.linspace(-3,3,5000)
I1=I(4,p)
I2=I(10,p)
plt.figure(figsize=(12,5))
plt.plot(p,I1,':',label="N=4")
plt.plot(p,I2,'-',label="N=10")
plt.xlabel("p")
plt.ylabel('I/Imax')
plt.legend()
plt.axis([-3,3,0,1])
plt.grid()
plt.show()
