Developed by Christopher Orban  Published May 23, 2017
Subject Area  Electricity & Magnetism 

Levels  High School and First Year 
Available Implementation  Javascript 
Learning Objectives 
1. Students will gain experience applying kinematics equations from classical mechanics to a situation with a proton being accelerated from between two charged plates. This will involve performing an analytic calculation for the final speed of the proton that should closely match the result of the simulation.
2. Students will gain intuition on how the charge and mass of a particle affects its behavior in an electric field by modifying the code to change the charge, mass and direction of the electric field and seeing what happens. After making these changes students will also perform analytic calculations for the final speed of the particle that should match the result of the simulation.
3. Students will also learn how to think about charged plates in terms of potential difference. Students will perform analytic calculations that use potential difference to determine the final speed of the particle.

Time to Complete  60 min 
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.).
Part 1. Electric fields and acceleration!
In this exercise we will make a simulation of a particle being accelerated between two plates. The relevant equations in this case are these: $$v_{xf} = v_{xi} + a_x t \nonumber $$ $$v_{xf}^2 = v_{xi}^2 + 2 a_x \Delta x \nonumber $$ $$F_x = m a_x \nonumber $$ $$F_x = q E \nonumber $$ We will use some [unusual force and electric field units](http://www.physics.ohiostate.edu/~orban/physics_coding/units.html) in this exercise, but other things should be more familiar. Specifically the variableq
will be in terms of the elementary charge. So a proton will be q = 1.0;
. The variable mass
will be in atomic mass units, so a proton would be mass = 1.0;
.
Step. 1. Check out this nice animation of a [proton being accelerated through two charged plates](https://www.asc.ohiostate.edu/orban.14/stemcoding/accelerator2/accelerator.html). In the animation, notice that the initial x velocity ($v_{xi}$) is nonzero.
Step 2. Try out the accelerator code in an editor
[Click on this link to open the accelerator code in a p5.js editor](https://editor.p5js.org/ChrisOrban/sketches/1selx5sR)
Press play there to run the code. It should behave the same way it did [with the link you were given in Step 1](https://www.asc.ohiostate.edu/orban.14/stemcoding/accelerator2/accelerator.html)
Important! Create an account with the editor or sign in to your account. Then click "Duplicate" so you can have your own version of the code!
Step 3. Try to make sense of the code behind the animation. Think especially about this section:
if ( ( x > x_plate_left) & (x < x_plate_right)) { deltaVx = (q*E/mass)*dt; t += dt; }This is the change in velocity each timestep (
deltaVx
) when the particle is inbetween the two plates. The quantity in the parenthesis (q*E/mass)
is acceleration.
Optional Step: Plot $v_x$ versus time by adding this code after display(); but before the end of draw()
graph1.addPoint(vx); graph1.display();This should produce a plot of vx versus time in the top right corner of the simulation. Step 4. Calculate the acceleration The final velocity at the end of the animation is 55.5 meters per second. (Ok, really it's pixels per second but let's just think about it as meters per second. The width of the screen would be 750 meters.) The particle spends t = 9.1 seconds in the electric field. If we can just figure out the acceleration, we should be able to use this formula to relate the initial velocity to the final velocity: $$ v_{xf} = v_{xi} + a_x t \nonumber $$ What should we use for $a_x$ in this case? Use q = 1, E = 5, and m = 1 to figure it out. You should be able to come up with 55.5 meters per second for $v_{xf}$ with the correct value for $a_x$. Do not simply use the 55.5 meters per second result to figure out what the acceleration was! We are doing a consistency check on the code! Consistency is key! Step 5. Imagine you didn't know the time In a laboratory setting it is often hard to figure out exactly how much time a particle spends in the electric field. But we still know the initial velocity, the strength of the electric field, the mass of the particle and the separation ($\Delta x$) between the two plates which in this case is $ \Delta x = 500200 = 300$ meters. Use this information with this equation to come up with the 55.5 meters per second result for $v_{xf}$. $$ v_{xf}^2 = v_{xi}^2 + 2 a_x \Delta x \nonumber $$ Show that you can get 55.5 meters per second for $v_{xf}$ from this equation. This is another consistency check for the code. Step 6. See what happens if the charge of the particle is doubled. Set
q = 2.0
instead of 1.0
. Does the charge of the particle affect the final velocity? why or why not?
Step 7. See what happens if the mass of the particle is 2.0
instead of 1.0
. Change the charge of the particle back to 1.0 so that the simulation is like accelerating a Deuteron instead of a proton.
Note: Deuterons have about twice the mass as protons because a Deuteron is a proton and a neutron that are stuck together by nuclear forces. Protons and neutrons have roughly the same mass so the total mass of a Deuteron is about twice that of the proton. The net charge of the Deuteron is the same as the proton because neutrons are electrically neutral particles (no charge).
Predict the final velocity of the Deuteron and check to see if your expectation is proven right! Show your calculation, prediction and measurement in what you turn in for this lab.
Step 8. What happens if you change the electric field from 5 (the default value) to 5? Notice that the direction of the field lines changes when you do this. How fast does a Deuteron need to be traveling in order to get through the plate? Calculate why it has to be this fast!
Optional: Step 9. (Extra Credit) Modify the program in some way (choose one or more)
Suggestions/inspiration for modifying the program:
 add a component of the initial velocity in the y direction and predict the final speed
 Make the code smart enough to use negative(x,y) if the charge is less than zero and positive(x,y) if the charge is greater than zero.
How to get full credit for Part 1!!!
In what you turn in you should answer the questions asked in this programming lab: 1. Make sure to explain why the final velocity turned out to be 55.5 meters per second (Steps 4 & 5) As best you can write down the equations that you used to calculate your number and write down the number you got. You may not get exactly 55.5 but that's ok. Try to get within 10% of that number. 2. Say in words whether increasing the charge of the particle from 1.0 to 2.0 affects the final velocity (Step 6) Just write a sentence. Say whether the final velocity increases, decreases or stays the same. No calculation necessary. 3. Change the mass to 2.0 and the charge back to 1.0 so that the particle is a Deuteron. Predict the final velocity and measure it (Step 7) Make sure your calculation matches the measured result to 10%. 4. Describe what happens when the electric field is negative and figure out how fast the Deuteron needs to be traveling (Step 8) Just change the initial velocity of the Deuteron until it passes through. Then calculate why it had to be this way. Write down the number for how fast it should be going. It may not match your empirical result exactly, but it should agree to maybe 10% 5. The extra credit really is optional You can still get full credit without doing the extra credit as long as you've done everything else correctlyPart 2. Electric fields and electric potential!
Thinking about the problem in terms of potential difference, the relevant equations are: $$\Delta V = E d \nonumber $$ $$\Delta KE = q \Delta V \nonumber $$ $$KE = \frac{1}{2} m v_x^2 \nonumber $$ $$\Delta KE = KE_f  KE_i \nonumber$$ where $d$ is the distance between the plates. It should be clear from the animation that the initial kinetic energy is nonzero (because $v_{xi}$ is nonzero). The purpose of this programming lab is to show that the potential difference way of thinking about the problem is just as useful as thinking about the problem in terms of forces, and maybe even more useful, if the energy is what we care about!!! You can also use your code from the previous exercise so long as you **change the charge of the particle back to +1 and the mass of the particle back to 1.0!!!** Step 3. The final velocity at the end of the animation is 55.5 meters per second. The initial velocity was 10 meters per second and the acceleration occurs over 300 meters. Go back to the previous programming lab and remember how you were able to explain why the final velocity is 55.5 meters per second. In the last programming lab we thought about the problem in terms of forces. Write down the equations that explained the 55.5 meters per second in what you turn in for this lab. Step 4. The potential difference between the plates is $\Delta V = E d$ where $E$ is 5 and $d$ is 300 meters. The potential difference is therefore $\Delta V = E d = 1500$. Choose a different value for $E$, and choose a different value for $d$ by changing the variablesx_plate_left
and x_plate_right
. Make sure that the new values of $d$ multiply to $\Delta V = 1500$ and make sure $d < 750$ meters or else one of the plates will be offscreen. Check to see if approximately the same final velocity (55.5 meters per second) is achieved. (The final velocity should be the same because the potential difference is the same. This is one reason why the potential difference is such a useful concept.) When you turn in this lab make sure your code has the values of $E$ and $d$ that you chose and write down the measured value of the velocity to confirm that this worked.
Step 5. With your new values for $E$ and $d$, check to see what happens if the charge of the particle is doubled. Set q = 2.0
instead of 1.0
. Does the charge of the particle affect the final velocity? why or why not? Do you get the same final velocity with the original values of $E$ and $d$? Is it faster or slower?
Step 6. With your new values for $E$ and $d$, check to see what happens if the mass of the particle is 2.0
instead of 1.0
and change the charge of the particle back to 1.0. As mentioned in the last programming lab, this is like changing the particle from a proton to a deuteron. Predict the final velocity and check to see if your expectation is proven right. Do this calculation three different ways: (1) thinking about the problem in terms of acceleration and the time, as in Part 1, (2) thinking about the problem in terms of acceleration and the distance without knowing the time as in Part 1 and (3) thinking about the problem in terms of the potential difference and the change in kinetic energy You should be able to show that all three approaches give essentially the same answer.
How to get full credit for Part 2!!!
In what you turn in you should answer the questions asked in this programming lab: 1. Write down the equations that gave 55.5 meters per second from Part 1 Feel free to look back at Part 1 and just put these same equations here 2. Choose new values for $E$ and $d$ (Step 4a) Make sure that the code you submit contains the new values for $E$ and $d$. These should multiply to $\Delta V = Ed = 1500$ and make sure $d < 750$ meters or else one of the plates will be off screen. 3. State whether you get approximately the same final velocity with the new values of $E$ and $d$ (Step 4b) This is just a yes or no question. The answer should be yes (as mentioned in step 4) or else you've done something wrong. 4. Say whether increasing the charge of the particle increases the final speed (Step 5) This is just a yes/no question. Make sure you change $E$ and $d$ before you test this. 5. Change the mass and show three different ways to calculate the final velocity (Step 6) You can calculate the final velocity using acceleration with time, or acceleration with distance or using the change in electric potential and the change in kinetic energy. Write down the equations as best you can in the comments. Don't just show the result. You should get approximately the same answer.
Download Options
Share a Variation
Credits and Licensing
Christopher Orban, "Particle Accelerator!," Published in the PICUP Collection, May 2017, https://doi.org/10.1119/PICUP.Exercise.ParticleAccelerator.
DOI: 10.1119/PICUP.Exercise.ParticleAccelerator
The instructor materials are ©2017 Christopher Orban.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license