# Iterative solution for particle in magnetic field

I have some questions relating movement of a particle calculating with mathematica.

A particle (mass: m, charge: q) moves on x-axis from left with speed $$v_0$$ to a magnetic field $$\vec{B} = (0,0,B)$$. Entry is at $$\vec{r}(t=0)=(0,0,0)$$.

1. How would equation of movement look like for this problem ?

I tried this:

In[23]:= r[t_] := {x[t], y[t], z[t]}

In[24]:= electricField = 0, Efield, 0;

In[24]:= magneticField = 0 {0, 0, Bfield};

In[26]:= force = q (electricField + Cross[r'[t], magneticField]);

In[27]:= DSolve[{m r''[t] == force, r[0] == {0, 0, 0},
r[0] == {v1, v2, v3}}, r[t], t] //. {Bfield -> m \[Omega] / q,
Efield -> V Bfield} // ExpandAll // Simplify


During evaluation of In[27]:= DSolve::bvnul: For some branches of the general solution, the given boundary conditions lead to an empty solution.

Out[27]= {}

In[16]:= Clear[eqns]

In[29]:= eqns = Map[Thread, {m r''[t] == force, r[0] == {0, 0, 0},
r'[0] == {v1, v2, v3}}] //. {Bfield -> m \[Omega] /q,
Efield -> V Bfield} // ExpandAll // Simplify

Out[29]= {{electricField q == m (x^\[Prime]\[Prime])[t],
electricField q == m (y^\[Prime]\[Prime])[t],
electricField q == m (z^\[Prime]\[Prime])[t]}, {x[0] == 0,
y[0] == 0, z[0] == 0}, {v1 == Derivative[1][x][0],
v2 == Derivative[1][y][0], v3 == Derivative[1][z][0]}}

In[31]:= solution1 =
Dsolve[eqns, {x[t], y[t], z[t]}, t] // ExpandAll // Simplify

Out[31]= Dsolve[{{electricField q == m (x^\[Prime]\[Prime])[t],
electricField q == m (y^\[Prime]\[Prime])[t],
electricField q == m (z^\[Prime]\[Prime])[t]}, {x[0] == 0,
y[0] == 0, z[0] == 0}, {v1 == Derivative[1][x][0],
v2 == Derivative[1][y][0], v3 == Derivative[1][z][0]}}, {x[t],
y[t], z[t]}, t]

1. When we start with $$\vec{r}^{(0)}(t)=q(v_0t,0,0)$$ as zeroth approximation and insert it in Lorentz-force, how would equation of movement look like ?

How can I write a routine that automatises this iteration till 6 iterations ? I read about "Nest" command but how to use it ?

1. Charged particles describe circuits in homogenous magnetic field. How can I find exact solution with mathematica and see what angular frequency and radius they have ? There should be a possibility to develop exact solutions in power of $$B$$, how tovisualise it with mathematica ?

Change In[27] to

DSolve[{m r''[t] == force, r[0] == {0, 0, 0},r'[0] == {v0, 0, 0}} //. {Bfield -> m \[Omega]/q,Efield -> V Bfield}, r[t], t]
(*{{x[t] -> (t V \[Omega] - V Sin[t \[Omega]] + v0 Sin[t \[Omega]])/\[Omega],
y[t] -> (1/\[Omega])(-v0 - V Cos[t \[Omega]] + v0 Cos[t \[Omega]] +V Cos[t \[Omega]]^2 + V Sin[t \[Omega]]^2), z[t] -> 0}}*)


and MMA finds a unique solution.

• Thank you Ulrich so far. Has someone an idea how to realize 2. or 3. In mathematica? Would be very thankful!
– Tom
Jun 3, 2019 at 12:44
• Please explain your iteration idea in more detail. Do you want to restrict the movement of q along x-axis with const. velocity v0? Jun 3, 2019 at 12:53
• the idea is to start iteration with fast but limited speed $v_0$ in $\vec{r}^{(0)}(t)=q(v_0t,0,0)$. Result should be inserted in Lorentz force, so equation of movement would be solved. This solution is first approximation $\vec{r}^{(1)}(t)$. In this case, I´m looking for a routine that automates this iteration (6 x). Should be realized by Nest command but I don´t get it.
– Tom
Jun 3, 2019 at 13:23
• That means, the 0. iteration is what I evaluated in my answer. DSolve gives the timedependent solution. What means "result should be inserted" ? Jun 3, 2019 at 13:40
• Ah ok. Means to start with $\vec{r}^{(0)}(t)=q(v_0t,0,0)$ as 0. iteration and apply this to Lorentz-force for solving equation of movement which is 1.iteration. now a routine is needed, that automats this iteration 6 times with "Nest".
– Tom
Jun 3, 2019 at 14:10