2

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.

  • Yes, see: https://math.stackexchange.com/questions/721076/help-with-using-the-runge-kutta-4th-order-method-on-a-system-of-2-first-order-od?rq=1 – Moo Jun 19 '17 at 04:06
  • Thanks that link was super helpful – Mew Leenutaphong Jun 19 '17 at 04: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 https://stackoverflow.com/questions/27791336/need-help-fixing-my-implementation-of-rk4 – Lutz Lehmann Jun 19 '17 at 07:04

1 Answers1

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.

Ross Millikan
  • 383,099
  • 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 – Mew Leenutaphong Jun 19 '17 at 06:46
  • I know nothing about OCTAVE. There should be a canned Runge-Kutta package available. – Ross Millikan Jun 19 '17 at 14:04
  • 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 – Mew Leenutaphong Jun 29 '17 at 00:50