# Solving Nonlinear ODE: magnetism with varying particle charge

1. Mar 2, 2014

### Eloise

Hello.

I have a set of ODE where
1) $$\frac{dv_x}{dt}=\frac{q(t)B}{m}v_y$$
2) $$\frac{dv_y}{dt}=\frac{q(t)B}{m}v_x$$
3) $$\frac{dv_z}{dt}=0$$

Following the strategy to solve a simple harmonic oscillator,
I differentiate (1) to get
4) $$\frac{d^2v_x}{dt^2}=\frac{q(t)B}{m}\frac{dv_y}{dt}+q'(t)v_y$$

and substitute (1) and (2) into it to get
5) $$\frac{d^2v_x}{dt^2}=(\frac{q(t)B}{m})^2v_x+\frac{q'(t)}{q(t)}\frac{dv_x}{dt}$$

which involve only functions of $t$ and $x$.
The initial position of the particle is at the origin.
I do not know if this is the correct way. I should solve it by inspired guessing?

Thank you very much.

Last edited: Mar 2, 2014
2. Mar 2, 2014

### hilbert2

ยจ
Shouldn't that be $\frac{d^2v_x}{dt^2}=\frac{q(t)B}{m}\frac{dv_y}{dt}+\frac{q'(t)B}{m}v_y$? Otherwise your method is correct, but you have to know the function $q(t)$ to solve the equation. The equation is not nonlinear, by the way.

3. Mar 2, 2014

### pasmith

I think, starting from
$$m\frac{d\vec v}{dt} = q(t)(\vec v \times \vec B)$$
with $\vec B = (0, 0, B)$, that you should have a minus sign on the right hand side of (2) above.

I don't think that helps you here.

It's generally best to keep a first order linear system (which yours is) as a first order system rather than turn it into a second order system.

$$\frac{dv_x}{dt} = f(t)v_y \\ \frac{dv_y}{dt} = f(t)v_x$$
Now if you set $u_1 = v_x + v_y$ and $u_2 = v_x- v_y$ then you have
$$\frac{du_1}{dt} = f(t)u_1 \\ \frac{du_2}{dt} = -f(t)u_2$$
and those first-order equations are separable and can be solved.

Alternatively, you can make the inspired guess that
$$v_x(t) = v_x(0) \cosh(F(t)) + v_y(0) \sinh(F(t)), \\ v_y(t) = v_y(0) \cosh(F(t)) + v_x(0) \sinh(F(t)).$$
for a suitable $F(t)$ with $F(0) = 0$, which is prompted by the observation that
$$\frac{d}{dt} \cosh(t) = \sinh (t), \\ \frac{d}{dt} \sinh(t) = \cosh (t)$$
so that if
$$P(t) = C \cosh(t) + D \sinh(t) \\ Q(t) = D \cosh(t) + C \sinh(t)$$
then
$$\frac{dP}{dt} = Q \\ \frac{dQ}{dt} = P$$
which is almost your system, but to get the factor of $f(t)$ on the right of each equation we have to exploit the chain rule and instead set
$$P(t) = C \cosh(F(t)) + D \sinh(F(t)) \\ Q(t) =D \cosh(F(t)) + C \sinh(F(t))$$
so that now
$$\frac{dP}{dt} = F'(t)Q \\ \frac{dQ}{dt} = F'(t)P$$
which is your system. Only $F'$ is forced on us, so we can choose $F(0)$ to be whatever we want, and the choice $F(0) = 0$ is convenient, since then $P(0) = C$ and $Q(0) = D$.

I assume $v_x$ and $v_y$ are components of velocity, so you need to specify an initial velocity as well.

4. Mar 2, 2014

### hilbert2

Actually, in my classical mechanics textbook, the trajectory of a charged particle in constant magnetic field is solved in that fashion (differentiating to increase the order of the system). That's the "brute force" method to solve the problem.

5. Mar 2, 2014

### pasmith

And it makes things easier only in the constant-coefficient case, which is not this case.

6. Mar 4, 2014

### Eloise

Thank you very much. I didn't thought of using hyperbolic functions. Thanks again for helping.