Breadcrumbs

 

 

 

Download ModelDownload SourceembedLaunch Website ES WebEJS

About

Intro Page

Motion of a Charged Particle in a Magnetic Field

Developed by J. D. McDonnell

In this set of exercises, the student will write code to calculate and visualize the trajectories of charged particles under the influence of both uniform and interesting non-uniform magnetic fields, including the earth’s magnetic field.

Subject Area Electricity & Magnetism
Level Beyond the First Year
Available Implementation IPython/Jupyter Notebook
Learning Objectives

Students who complete this set of exercises will

  • develop their understanding of how charged particles respond to magnetic fields (Exercises 1, 2, and 3);
  • be able to describe in pseudo-code how to calculate the trajectory of a charged particle in a magnetic field (Exercise 1);
  • be able to use numerical methods for ordinary differential equations to calculate the particle’s trajectory (Exercises 1, 2, and 3);
  • be able to interpret and describe the computed trajectories (Exercises 1, 2, and 3);
  • and be able to validate numerical solutions against analytical solutions for appropriate test cases (Exercise 1).
Time to Complete 120 min
Exercise 1

EXERCISE 1: MOTION OF A CHARGED PARTICLE IN A UNIFORM MAGNETIC FIELD

Consider a uniform magnetic field, of strength  T, in the -direction. An -particle enters the magnetic field at initial position , with an initial velocity  in the -direction.

  • What do you expect the -particle’s trajectory to be shaped like?
  • Write the equations of motion for the -particle in the uniform magnetic field. Solve the equations analytically.
  • Describe in words (or pseudocode) a procedure to numerically solve these equations of motion for the trajectory of the -particle.
  • Now, use your numerical method or a differential equation solver to find a numerical solution to the equations of motion you wrote down. The special case of a uniform magnetic field has an analytical solution, but many cases do not. Validate your code: Does the shape of the -particle’s trajectory match your expectation and your analytical calculation?
  • How would your results be different for an  ion that enters the magnetic field? Confirm by running the code with parameters for the  ion with the same initial velocity that the -particle had. Plot the -particle’s trajectory and the negative ion’s trajectory on the same plot.
LorentzForce.ipynb (Exercise 1)

%matplotlib inline

import numpy

import matplotlib.pyplot as mpl

from mpl_toolkits.mplot3d import Axes3D

# Parameters for plot attributes

mpl.rc("xtick", labelsize="large")

mpl.rc("ytick", labelsize="large")

mpl.rc("axes", labelsize="xx-large")

mpl.rc("axes", titlesize="xx-large")

mpl.rc("figure", figsize=(8,8))

Exercise 1. Uniform Magnetic Field

# define key constants

m_p = 1.67E-27 # mass of proton: kg

qe = 1.602E-19 # charge of proton: C

# now, setting up an alpha particle

m = 4.0*m_p

q = 2.0*qe

QoverM = q/m

dt = 1.0E-8

t = numpy.arange(0.0, 0.002, dt)

rp = numpy.zeros((len(t), 3))

vp = numpy.zeros((len(t), 3))

v0 = numpy.sqrt(2.0*QoverM*10.0)

# negative ion

mn = 1.0 * m_p

qn = -1.0*qe

QoverMn = qn/mn

rn = numpy.zeros((len(t), 3))

vn = numpy.zeros((len(t), 3))

# Strength of Magnetic Field

B0 = 1.0E-4

expected_R = m*v0/(q*B0)

expected_T = 2.0*numpy.pi*expected_R / v0

print("v0 = ", v0)

print("Expected trajectory radius = ", expected_R)

print("Expected cyclotron period = ", expected_T)

# initial condition

rp[0,:] = numpy.array([0.0, 0.0, 0.0])

vp[0,:] = numpy.array([v0, 0.0, 0.0])

# initial condition for negative ion

rn[0,:] = numpy.array([0.0, 0.0, 0.0])

vn[0,:] = numpy.array([v0, 0.0, 0.0])

# Euler time steps

for it in range(0, len(t)-1):

Bp = numpy.array([0.0, 0.0, B0])

Ap = QoverM * numpy.cross(vp[it,:], Bp)

vp[it+1] = vp[it] + dt*Ap

rp[it+1] = rp[it] + dt*vp[it]

An = QoverMn * numpy.cross(vn[it,:], Bp)

vn[it+1] = vn[it] + dt*An

rn[it+1] = rn[it] + dt*vn[it]

# Plot the particle's trajectory, in the xy-plane

