# Help with using the Runge-Kutta 4th order method on a system of three first order ODE's.

The original ODE I had was $4f‴ + ff″ + 2(f′)² = 0$ with $f(0)=0, f′(0)=0$ & $f′(∞)=0$

I wish to use the 4th order Runge-Kutta method, so I have the system of three 1st order equation as below:

$$u′=v$$ $$v′=w$$ $$w′= - ¼uw -½v²$$

where $u=f, v=f′=df/dη, w=f″$

and now the initial values are $u=0$ & $v=0$.

My problem is I am struggling to apply this method to my system of ODE's so that I can program a method that can solve any system of three first order ODE's. I would like for someone to please run through the step of the method, so I can understand it better. Optional: It would be very nice if anyone write down the MATLAB code for me.

• web.mit.edu/voigtlab/BP205/Notes/BP205_Matlab_slides.pdf – Michael Medvinsky Nov 18 '15 at 11:08
• This blog post from the MathWorks might help you. Writing the code is your job. Show us what you've tried, detail what went wrong, and ask a specific question. If this is primarily a Matlab programming question, rather than a math question, then it is likely off-topic for this site. – horchler Nov 18 '15 at 15:54
• No, this is not a Matlab programming question. i want to know the steps of 4th order Runge Kutta method to solve any system of three first order ODE's. That's it. – Md. Taj Uddin Raju Nov 19 '15 at 2:03

Matlab has good differential equations solvers for initial-value problems, such as ode45. No need for implementing Runge-Kutta yourself, although it's simple enough to do. The trouble is going to be with your "boundary value" $f'(\infty) = 0$. In general a condition such as that is going to be very hard to check numerically (you aren't really going to integrate out to $t=\infty$), and might be true for all solutions starting in a certain region or for no solutions at all.
In this case, it's rather blatantly obvious that $f = 0$ is a solution; I haven't checked if there are others.
EDIT: From some numerical experiments (I used Maple rather than Matlab), it appears that the solution with $f(0)=0$, $f'(0)=0$, $f''(0) = c$ will satisfy your condition $f'(\infty) = 0$ (in fact will rather rapidly approach a constant) if $c \ge 0$, but if $c < 0$ the solution will go to $-\infty$ in finite time. For example, here's the plot for $c = 0.01$
and here is $c = -0.01$