About
Developed by Larry Engelhardt
In these exercises, you will determine the motion of a proton in a uniform electric field. We will begin by simulating a proton in an electric field using the NON-relativistic version of Newton’s 2nd Law. Then we will modify this simulation to take special relativity into account. In the process, we will observe the transition from non-relativistic to relativistic dynamics. In order to generate results, we will see that we need to be careful when working with non-SI units. In particular, we will need to pay close attention to factors of eV and style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-top-width: 0px; border-right-style: none; border-right-width: 0px; border-bottom-style: none; border-bottom-width: 0px; border-left-style: none; border-left-width: 0px; display: inline; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: normal">.
Subject Area | Modern Physics |
---|---|
Level | Beyond the First Year |
Available Implementations | IPython/Jupyter Notebook and Python |
Learning Objectives |
Students will be able to:
|
Time to Complete | 120 min |
Exercise 10:
At the LHC, protons are accelerated using much larger electric fields, style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-top-width: 0px; border-right-style: none; border-right-width: 0px; border-bottom-style: none; border-bottom-width: 0px; border-left-style: none; border-left-width: 0px; display: inline; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: normal"> Volts/meter. Use your program to simulate a proton at the LHC being accelerated by this large electric field. (Tip: You will need to significantly change the values of both the time step and the maximum time.) Discuss your results.
Exercise 11 (RELEVANT FOR PYTHON OR MATLAB, NOT RELEVANT FOR ALL PROGRAMMING LANGAUGES):
You might have noticed that your program becomes very slow if you have a very large number of time steps. Part of this is unavoidable; each time step requires the computer to do some processessing. However, much of the computation time is consumed by appending new values onto the arrays.
Rewrite your program so that, instead of repeatedly appending to the arrays, you create large empty arrays before the loop; then in each iteration of the loop, you record the new numbers in the appropriate element of the array. Observe and discuss how this affects the computation time.
# relativisticDynamicsVersion3.py
from pylab import *
from time import time
start = time()
c = 2.998e8 # Speed of light in m/s
m = 0.938e9 # Mass in eV/c^2
Efield = 5e6 # Electric field in Volts per meter
x = 0 # Position in meters
v = 0 # Velocity in meters/second
t = 0 # Time in seconds
dt = 1e-8 # Time STEP in seconds
tMax = 1e-3
N = int(tMax / dt)
tArray = zeros(N)
xArray = zeros(N)
vArray = zeros(N)
EArray = zeros(N)
lorentzArray = zeros(N)
for i in range(N):
# The dynamics:
lorentz = 1 / sqrt(1 - v**2 / c**2)
a = Efield*c**2/(lorentz**3*m)
t = t + dt
x = x + v*dt
v = v + a*dt
E = lorentz * m
# Write the new values into the arrays
tArray[i] = t
xArray[i] = x
vArray[i] = v
EArray[i] = E
lorentzArray[i] = lorentz
end = time()
print('Elapsed time:', end-start)
# The following lines are added for Exercise 7
KE_numerical = lorentz * m - m
KE_analytical = Efield*x
print('Numerical KE: ', KE_numerical)
print('Analytical KE:', KE_analytical)
print('Percent Difference:', 100*abs(KE_numerical-KE_analytical)/KE_analytical)
# Create plots
figure(1)
plot(tArray, vArray, linewidth=2)
xlabel('Time (sec)')
ylabel('Speed (m/s)')
grid(True)
ylim([0, 3.1e8])
savefig('ultrarelativistic_v_vs_t.png')
show()
figure(2)
plot(tArray, xArray, linewidth=2)
xlabel('Time (sec)')
ylabel('Position (m)')
grid(True)
savefig('ultrarelativistic_x_vs_t.png')
show()
figure(3)
plot(tArray, EArray, linewidth=2)
xlabel('Time (sec)')
ylabel('Energy (eV)')
grid(True)
savefig('ultrarelativistic_E_vs_t.png')
show()
Translations
Code | Language | Translator | Run | |
---|---|---|---|---|
Credits
Fremont Teng; Loo Kang Wee; based on codes by Larry Engelhardt
Version:
- https://www.compadre.org/PICUP/exercises/exercise.cfm?I=103&A=RelativisticDynamics-1D-ConstantForce
- http://weelookang.blogspot.com/2018/06/picup-relativistic-dynamics-in-1d-with.html
- http://weelookang.blogspot.com/2018/06/relativistic-dynamics-in-1d-with.html
Other Resources
end faq
{accordionfaq faqid=accordion4 faqclass="lightnessfaq defaulticon headerbackground headerborder contentbackground contentborder round5"}
- Details
- Written by Loo Kang Wee
- Parent Category: Physics
- Category: 06 Modern Physics
- Hits: 3711