This demo is for explaining Huygens Principle which states that every plain wave can be approximated as sum of infinite number of small circular waves spatially distributed in space.
This notebook is great! I'm going to change some notation a bit to make sure I have a handle on what's going on.
Parameter Specifications:
delta = 100 # Set step size here
Generate Input Vector - It generates x values from -1 to 1 with an interval of delta :
x = arange(-1, 1, (1.0/delta))
Generate Output Vector - Using equation for a unit circle :
y = sqrt(1-x**2)
Plot the basic secondary wave generated :
plot(x,y)
grid(1)
Calculating Secondary waves their sum and plotting these :
numSources = 10
Ly = len(y)
c = 0
xValues = linspace(0, 4, 4*Ly)
# Create Empty 2D Array for Secondary Waves
z = np.zeros((numSources,4*Ly))
#All centeres on x-axis, equally spaced:
centerIndices = linspace(Ly, 3*Ly, numSources, dtype = 'int')
for i, center in enumerate(centerIndices):
z[i, center-Ly/2:center+Ly/2] = y
fig = figure(0, (15, 3))
plot(xValues, z.T, ':', c= [0.3, 0.3, 0.3])
plot(xValues, mean(z, axis=0), linewidth=2)
scatter(xValues[centerIndices], zeros(numSources), c= 'k')
xlim([0, 4])
ylim([0, 1.5])
grid(1)
def superimposeMultipleSources(numSources= 10):
Ly = len(y)
c = 0
xValues = linspace(0, 4, 4*Ly)
# Create Empty 2D Array for Secondary Waves
z = np.zeros((numSources,4*Ly))
#All centeres on x-axis, equally spaced:
centerIndices = linspace(Ly, 3*Ly, numSources, dtype = 'int')
for i, center in enumerate(centerIndices):
z[i, center-Ly/2:center+Ly/2] = y
fig = figure(0, (15, 3))
plot(xValues, z.T, ':', c= [0.3, 0.3, 0.3])
plot(xValues, mean(z, axis=0), linewidth=2)
scatter(xValues[centerIndices], zeros(numSources), c= 'k')
xlim([0, 4])
ylim([0, 1.5])
grid(1)
from IPython.html.widgets import interact
interact(superimposeMultipleSources, numSources= (1, 100))
<function __main__.superimposeMultipleSources>
As we increase the number of sources, behavoir becomes linear!