# Calculating time derivative of Magnetic force

1. May 4, 2010

### Sagekilla

Hi all, I ran into a bit of an issue trying to figure out how to properly differentiate the magnetic force due to particle interactions. To be specific, I'm actually looking for the time derivative of acceleration (jerk) due to the magnetic force, but it's essentially the same problem.

For the record, this is not homework at all. It's something I require for a n-body simulation I'm doing, and I need to calculate jerk to do higher order integrations.

I know that the magnetic force is, in expanded form:
$$\vec{F} = \frac{\mu_{0} q_{1} q_{2}}{4\pi r^{2}} \vec{v_{1}} \times (\vec{v_{2}} \times \hat{r}) = \frac{\mu_{0} q_{1} q_{2}}{4\pi r^{2}}((\vec{v_{1}} \cdot \hat{r}) \vec{v_{2}} - (\vec{v_{1}} \cdot \vec{v_{2}}) \hat{r})$$

Where r-hat is the unit vector pointing from particle 2 to particle 1, and r is the distance between the two particles.

I don't even know where to begin to do this. I understand I need the chain rule but when I tried doing the same for a simpler vector (gravitational acceleration), the actual result ended up having a bunch of dot products in there that I had no idea how to get.

Can anyone guide me in the right way?

2. May 4, 2010

### kcdodd

When you do the chain rule you will get, in addition to the derivative of velocity, derivatives of r and r_hat. I suppose you are asking what those will be. You start by writing them out as the particle position vector:

$$\vec{r} = \vec{r_1} - \vec{r_2}$$

$$\hat{r} = \frac{\vec{r_1} - \vec{r_2}}{|\vec{r_1} - \vec{r_2}|}$$

when you take the time derivative of these you get derivatives of the position vectors, which is also the velocity of the particle.

3. May 4, 2010

### Sagekilla

Well, if I start with something simple like the position unit vector:

$$\frac{d}{dt}\hat{r} = \frac{d}{dt}\frac{\vec{r_{1}} - \vec{r_{2}}} {| \vec{r_{1}} - \vec{r_{2}} |}$$

$$\frac{d}{dt}\hat{r} = \frac{|\vec{r_{1}} - \vec{r_{2}}| (\vec{v_{1}} - \vec{v_{2}}) - |\vec{r_{1}} - \vec{r_{2}}|'(\vec{r_{1}} - \vec{r_{2}}) } {|\vec{r_{1}} - \vec{r_{2}}|^{2}}$$

My problem here is: How do I differentiate the |r1 - r2| properly?

4. May 4, 2010

### kcdodd

sorry, i will try to derive it here

if

$$r^2 = \vec{r}\cdot\vec{r}$$

then

$$\frac{dr^2}{dt} = \frac{d\vec{r}}{dt}\cdot\vec{r} + \vec{r}\cdot\frac{d\vec{r}}{dt} = 2\frac{d\vec{r}}{dt}\cdot\vec{r}$$

$$r = \sqrt{r^2}$$

so,

$$\frac{dr}{dt} = \frac{1}{2\sqrt{r^2}}\frac{dr^2}{dt} = \frac{1}{r}\frac{d\vec{r}}{dt}\cdot\vec{r} = \frac{d\vec{r}}{dt}\cdot\hat{r}$$

where

$$\hat{r} = \frac{\vec{r}}{r}$$

$$\frac{d\hat{r}}{dt} = \frac{d\vec{r}}{dt}\frac{1}{r} - \frac{\vec{r}}{r^2}\frac{dr}{dt}$$

finally

$$\frac{d\hat{r}}{dt} = \frac{1}{r}(\frac{d\vec{r}}{dt} - (\frac{d\vec{r}}{dt}\cdot\hat{r})\hat{r})$$

and substitute in the vector r_1 - r_2 for r.

5. May 4, 2010

### Sagekilla

Ah, thank you. My biggest issue with differentiating the above equations was trying to figure out how the the norm of a vector would differentiate with respect to a variable.

I'll work these out and post my results.