These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

**Exercise 1:**
The file ending with "Version1" contains code to simulate
a proton in an electric field using the non-relativistic acceleration derived above.
(This code uses the "Euler algorithm" described in the "Theory" section.)
Execute this code, and look at the plots of position versus time and speed versus time.
Explain why these plots have the shapes that they have.
**Exercise 2:**
The file ending with "Version2" contains the same code as the file ending with
"Version1" except that a few lines have been added in order to also calculate and plot the non-relativistic *energy*.
Locate the line where the non-relativistic energy is calculated.
(The same line appears both inside the loop and before the loop.)
Explain why this line is correct. You will need to be very careful with the units and the factors of $c^2$. Write down the equation for non-relativistic energy (including both rest energy and non-relativistic kinetic energy),
and carefully argue why this line of code is correct.
Execute this code, and look at the plot of energy versus time.
Why does this plot have the shape that it has?
How large is the kinetic energy compared to the rest energy
after the proton has been accelerating for 1 second?
**Exercise 3:**
Again use the file ending with "Version2"
but now increase the value of the maximum time
from 1 second to 5 seconds.
How large is the kinetic energy compared to the rest energy
after the proton has been accelerating for 5 seconds?
Look at the plot of speed versus time.
Something should bother you! Explain what is wrong.
**Exercise 4:**
Derive the relativistic form of Newton's 2nd Law,
$$ a = \frac{F}{\gamma^3 m}, $$
from the equation $F = dp/dt$.
See the "Theory" section for additional background.
**Exercise 5:**
Save a copy of the file ending with "Version2"
using a file name ending with "Version3".
In this new file, you are going to modify the code
in order to take special relativity into account.
This will involve the following steps:
1. Compute the value of the Lorentz factor, $\gamma$.
2. Use the Lorentz factor to compute the acceleration.
3. Modify the equation for the energy
(both before the loop and within the loop)
in order to compute the *relativistic* energy.
Hint: Once you have computed the Lorentz factor,
the relativistic energy is actually very simple to compute,
but be very careful of the units and factors of $c^2$.
Execute your modified program, and fix any bugs!
**Exercise 6:**
Execute your modified program (Version3)
using a maximum time of 5 seconds,
and look at the plot of speed versus time.
Does the plot look better than the plot that you looked at in Exercise 3?
It should! If it doesn't, there is a bug in your code that needs to be fixed
before you continue.
Explain why the new plot of speed versus time has the shape that it has.
**Exercise 7:**
Now that you have created a new program,
you should attempt to validate your program
(to test how accurate the numbers actually are).
One simple way to do this is using the energy.
From the work-energy theorem, the kinetic energy
of the proton (starting from rest) is
$$ KE = W = \int F dx, $$
and since the force is constant, the kinetic energy is simply
the product of the (constant) force times the distance traveled.
This "analytical" result (which does not involve any approximations)
can be compared with the "numerical" kinetic energy from your program,
$$KE = \gamma m c^2 - mc^2.$$
Add code to your program (after the program's loop has completed)
to compute the kinetic energy both analytically and numerically.
Print both results, and make sure that they are similar.
(If they aren't you need to fix something!)
Compute the percent error in the numerical kinetic energy.
How large is the error?
Increase the value of your program's time step by a factor of 10.
How does this affect the error? Why does this happen?
(This code uses the "Euler algorithm" described in the "Theory" section.)
Before you continue to the next exercise,
make sure that the error is a small fraction of a percent.
**Exercise 8:**
Increase the maximum time for your simulation until you are able to get
the total energy of the proton up to 100 GeV.
Discuss the shape of each of the three plots (position, speed, and energy).
Why do they have the shapes that they have?
(Incorporate the term "ultra-relativistic" into your answer.)
**Exercise 9:**
Using an electric field of $\epsilon = 1$ Volt/meter,
how much time does it take to accelerate a proton
to an energy of 100 GeV? How far does it travel in that time?
(Use your plots from Exercise 8.)
At the Large Hadron Collider (LHC), protons are accelerated
to an energy of 8 TeV.
Instead of using a longer simulation,
*extrapolate* your results
in order to determine how long it would take to accelerate
a proton up to $E = 8$ TeV using $\epsilon = 1$ Volt/meter.
How far does the proton travel during this time?
How many trips around the LHC would the proton make during this time?
How does this distance compare to the circumference of the
Earth's orbit around the sun?
**EXTRA-CREDIT EXERCISES:**
**Exercise 10:**
At the LHC, protons are accelerated using
much larger electric fields, $\epsilon = 5\times 10^6$ 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.