mpl.plot(rp[:,0], rp[:,1], label="Alpha particle")

mpl.plot(rn[:,0], rn[:,1], linestyle = "--", label="H ion")

mpl.xlabel("x")

mpl.ylabel("y")

mpl.title("Particle Trajectories in Uniform Magnetic Field")

mpl.legend(fontsize="x-large")

mpl.xlim(-13,13)

mpl.ylim(-13,13)

 

Translations

Code Language Translator Run

Credits

Fremont Teng; Loo Kang Wee

Overview:

This document provides a briefing on the "PICUP MOTION OF A CHARGED PARTICLE IN A UNIFORM MAGNETIC FIELD JavaScript Simulation Applet HTML5" resource from Open Educational Resources / Open Source Physics @ Singapore. This resource offers a set of exercises focused on understanding the motion of charged particles within magnetic fields, primarily a uniform one. It aims to help students develop both conceptual and computational skills in electromagnetism and numerical methods.

Main Themes and Important Ideas/Facts:

  • Lorentz Force and Magnetic Fields: The core concept explored is the effect of a magnetic field on a moving charged particle, governed by the Lorentz force. The exercises challenge students to understand how this force dictates the trajectory of particles.
  • Uniform Magnetic Field (Exercise 1): This exercise focuses specifically on the motion of charged particles (an alpha particle and an H- ion are used as examples) in a uniform magnetic field directed along the z-axis.
  • Expected Trajectory: Students are prompted to predict the shape of the trajectory. Based on the Lorentz force (which is always perpendicular to the velocity), the expected motion in a uniform magnetic field perpendicular to the initial velocity is circular motion.
  • Equations of Motion: Students are required to write and analytically solve the equations of motion for a charged particle in this scenario. This involves applying Newton's second law with the magnetic force as the net force.
  • Numerical Solution: A significant aspect of the exercise is the implementation of a numerical method (like the Euler method, as demonstrated in the provided Python code) to approximate the particle's trajectory. This highlights the power of computational methods for solving differential equations that may not have simple analytical solutions. The resource explicitly states: "The special case of a uniform magnetic field has an analytical solution, but many cases do not."
  • Validation: Students are expected to compare their numerical results with their analytical solutions and their initial expectations to validate their code and understanding. The question posed is: "Validate your code: Does the shape of the α-particle’s trajectory match your expectation and your analytical calculation?"
  • Charge and Mass Dependence: The exercise also explores how the trajectory changes for different charged particles (alpha particle vs. H- ion) with the same initial velocity, emphasizing the dependence on charge and mass. The prompt asks: "How would your results be different for an H − ion that enters the magnetic field? Confirm by running the code with parameters for the H − ion with the same initial velocity that the α-particle had."
  • Computational Physics Learning: The resource actively promotes the use of computational tools (specifically IPython/Jupyter Notebooks) to solve physics problems. It aims to develop students' skills in:
  • Writing pseudo-code for physical simulations.
  • Using numerical methods for ordinary differential equations.
  • Visualizing and interpreting computed trajectories using libraries like matplotlib.
  • Validating numerical solutions against known analytical results.
  • Open Educational Resource: The resource is presented as an Open Educational Resource, encouraging embedding and adaptation. The availability of the Python code (LorentzForce.ipynb) further supports this by providing a concrete example for students to learn from and modify.
  • Broader Context (Implicit): While Exercise 1 focuses on a uniform field, the "About" section mentions that the broader set of exercises (Exercises 1, 2, and 3) will involve "interesting non-uniform magnetic fields, including the earth’s magnetic field," suggesting a progression towards more complex and realistic scenarios.
  • Learning Objectives: The stated learning objectives clearly outline the intended outcomes for students engaging with these exercises, emphasizing both conceptual understanding and practical computational skills.

Key Quotes:

  • Regarding the overall goal: "In this set of exercises, the student will write code to calculate and visualize the trajectories of charged particles under the influence of both uniform and interesting non-uniform magnetic fields, including the earth’s magnetic field."
  • Highlighting the importance of numerical methods: "The special case of a uniform magnetic field has an analytical solution, but many cases do not."
  • Emphasizing the validation process: "Validate your code: Does the shape of the α-particle’s trajectory match your expectation and your analytical calculation?"
  • Stating a core learning objective: "develop their understanding of how charged particles respond to magnetic fields (Exercises 1, 2, and 3);"
  • Another key learning objective focused on computation: "be able to describe in pseudo-code how to calculate the trajectory of a charged particle in a magnetic field (Exercise 1);"

