'How can I solve a contourf array problem?

I have trouble with plt.contourf. The program is supposed to calculate the distance between s1 and m called s1m and S2 and m called s2m than using s1m and s2m we calculate the wave functions psi and psiP than we multiply them to get the intensity of light, we use what we get in contourf to see the results in a screen. When I run the program I

import numpy as np 
import matplotlib.pyplot as plt 

S1 = np.array([100,0,-1])
S2 = np.array([-100,0,-1])
M = np.array([1,1,0])
Lambda = 633
s1m= np.substract(m,S1)#vector S1M
s2m= np.substract(m,S2)#vector S2M
SM1= np.multiply(s1m,s1m)
SM2= np.multiply(s2m,s2m)
S1M= np.sqrt(SM1)#distance s1m
S2M= np.sqrt(SM2)#distance s2m

def intensity (S1M,S2M):
    Phi1=(2 * np pi * S1M)/lambda
    Phi2=(2 * np.pi * S2M)/lambda
    Tet1=(-2 * np.pi * S1M)/lambda
    Tet2=(-2 * np.pi * S2M)/lambda

    Psi1 = np.exp(Phi1)
    Psi2 = np.exp(Phi2)
    Psi1P = np.exp(Tet1)
    Psi2P = np.exp(Tet2)

    Psi = Psi1 + Psi2
    PsiP = Psi1P + Psi2P
    I = Psi * PsiP

x = np.linspace(1,5,5)
y = np.linspace(1,5,5)
XX,YY = np.meshgrid(x,y)
ZZ = intensity (S1M, S2M)

plt.contourf (XX, YY, ZZ)
plt.show()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source