CoCalc -- Collaborative Calculation in the Cloud
Sharedphys201-python-labs / Lab-7 / Lab7exercises.ipynbOpen in CoCalc

Lab 7

PHYS201 PHYSICS IIA Python Lab 7 Exercises

Mike Steel, 2017, modification by James Tocknell 2018


Your Name:Nicholas Arico

(Double-click cell above and fill out your name)


N.B. Generally it's a really good idea to make each of your answers self contained so that all the code necessary for the answer is in cells under the exercise heading. Use comments or text cells to document your work as necessary.

Exercise 1

A narrow wave packet in space must be composed of a broad range of momenta.

How does this explain the spreading of a wave packet in empty space?

Write your answer here

Using the heisengberg uncertainty principle, having a small uncertainty in relation to the position of the particle, implies a large uncertainty in relation the momentum of the particle. In this instance, having a narrow wave packet in space implies a larger spread of momentum of the wave. Since momentum is mv, therefore, the larger the spread of momenta, the larger the velocity of the spread

Exercise 2

By slight alteration of the code above, solve and plot the evolution of a wave packet with a smaller initial width of w=0.25w=0.25.

Comment on your result: is the wave packet spreading faster or slower for the smaller width initial wave packet? Explain this physically.

# write your code here
from math import *
import numpy as np
import matplotlib.pyplot as plt
import phys201quantum as phys201q


%matplotlib inline

psi0 = phys201q.make_psi0([-8, 8], 250, 'gaussian', .25, 0, 0)
V = phys201q.make_piecewise_potential([[-8, 0], [8, 0]])
psi_evol = phys201q.schro_evolve(psi0, V, tmax=1.5)

phys201q.plot_psi_at(psi_evol)
Doing 363 steps of size 0.004129 with sigma=dt/(4dx^2)=0.250000 Outputting 100 time slices separated by 3 dt=0.012387
(<Figure size 432x288 with 2 Axes>, <matplotlib.axes._subplots.AxesSubplot at 0x7f46b104dc50>)

Exercise 3

Now perform the same evolution but with a supergaussian input wave function. (Here 'super-gaussian') means the form exp(x4)\exp(-x^4). Choose a tmax of at least 5.

How is the result different? Can you explain this behaviour at all?

# write your code here
psi0 = phys201q.make_psi0([-8, 8], 250, 'supergaussian', .25, 0, 0)
V = phys201q.make_piecewise_potential([[-8, 0], [8, 0]])
psi_evol = phys201q.schro_evolve(psi0, V, tmax=7)

phys201q.plot_psi_at(psi_evol)


fig, axs = plt.subplots(1, 2)
phys201q.plot_psi_pcolor(psi_evol, ax=axs[0])
phys201q.plot_psi_pcolor(psi_evol, show_phase=1, ax=axs[1])

phys201q.animate_psi(psi_evol)


#This is because the domain of the simulation acts as an infinite well/barrier. So the waveform is perfectly reflected off the boundaries, and interferes with itself, creating an interference pattern, which is what can be seen different
Doing 1695 steps of size 0.004129 with sigma=dt/(4dx^2)=0.250000 Outputting 100 time slices separated by 16 dt=0.066063
(<Figure size 432x288 with 2 Axes>, <matplotlib.axes._subplots.AxesSubplot at 0x7f46b03017f0>)

Exercise 4

Now excite a Gaussian wave packet of width 2 but initial momentum p0=2.

You may wish to shift the starting point on the xx axis to keep the beam in the simulation domain.

Do the results make sense? Explain.

# write your code here
psi0 = phys201q.make_psi0([-8, 8], 250, 'gaussian', 2, 0, 2)
V = phys201q.make_piecewise_potential([[-8, 0], [8, 0]])
psi_evol = phys201q.schro_evolve(psi0, V, tmax=1.5)

phys201q.plot_psi_at(psi_evol)
phys201q.animate_psi(psi_evol)

#Since we increased the momentum from 0 to 2, the particle now has a veloicty, so the wave packet also has a velocity, and hence moves over time.
Doing 363 steps of size 0.004129 with sigma=dt/(4dx^2)=0.250000 Outputting 100 time slices separated by 3 dt=0.012387
(<Figure size 432x288 with 2 Axes>, <matplotlib.axes._subplots.AxesSubplot at 0x7f46abd5b828>)

Exercise 5

Return to a simulation of a wave packet with initial width 0.25, zero momentum and a domain width of 20, but this time let the evolution run until t=8t=8.

Display the result with an animation.

Explain what is going on here? Is the behaviour physical? How can it be fixed?

# write your code here
psi0 = phys201q.make_psi0([-10,10], 250, 'gaussian', .5, 0, 0)
V = phys201q.make_piecewise_potential([[-8, 0], [8, 0]])
psi_evol = phys201q.schro_evolve(psi0, V, tmax=8)

phys201q.animate_psi(psi_evol)

#
print('Once again, the wave function spreads until reaching the boundaries,then hitting the boundaries and being reflected back and causing an interference pattern. This is not a physical phenomenon, and can be fixed by extending the boundaries"domain" to larger numbers')
Doing 1240 steps of size 0.006452 with sigma=dt/(4dx^2)=0.250000 Outputting 100 time slices separated by 12 dt=0.077418