# Can I use Runge-Kutta to solve these two equations?

I have derived the following two equations:

$$69ru\frac{du}{dr}=8r^2\omega^2-16r\omega v-21u^2+48v^2-\frac{480\pi^2\nu r^3u^3}{Q^2}$$

$$48ru\frac{dv}{dr}=-21r(v-r\omega)\frac{du}{dr}-69uv+37r\omega u+\frac{480\pi^2\nu r^3u^2(v-r\omega)}{Q^2}$$

I want to solve them simultaneously for $u(r)$ and $v(r)$, and initial conditions of $u(r_0)$ and $v(r_0)$ are known.

How to use the Runge-Kutta method is not my question. I've used it in the past and know how it works. My question/problem comes from the $\frac{du}{dr}$ term in the 2nd equation. Without that term I could just solve the two equations simultaneously using Runge-Kutta quite easily. But with it I'm having trouble understanding the best way to solve it. I could simply solve the first equation for $\frac{du}{dr}$ and substitute it into the second equation, but that would make the formulation really messy and I'd like to avoid that. Is there a way I could introduce a simple 3rd equation to deal with that? I'm thinking of something similar to how when you solve a 2nd degree ODE like $y''=f(x)$ using the Rung-Kutta method you split it into two equations:

$$y_1'=y_2$$

$$y_2'=f(t)$$

However I'm having trouble coming up with a formulation that would let me do that.

• Yes, you can use Runge-Kutta methods. By moving that term to the left, you get the system of odes $A\frac{d\mathbf{y}}{dt}=\mathbf{f}$. If you were using MATLAB to solve this, the $A$ is called the mass matrix (I think). Alternatively, you could multiply through by $A^{-1}$. – Daryl Dec 22 '14 at 22:24
• Or just substitute the first equation for $\mathrm du/\mathrm dr$ in the second equation. – David Dec 22 '14 at 22:58
• @Daryl, that's a good idea. I've never had any formal linear algebra (I'm an engineer, naturally), so combining things into a system of linear equations doesn't come naturally to me. I'll see if I can figure it out. – derio Dec 23 '14 at 16:28
• I've worked out the formulation for solving the equations, but when I try and actually solve it the solution blows up on me. I've asked further questions over at Computational Science. – derio Jan 6 '15 at 18:23

Using @Daryl 's suggestion, I will try and solve it using the following form:

$$\textbf{A}=\begin{bmatrix}69\,r\,u_m & 0\\ 21(r\,v_m-r^2\omega) & 48\,r\,u_m \end{bmatrix}$$

$$\textbf{u}=\begin{bmatrix}u_m \\ v_m \end{bmatrix}$$

$$\textbf{f}=\begin{bmatrix} 8\,r^2\omega^2-16\,r\,\omega\,v_m-21{u_m}^2+48{v_m}^2-\frac{480\pi^2\nu}{Q^2}r^3{u_m}^3 \\ -69\,u_m\,v_m+37\,r\,\omega\,u_m-\frac{480\pi^2\nu}{Q^2}r^3{u_m}^2(v_m-r\,\omega) \end{bmatrix}$$

Then the equations are of the form

$$\textbf{A} \frac{d \textbf{u}}{dr}=\textbf{f}$$

I can rearrange this as

$$\frac{d \textbf{u}}{dr}=\textbf{A}^{-1}\textbf{f}$$

And then solve that form using Runge-Kutta (I hope).

## Update

Problem can be solved using Runge-Kutta method, though I needed some help from the Computational Science community to find a sign error. Solution is here.