Python Code Snippets and Their Significance:

The provided Python code snippet (LorentzForce.ipynb) demonstrates a numerical implementation of the motion of charged particles in a uniform magnetic field using the Euler method. Key aspects include:

  • Defining constants: m_p, qe (mass and charge of a proton), and setting up parameters for the alpha particle (m = 4.0*m_p, q = 2.0*qe) and the negative hydrogen ion (mn = 1.0 * m_p, qn = -1.0*qe).
  • Setting up the magnetic field: B0 = 1.0E-4 and Bp = numpy.array([0.0, 0.0, B0]) define a uniform magnetic field in the z-direction.
  • Initial conditions: Setting the initial position and velocity for both particles:
  • rp[0,:] = numpy.array([0.0, 0.0, 0.0])
  • vp[0,:] = numpy.array([v0, 0.0, 0.0])
  • Euler time steps: Implementing the Euler method to update the velocity and position of the particles based on the Lorentz force:
  • Ap = QoverM * numpy.cross(vp[it,:], Bp)
  • vp[it+1] = vp[it] + dt*Ap
  • rp[it+1] = rp[it] + dt*vp[it]
  • Plotting the trajectories: Using matplotlib to visualize the motion of the alpha particle and the H- ion in the xy-plane.

Conclusion:

This resource provides a valuable, hands-on approach to learning about the motion of charged particles in magnetic fields. By combining conceptual questions with computational exercises, it encourages a deeper understanding of the underlying physics and the practical application of numerical methods in solving physics problems. The focus on a uniform magnetic field in Exercise 1 serves as a fundamental step towards understanding more complex magnetic field configurations explored in subsequent exercises. The open nature of the resource and the provision of sample code make it highly adaptable for educational purposes.

 

Motion of a Charged Particle in a Uniform Magnetic Field Study Guide

Quiz

  1. Describe the expected trajectory of a positively charged alpha particle entering a uniform magnetic field perpendicular to its velocity. Explain the reasoning behind this expected shape.
  2. Write down the Lorentz force equation for a charged particle moving in a magnetic field. Identify each variable in the equation and its physical significance.
  3. In the context of Exercise 1, what are the given values for the magnetic field strength, the initial position of the alpha particle, and its initial velocity vector?
  4. What is the purpose of developing pseudo-code to solve the equations of motion numerically? Briefly outline the general steps involved in such a procedure.
  5. Explain why numerical methods are often necessary to determine the trajectory of a charged particle in a magnetic field, even though analytical solutions exist for uniform fields.
  6. What specific numerical method is employed in the provided Python code (LorentzForce.ipynb) to approximate the trajectory of the charged particles? Briefly describe how this method works in one time step.
  7. According to the provided code, what are the key differences in the properties (mass and charge) between an alpha particle and an H⁻ ion? How do these differences affect the QoverM ratio for each particle?
  8. What is the cyclotron period, and how is it related to the radius of the circular motion of a charged particle in a uniform magnetic field?
  9. Based on the provided code and the simulation results, how does the trajectory of the H⁻ ion differ from that of the alpha particle when both enter the same uniform magnetic field with the same initial velocity? Explain the reason for this difference.
  10. What does it mean to validate a numerical solution against an analytical solution? Why is this an important step in computational physics?

