I'm still a high school student and I'm undergoing a project which involves solving the following differential equations. Is it possible to use runge kutta 4th order method to solve the following. I see that u can use runge kutta method easily if its $\frac{dv_{x}}{dv_{y}} or \frac{dv_{y}}{dv_{x}}$, but in this case it is $\frac{dv_{x}}{dt} and \frac{dv_{y}}{dt}$. The initial conditions are $ t=0, v_x=0, v_y=0$ \begin{align} \frac{dv_{x}}{dt} &= -kv_y\sqrt{v_x^2 +v_y^2} -bv_x\sqrt{v_x^2 +v_y^2}\\ \frac{dv_{y}}{dt} &= kv_x\sqrt{v_{x}^2 + v_{y}^2} - bv_y\sqrt{v_x^2 + v_y^2}-mg \end{align} to get out a function of $ v_x (t) $ and $ v_y (t)$. Please tell me if I'm lacking any information as I'm new to this blog.

  • $\begingroup$ Yes, see: math.stackexchange.com/questions/721076/… $\endgroup$
    – Moo
    Jun 19, 2017 at 4:06
  • $\begingroup$ Thanks that link was super helpful $\endgroup$ Jun 19, 2017 at 4:49
  • $\begingroup$ One should in general avoid the component-wise implementation. For 2 components it is okay, but it gets doubly confusing if you want to integrate the position along with the velocity. In a vector based code, you just extend the derivatives function. A nice example in Python code is stackoverflow.com/questions/27791336/… $\endgroup$ Jun 19, 2017 at 7:04

1 Answer 1


Sure. You have two coupled differential equations. Runge-Kutta will work fine for this. Write $\vec v= \begin {pmatrix} v_x \\ v_y \end {pmatrix}$ and you have $\frac d{dt}\vec v =f(\vec v)$ to solve. When Runge-Kutta asks for a derivative at certain conditions, you can calculate it.

  • $\begingroup$ Thanks alot this is working and is it possible if u type up the OCTAVE code for me. just leave constants for example k and b in this case as k= , b =. I want to check if my result is consistent with the computer $\endgroup$ Jun 19, 2017 at 6:46
  • $\begingroup$ I know nothing about OCTAVE. There should be a canned Runge-Kutta package available. $\endgroup$ Jun 19, 2017 at 14:04
  • $\begingroup$ By the way just curious how do we classify the order and type of my diffential equation. For what i know it's non -linear and how can I tell if its 4th order when there are two simultaneous equations $\endgroup$ Jun 29, 2017 at 0:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .