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$$ $$v_{xf}^2 = v_{xi}^2 + 2 a_x \Delta x$$ $$F_x = m a_x$$ $$F_x = q E $$

This should be fairly familiar to you by this point in the course. We will use some unusual force and electric field units in this exercise, but other things should be more familiar.

A proton (mass = 1.0, charge = +1) is accelerated between two plates with an electric field with a strength of +5. The electric field unit is ** not** the usual Newtons per Coulomb. Instead the electric field is defined so that a field of 1.0 with accelerate a proton at $1 \, m/s^2$. It's really not any more complicated than that, but you can read through this discussion of units. if this seems like a weird thing to do.

**Step. 1.** Check out this nice animation of a proton being accelerated through two charged plates. In the animation, notice that the initial x velocity ($v_{xi}$) is ** non**-zero.

**Step 2. Try out the accelerator code in an editor**

Click on this link to open the particle accelerator code in a p5.js editor

Press play there to run the code. It should like the same it did with the link you were given in Step 1.

**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.

**Step 4.** 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.) 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 $$

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 = 500 - 200 = 300$.

**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? Determine the minimum speed for the Deuteron to get through. **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
- Copy paste the rocket thruster code from planetoids so that the charge can fly around and be accelerated by the plates.
- 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.

In the **comments section in the dropbox on carmen** 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 equation 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 correctly