Quiz Answer Key

  1. The expected trajectory is a circle or a helix. The magnetic force is always perpendicular to the velocity, providing the centripetal force required for circular motion. If the initial velocity has a component parallel to the magnetic field, that component remains unchanged, resulting in a helical path.
  2. The Lorentz force equation is F = q(v × B), where F is the magnetic force on the charged particle, q is the charge of the particle, v is its velocity vector, and B is the magnetic field vector. This equation describes the force experienced by a moving charge in a magnetic field.
  3. The uniform magnetic field strength is 10⁻⁴ T in the z-direction (B = [0.0, 0.0, 1.0E-4]). The initial position of the alpha particle is (0.0, 0.0, 0.0). Its initial velocity is 31000 m/s in the x-direction (v₀ = [31000.0, 0.0, 0.0]). Note: The provided code uses a different initial velocity v0 = numpy.sqrt(2.0*QoverM*10.0) for illustrative purposes, but the problem statement gives 31000 m/s.
  4. Developing pseudo-code helps to logically plan the steps required for a numerical solution before implementing it in a specific programming language. It involves breaking down the problem into smaller, manageable steps, such as initializing variables, implementing the equations of motion in discrete time steps, and storing the results.
  5. While analytical solutions exist for simple cases like uniform magnetic fields, many real-world magnetic fields are non-uniform and complex. For these situations, analytical solutions are often impossible to find, making numerical methods essential for approximating the particle's trajectory.
  6. The Python code uses the Euler method, a first-order numerical method for solving ordinary differential equations. In each time step (dt), it calculates the change in velocity based on the Lorentz force at the current velocity and then uses the updated velocity to find the new position.
  7. An alpha particle has a mass approximately four times the mass of a proton (m = 4.0 * m_p) and a charge of +2e (q = 2.0 * qe). An H⁻ ion has a mass approximately equal to the mass of a proton (mn = 1.0 * m_p) and a charge of -1e (qn = -1.0 * qe). The QoverM ratio (charge-to-mass ratio) is therefore different for the two particles and determines the magnitude of acceleration due to the magnetic force.
  8. The cyclotron period (T) is the time it takes for a charged particle to complete one circular orbit in a uniform magnetic field. It is given by the formula T = 2πR/v, where R is the radius of the circular path and v is the speed of the particle. It can also be expressed as T = 2πm/(|q|B).
  9. The H⁻ ion, having an opposite charge to the alpha particle, experiences a magnetic force in the opposite direction. As a result, its trajectory in the xy-plane will be a circle traversed in the opposite sense (clockwise instead of counterclockwise in this setup). The radius of curvature might also differ due to the different charge-to-mass ratio.
  10. Validating a numerical solution involves comparing the results obtained from the numerical method with the exact results derived from an analytical solution for a specific case where both exist. This process helps to ensure the accuracy and reliability of the numerical method and the code implementation.

Essay Format Questions

  1. Discuss the relationship between the Lorentz force and the resulting motion of a charged particle in a uniform magnetic field, considering cases where the initial velocity is perpendicular, parallel, and at an arbitrary angle to the field.
  2. Explain the process of numerically solving the equations of motion for a charged particle in a magnetic field. Detail the steps involved in a basic numerical method like the Euler method and discuss the factors that can affect the accuracy of the numerical solution.
  3. Compare and contrast the trajectories of positively and negatively charged particles with the same initial velocity entering a uniform magnetic field. Analyze how the charge and mass of the particles influence their motion.
  4. The provided material focuses on motion in a uniform magnetic field. Discuss how the trajectory of a charged particle would differ in a non-uniform magnetic field. Consider potential applications where non-uniform magnetic fields are used to manipulate charged particles.
  5. The exercise encourages the validation of numerical solutions against analytical ones. Elaborate on the importance of validation in computational physics and discuss different methods or test cases that can be used to ensure the correctness of a simulation involving charged particles in magnetic fields.

Glossary of Key Terms

  • Charged Particle: A subatomic or atomic particle that carries an electric charge (either positive or negative). Examples include electrons, protons, alpha particles, and ions.
  • Uniform Magnetic Field: A magnetic field that has the same magnitude and direction at all points in a given region of space. Represented by equally spaced parallel field lines.
  • Trajectory: The path followed by a moving object through space as a function of time.
  • Lorentz Force: The force exerted on a charged particle moving in an electromagnetic field. The magnetic component of the Lorentz force is given by F = q(v × B).
  • Equations of Motion: Mathematical equations that describe the behavior of a physical system in terms of its motion as a function of time. For a charged particle in a magnetic field, these are derived from Newton's second law and the Lorentz force.
  • Analytical Solution: A solution to a mathematical problem expressed in terms of known functions and mathematical operations. It provides an exact solution.
  • Numerical Method: A procedure for finding approximate solutions to mathematical problems using numerical calculations, often implemented with computers. Examples include the Euler method and Runge-Kutta methods for solving differential equations.
  • Pseudo-code: A high-level, informal description of the steps of an algorithm or computer program, intended for human readability rather than machine execution.
  • Differential Equation Solver: A numerical algorithm or software tool used to find numerical solutions to differential equations.
  • Validation: The process of determining the degree to which a model or simulation is an accurate representation of the real world from the perspective of the intended use. In this context, it involves comparing numerical results with known analytical solutions.
  • Alpha Particle (α-particle): A positively charged particle consisting of two protons and two neutrons, identical to the nucleus of a helium atom.
  • H⁻ Ion: A hydrogen atom that has gained an extra electron, resulting in a net negative charge.
  • Cyclotron Period: The time taken for a charged particle to complete one circular path in a uniform magnetic field when its velocity is perpendicular to the field.
  • Euler Time Steps: In the Euler method, the discrete intervals of time (dt) used to approximate the solution of a differential equation. The smaller the time step, generally the more accurate the approximation, but also the longer the computation time.

 Version:

  1. https://www.compadre.org/PICUP/exercises/exercise.cfm?I=111&A=ParticleInMagField
  2. http://weelookang.blogspot.com/2018/06/motion-of-charged-particle-in-uniform.html

