Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I apply

$${d\,v_x\over d\,t} ={FDv_x\over mv} \text{ and } {d\,v_y \over d\,t}=−g{FDv_y\over mv}$$

to the function of $f$ in the Runge Kutta ODE solver:


$q2=f(v_yk+(\bigtriangleup t*q1)/2)$

$q3=f(v_yk+(\bigtriangleup t*q2)/2)$

$q4=f(v_yk+\bigtriangleup t*q3)$

$v_k+1=v_k+(\bigtriangleup t/6)*(q1+q2+q3+q4)$

I'm not sure what the $f$ function should do.

share|cite|improve this question
Runge-Kutta for ODE system, in C (on page 5). – user31373 Oct 1 '12 at 1:07
up vote 2 down vote accepted

I am not sure I am interpreting your notation correctly. If what you have is the derivatives of $v_x$ and $v_y$ (perhaps x and y components of velocity) with respect to $t$ (time), and the $v$ in the denominators of your right hand sides is the speed (the magnitude of the velocity $\sqrt(v_x^2+v_y^2)$), then the way to use the Runge-Kutta formula is to use a vector valued function $f(v,t)$ whose first entry is the right hand side of your first formula, and whose second entry is the right hand side of the second formula. You would also need to know the values of $F$, $D$ and $m$ (as well as $g$). Each of the $q$'s and $v$'s in the Runge-Kutta rule would then be vectors also. In the last fromula you have $v_k +1$, but you should have $v_{k+1}$, referring to the new value of $v$.

You are right that vectors have direction and magnitude, but, what you need to apply Runge-Kutta here is just how to do the algebra in the formula's for the vectors. Your vectors have two components (an x-component and a y-component). To add two vectors, you just add the corresponding components. If you multiply a vector times a regular number (a scalar) you just multiply each of its components by that scalar. So, what you need to do to apply Runge-Kutta to your system of differential equations is evaluate the $f(v)$ whose two components are $(FD/(mv))v_x$ and $-g(FD/(mv))v_y$ in order to find the values of the $q$'s and of $v_{k+1}$. When you have found $v_{k+1}$, its first entry will be the new value of $v_x$ at $t+\Delta t$ and its second entry will be the new value of $v_y$. You may want to check to make sure your differential equations are correct. They are not dimensionally consistent. ($v_x$ and $v_y$ should be in the same units, but the equations differ in units by the units of $g$ which is probably acceleration.

In programming terms, the vectors are arrays.

share|cite|improve this answer
yes all of that is correct. the value of FD is $FD=(1.2∗484∗0.0004614∗.4)/2$ $m=.0008$ $g=9.807$ Is this helpful? – Unknown Sep 30 '12 at 2:25
Also, what is the syntax to add +1 to the subscript $V_x$? – Unknown Sep 30 '12 at 2:28
To write the subscript $k+1$ use curly braces around the $k+1$ to group. I.e. write V_{k+1} Do you know what it means to have the $f$ and the $q$'s be vectors? – Robert Indik Sep 30 '12 at 3:13
meaning $f$ and $q$ would have directions? – Unknown Sep 30 '12 at 3:25
My knowledge of physics and calculus is low, this is for computer science. – Unknown Sep 30 '12 at 3:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.