# Runge-Kutta ODE Solver

please keep in mind that the following is homework, I do not want answers, only help. If you are confused as to what I refer to in this question, or I don't make any sense, please refer to the link below.

This is my assignment

I'm trying to plot the path of a firework that weighs $.0008 kg$ and has a density of $1900 kg/m^3$, and has a burn rate of $0.0027 kg/s$ in 2d using java. The firework has a launch velocity of $22 m/s$. The only force acting on the x-axis is the drag force, and wind velocity which I can change.

The forces acting on the x axis are: -the initial velocity $22 m/s$

-the drag force

-gravity $9.807 m/s^2$

-the wind force: anywhere from $-15$ to $15$

The drag force is computed by $F_D=(pvAC_D)/2$

$p$=fluid density$=1.2 kg/m^3$

$v$=velocity magnitude

$A$=cross sectional area$=0.00046140621$

$C_D$=drag coefficient$=.4$

Without any wind acting on the x axis, the velocity magnitude is merely: $\sqrt(22^2+0^2)=484$ Now using the formula: $F_D=(pvAC_D)/2$ we get: $F_D=(1.2*484*0.0004614*.4)/2=.05359$

Now we also add the mass times the gravity(9.8m/s^2)to get our total force on the y axis.

$F_y=-mg-F_D(v_y/v)$ ($v_y$, the velocity of y, is the same as v, the velocity magnitude, since the x axis velocity is 0, so $v_y/v=1$)

Which translates to $F_y=-0.0008*9.8-.5359*(1)=-.54374$

So there is a total of .54374 downwards force on the y axis.

My professor then says to use the Runge-Kutta ODE solver to find the velocity of $x_k+1$ and $y_k+1$ but I'm not sure how to interpret the Runge-Kutta solver into the formulas that I've already been given.

To conclude, I know the initial downward force on the object, I know that it has an initial velocity of 22 meters/s, and I know that the mass will be reducing as my path increases. I don't want to know the wind force at this time, as I want to add that in afterwards.

Could someone please help me understand how the Runge-Kutta ODE solver applies to this assignment?

The total force being placed on the sphere for each axis is as such: $F_x=-F_D(v_x/v)$ and $F_y=-mg-F_D(v_y/v)$

quoting the assignment: "Since force equals mass times acceleration and acceleration is the first differential of velocity with time, these two equations can be expressed as two differential equations:"

$dv_x/dt=(F_Dv_x/mv)$ and $dv_y/dt=-g(F_Dv_y/mv)$

"These two ordinary differential equations cannot be solved using algebra, so we are going to have to resort to a numeric technique." AKA Runge-Kutta

-

Edit: Hmm, let me try it this way (I do not want to solve your HW :-)): you want to solve $$z' = f(z),$$ where $z$ is a vector of unknown functions, let there be $n$ of them, and $f:\mathbb{R}^n\to\mathbb{R}^n$. The corresponding RK4 scheme (one of many RK methods available) works in the following way. Let $h$ be a small parameter (time step size) and let $z_0\in\mathbb{R}^n$ and $t\in\mathbb{R}$ be given. Then compute $$z_1 = z_0 + \frac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4), \quad t_{1} = t_0 + h,$$ where $$k_1 = h f(z_0), \ k_2 = hf(z_0 + \frac{1}{2}k_1), \ k_3 = f(z_0 + \frac{1}{2}k_2), \ z_4 = h f(z_0 + k_3).$$ This gives you a mapping $z_0 \mapsto z_1$. $z_0$ are the initial data at $t$ and $z_1$ is an approximation of the solution at time $t+h$. Now you just have to iterate this map over and over again. That is, you take $z_1$ instead of $z_0$ and compute $z_2$, etc.
In your case the unknowns are $z=(x,y,v_x,v_y)$. You have $x' = v_x$, $y' = v_y$, $v_x' = \cdots$, $v_y' = \cdots$. So if we denote $f=(f_1,f_2,f_3,f_4)$ then for example $f_1(x,y,v_x,v_y) = v_x$. You have to find the other componentes, write down this iterative scheme (essentially a simple loop where you record values at each iteration) and you are done.
Ok. So now you have to set up the RK numeric scheme. It is written in your assignment. You just have to find what the $f$ functions are in this case. –  kalvotom Sep 29 '12 at 23:16
What I'm doing right now is taking the RK and applying it to $V_y$, then subtracting the drag force from it. Does that sound right? –  Unknown Sep 30 '12 at 0:37