I know that a force will change the magnitude of velocity if it is at an angle other that 90 degrees. If the force is perpendicular to the velocity it will cause the path of the object to curve and the magnitude will remain constant.

I'm working on a program to model a charged particle in a magnetic field. I'm using the equation for the Lorentz force to calculate the force on the particle but I don't know where to go from there. How does a force vector affect a velocity vector? How can I use a known force and velocity to determine a new velocity?


1 Answer 1


I'm surprised you haven't found this information online because the equation is one of the most basic in all of physics:

$$\mathbf{F} = m\mathbf{a} = m\frac{\mathrm{d}\mathbf{v}}{\mathrm{d}t}$$

(bold represents a vector). For an application like yours, it will be more useful to rearrange this in the form of an evolution equation

$$\frac{\mathrm{d}\mathbf{v}}{\mathrm{d}t} = \frac{\mathbf{F}(\mathbf{v}, t)}{m}$$

There are two ways to handle this.

  1. If the magnetic field configuration is known and is given by a simple function, you may be able to solve the evolution equation analytically. In that case, just program that solution into your code and have the program calculate the position of the particle at each time.
  2. In general, that is not practical, so you will have to investigate the field of numerical integration. Here is a primer: as a crude method of solution, you can replace the derivative operator with a finite difference operator, e.g. for the $x$-component:

    $$\frac{\mathrm{d}v_x}{\mathrm{d}t} \to \frac{v_x(t + \delta t) - v_x(t)}{\delta t}$$

    Plugging this into the evolution equation, you can rearrange it to

    $$v_x(t + \delta t) = v_x(t) + \frac{1}{m}F_x(v_x(t), v_y(t), v_z(t), t)\delta t$$

    Since you have a formula for calculating $F_x$ as a function of $\mathbf{v}$ and $t$, you can use the $x$-velocity at any given time step to calculate an approximation to the $x$-velocity at the next time step, and similarly for the other components. This is called the Euler method for numerical integration. Although it's easy to understand, it's highly unstable - that is, it becomes very inaccurate very quickly, because calculating the velocities and forces only at the beginning of each time step (as opposed to, say, the beginning and end and taking an average) leads to errors that accumulate at each time step.

    There are more sophisticated methods of numerical integration which arrange for the errors to largely cancel out by calculating values of $F_x$ within the time step. Whatever programming language or framework you are using, there is probably a scientific computation library that includes a numerical integrator, which you should look into using. That sort of thing is beyond the scope of this site, however. (Try searching on Stack Overflow)

  • $\begingroup$ I used a method similar to that and it worked good when the force was not perpendicular. when the force is perpendicular the velocity it changes magnitude of the velocity (this should not happen). This happens when I add the initial velocity to to the change in velocity over the interval. How can I add the vectors to alter the direction without affecting the magnitude? $\endgroup$
    – Falko
    Nov 16, 2011 at 18:07
  • $\begingroup$ That's the sort of thing which I was saying is largely outside the domain of this site. But as a first step, make sure you're using a stable integrator (Runge-Kutta 4, in most cases). Beyond that, you can try something like rescaling the magnitude of the velocity after each step, but that would introduce its own errors, and I'm not sure if they would be better or worse than what you're currently doing. $\endgroup$
    – David Z
    Nov 16, 2011 at 18:23
  • $\begingroup$ Thank you so much for your help. I was able to get it all working. I just projected the original velocity onto v(t+δt) and then it worked as expected. :) $\endgroup$
    – Falko
    Nov 16, 2011 at 20:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.