Other Resources

[text]

Frequently Asked Questions: Charged Particle Motion in a Uniform Magnetic Field

1. What is the fundamental force governing the motion of a charged particle in a magnetic field?

The fundamental force is the magnetic force, also known as the Lorentz force when considering both electric and magnetic fields. In the case of a purely magnetic field, this force is proportional to the charge of the particle, its velocity, and the strength of the magnetic field. Mathematically, it's given by the cross product of the velocity vector and the magnetic field vector (F=q(v×B)), indicating the force is always perpendicular to both the velocity and the magnetic field.

2. How does a uniform magnetic field affect the trajectory of a charged particle moving perpendicular to the field?

When a charged particle enters a uniform magnetic field with a velocity perpendicular to the field lines, the magnetic force acts as a centripetal force. This force causes the particle to move in a circular path. The radius of this circular path depends on the particle's mass, charge, velocity, and the strength of the magnetic field (R=mv|q|B).

3. What determines the radius and period of the circular motion of a charged particle in a uniform magnetic field?

The radius (R) of the circular path is directly proportional to the particle's momentum (mv) and inversely proportional to the magnitude of its charge (|q|) and the magnetic field strength (B). The period (T) of the circular motion, which is the time it takes for one complete revolution, is given by T=2πRv=2πm|q|B. Notably, the period is independent of the particle's velocity.

4. If a charged particle enters a uniform magnetic field with a velocity that has a component parallel to the field, what will its trajectory be?

In this scenario, the component of the velocity parallel to the magnetic field experiences no magnetic force and thus remains constant, resulting in uniform motion along the field lines. The component of the velocity perpendicular to the field will still cause circular motion. The combination of these two motions results in a helical trajectory, where the particle moves in a circle while simultaneously drifting along the direction of the magnetic field.

5. How do the properties of the charged particle (charge and mass) affect its motion in a uniform magnetic field?

The charge and mass of the particle significantly influence its trajectory. The radius of curvature is directly proportional to the mass and inversely proportional to the charge magnitude. The direction of the force (and thus the sense of rotation for perpendicular motion) depends on the sign of the charge. For particles with the same initial velocity entering the same magnetic field, a heavier particle will have a larger radius of curvature, and a particle with a larger charge will have a smaller radius of curvature. The sign of the charge determines the direction of the circular motion (clockwise or counterclockwise).

6. What are the equations of motion for a charged particle in a uniform magnetic field, and how can they be solved?

The equations of motion are derived from Newton's second law (F=ma) where the force F is the magnetic force q(v×B). This results in a set of coupled differential equations for the components of the velocity and position. These equations can sometimes be solved analytically, especially in cases with simple initial conditions and a uniform field aligned with one of the coordinate axes. For more complex scenarios or non-uniform fields, numerical methods are often employed to approximate the trajectory by taking small time steps and iteratively updating the particle's velocity and position.

7. Why are numerical methods important for studying the motion of charged particles in magnetic fields?

While analytical solutions exist for simple cases like motion in a uniform magnetic field, many real-world scenarios involve non-uniform magnetic fields (e.g., the Earth's magnetic field or fields produced by complex magnet configurations). In these situations, finding analytical solutions becomes very difficult or impossible. Numerical methods, such as the Euler method used in the provided code, allow us to approximate the trajectories by breaking the motion into small time intervals and using iterative calculations based on the Lorentz force at each step. This enables the study of particle motion in more realistic and complex magnetic field environments.

8. How does the simulation tool described help in understanding the motion of charged particles in magnetic fields?

The JavaScript simulation applet provides a visual and interactive way to understand the concepts related to charged particle motion in magnetic fields. Students can potentially modify parameters such as the type of particle (e.g., alpha particle, H- ion), initial velocity, and magnetic field strength to observe the resulting trajectories in real-time. This hands-on approach allows for a deeper intuitive understanding of how different factors influence the particle's path, including the circular or helical nature of the motion, the radius of curvature, and the effect of the charge sign. The exercises accompanying the simulation also encourage students to predict, calculate (analytically and numerically), and validate the particle's motion.

0.5 1 1 1 1 1 1 1 1 1 1 Rating 0.50 (1 Vote)