波的干涉

In this lecture, we』ll see some examples of graphics with wave interference. Dropping a pebble in water leads to waves radiating outward from where the pebble was dropped. Given a drop location (x1, y1), the distance from this point is given by

r_{1} =sqrt {(x ? x_{1})^2 + (y ? y_{1})^2}

and the sine wave for height of the wave is

ξ_{1}(x, y) = ξ_{0} sin(kr_{1})

where ξ0 is ampltiude and k = 2π/λ is wavevector with λ as wavelength. Dropping a pebble at a different location would lead to

ξ_{2}(x, y) = ξ_{0} sin(kr_{2})

and superposition of the waves would lead to

ξ(x, y) = ξ1 + ξ2 = ξ0 sin(kr1) + ξ0 sin(kr2).

Given λ = 5cm and ξ0=1cm, and the centers of the circles being 20cm apart, we can plot the resulting waves.

Plotting it yields

code

from math import sqrt,sin,pinfrom numpy import emptynfrom pylab import imshow,gray,shownnwavelength = 5.0nk = 2*pi/wavelengthnxi0 = 1.0nnseparation = 20.0 # Separation of centers in cmnside = 100.0 # Side of the square in cmnpoints = 500 # Number of grid points along each sidenspacing = side/points # Spacing of points in cmnnn# Calculate the positions of the centers of the circlesnx1 = side/2 + separation/2ny1 = side/2nx2 = side/2 - separation/2ny2 = side/2nn# Make an array to store the heightsnxi = empty([points,points],float)nn# Calculate the values in the arraynfor i in range(points):n y = spacing*in for j in range(points):n x = spacing*jn r1 = sqrt((x-x1)**2+(y-y1)**2)n r2 = sqrt((x-x2)**2+(y-y2)**2)n xi[i,j] = xi0*sin(k*r1) + xi0*sin(k*r2)nn# Make the plotnimshow(xi,origin="lower",extent=[0,side,0,side])ngray()nshow()n

推薦閱讀:

如何評價丁澤軍的計算物理?
為什麼計算熱物理的模擬問題中,二階精度已經足夠高了?
影視級別的破碎效果怎麼製作?
lammps 計算實例——Cu 熱膨脹係數和熔化溫度的計算

TAG:计算物理学 | 科学计算 | Python |