Rewriting system of second order differential equation as system of first order

140 Views Asked by At

Given a charged particle moving in an electromagnetic field. We have $N$ amount of point charges placed in $\mathbb{R}^2$ on the coordinates $p_i$. We also have a free particle moving in $\mathbb{R}^2$ that is affected by the electromagnetic forces done by the points.
The position of this particle with respect to time is given by the vector $r(t)=(x(t),y(t))$, which satisfies the system of differential equations: $$\ddot{r}(t) = c\cdot\sum_{i=1}^{N}\frac{r-p_i}{||r-p_i||^3}$$ Where $c\in \mathbb{R}$. We have to rewrite this system of differential equations as a first order one by introducing the help function $q(t) = \dot{r}(t)$. We can then create a vector $y(t) = (r,q)$ which satisfies the system of first order differential equations $\dot{y} = f(t,y)$.
I managed to rewrite this system and got: $$r= (x(t),y(t))\\ q = \dot{r}\\ \dot{q} = c\cdot\sum_{i=1}^{N}\frac{r-p_i}{||r-p_i||^3}\\ y = (r,q)\\ \dot{y} = (q,\dot{q})$$ But I can't find $q(t)$ which is required to find $\dot{y}$ (which I have to translate into python code later). I tried doing $\frac{d\dot{q}}{dt} = c\cdot\sum_{i=1}^{N}\frac{r-p_i}{||r-p_i||^3}$ and integrating getting: $$q(t) = \int \frac{(x(t),y(t))-(p_1,p_2)}{\left(\sqrt{(x-p_1)^2 +(y-p_2)^2} \right)^3} \ dt$$ But I don't have $(x(t),y(t))$ nor do I have any idea on how to integrate this. What am I doing wrong?