# How to Break Coupled ODEs down to first order for Runge-Kutta

My question might seem a bit simple. I am trying to solve a system of ODEs using Runge-Kutta method. I am having difficulty breaking down the equations into a system of first order ones required before applying RK45 to it because there is a third order differential of the same parameter "F" in both equations which I am not used to.

Equation 1 $$\left( {\frac {{\rm d}^{2}}{{\rm d}{\eta}^{2}}}F \left( \eta \right) \right) ^{n-1}{\frac {{\rm d}^{3}}{{\rm d}{\eta}^{3}}}F \left( \eta \right) +{\frac {2\,n+2+ \left( 2\,n-1 \right) kF \left( \eta \right) {\frac {{\rm d}^{2}}{{\rm d}{\eta}^{2}}}F \left( \eta \right) }{n+4}}-{\frac { \left( n+2+ \left( n+1 \right) k \right) \left( {\frac {\rm d}{{\rm d}\eta}}F \left( \eta \right) \right) ^{2 }}{n+4}}+G \left( \eta \right) =0$$

Equation 2

$${\frac { \left( {\frac {{\rm d}^{2}}{{\rm d}{\eta}^{2}}}F \left( \eta \right) \right) ^{n-1} \left( n-1 \right) \left( {\frac {{\rm d}^{3 }}{{\rm d}{\eta}^{3}}}F \left( \eta \right) \right) {\frac {\rm d}{ {\rm d}\eta}}G \left( \eta \right) }{\Pr\,{\frac {{\rm d}^{2}}{{\rm d} {\eta}^{2}}}F \left( \eta \right) }}+ \left( {\frac {{\rm d}^{2}}{ {\rm d}{\eta}^{2}}}F \left( \eta \right) \right) ^{n-1}{\frac { {\rm d}^{2}}{{\rm d}{\eta}^{2}}}G \left( \eta \right) +{\frac {2\,n+2+ \left( 2\,n-1 \right) kF \left( \eta \right) {\frac {\rm d}{{\rm d} \eta}}G \left( \eta \right) }{n+4}}-{\frac {n+2\, \left( n+1 \right) k \left( {\frac {\rm d}{{\rm d}\eta}}F \left( \eta \right) \right) G \left( \eta \right) }{n+4}}=0$$

Boundary Conditions

$$G \left( 0 \right) =1, F \left( 0 \right)=F' \left( 0 \right) =0,G \left( \infty \right) =0,F' \left( \infty \right) =0$$

Any help would be greatly appreciated.

• Out of curiosity, is there any physical meaning behind these equations? They look pretty arbitrary to me. I tried several times to change variables and make it more simpler but it fails with no luck... There are some patterns in these two equations that encouraged me to try make it simpler or write it down as a system of first-order ODEs but at least I can't get it... Are you sure the constants in these two equations are written correctly? For example you have: $\frac{n+2+(n+1)k}{n+4}$ and $\frac{n+2(n+1)k}{n+4}$, which looks pretty similar but not exactly the same... – Alone Programmer Oct 3 '19 at 21:24
• If you are using RK45, you are not going to be able to enforce the boundary conditions at $\infty$. You are going to have to get lucky with your choice of initial data – whpowell96 Oct 3 '19 at 23:43

The usual trick is to add more variables that represent the successive derivatives, as in the equations of motion pf physics written as a set of first order ODE of "2" variables: \begin{align}\dot{x}&=v\\ \dot{v}&=a(x,t)\end{align} instead of a second order ODE of 1 variable $$\ddot{x}=a(x,t) \ .$$ The dot represents the time derivative.

So, applying to your case, you could have Equation 1 as: \begin{align} x & = \frac{d F}{d \eta}\\ y & = \frac{d x}{d \eta} \\ 0 & = y^{n-1}\frac {d y}{d \eta} + \frac{2n+2 + (2n-1) k F y}{n+4} - \frac { (n+2 + (n+1) k) x^2}{n+4} + G(\eta) \end{align} Note that $$y = \frac{d x}{d \eta} = \frac{d^2 F(\eta)}{d \eta^2}$$ and that the last equation can easily be written as $$\frac{d y}{d \eta} = \ldots$$

Equation 2 can have similar substitutions together with the previous ones: \begin{align} u & = \frac{d G}{d \eta}\\ v & = \frac{d u}{d \eta} \\ 0 & = \frac{y^{n-1} (n-1) \frac{d y}{d \eta} u }{\Pr\,y} + y^{n-1} v + \frac {2n+2 + (2n-1) k F u}{n+4} - \frac {n+2 (n+1) k x G}{n+4} \end{align} And the last equation can also be written as $$\frac{d y}{d \eta} = \ldots$$

This means that you will have 4 virtual new variables: $$x$$, $$y$$, $$u$$ and $$v$$.

Edit:

Looking at the number of boundary conditions, since you have 5, you might want to have 5 variables. Depending on your problem, you may write Equation 2 as: \begin{align} u & = \frac{d G}{d \eta}\\ 0 & = \frac{y^{n-1} (n-1) \frac{d y}{d \eta} u }{\Pr\,y} + y^{n-1} \frac{d u}{d \eta} + \frac {2n+2 + (2n-1) k F u}{n+4} - \frac {n+2 (n+1) k x G}{n+4} \end{align} The difference is in the second parcel, where we have $$\frac{d u}{d \eta}$$ and we no longer need to have $$v$$.

And then, plug in the expression you got for $$\frac{d y}{d \eta}$$ in the last equation and solve it for $$\frac{d u}{d \eta} = \ldots$$

Hence, you'll get a system with 5 (first order) ODE and 5 boundary conditions.