# Can runge kutta method solve this equation?

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.

• – Moo
Jun 19, 2017 at 4:06
• Thanks that link was super helpful Jun 19, 2017 at 4:49
• 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/… Jun 19, 2017 at 7:04

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.