Working out velocity (including air resistance) For my computing project, I am creating a projectile simulator but I cant seem to get my head round the air resistance. I tried by working out the horizontal and vertical velocity by solving it (vertically and horizontally giving me two equations):


*

*$dv/dt = -cv^2$ (horizontal)

*$dv/dt = -cv^2 - g $ (vertical)


where c is 1/2 (drag co x density x cross sectional area).
But after doing the integrals and finding the equation it doesn't seem to be working as I want them to...
Sorry for the bad formatting.. (Ill try to excuse myself by saying Im new) and thanks for any help
 A: So yeah, there are these things called vectors which represent arrows; they are made up of components. For example, we would not say "velocity (horizontal)" and "velocity (vertical)" but we would add labels $v_x, v_y$ where $x$ is usually a horizontal-label and $y$ is usually a vertical-label; then we would write the arrow as $\vec v = [v_x, v_y]$, packaging them together into this list-of-numbers that we call a "vector".
To get $\propto v^2$ drag in 2D, we form the vector:
$\vec F_{drag} = -k ~ |\vec v| ~ \vec v $
where we understand that multiplying the ordinary number $k$ over a vector $[a, b]$ produces the vector $[k~a, ~k~b]$, and the magnitude of $\vec v$, written as $|\vec v|$ or sometimes simply as $v$, is given by the Pythagorean theorem as
$v = |\vec v| = \sqrt{v_x^2 + v_y^2}.$
In other words, your equations should be:
$\frac{dv_x}{dt} = -k ~ v_x ~ \sqrt{v_x^2 + v_y^2}$
$\frac{dv_y}{dt} =  -g - k ~ v_y ~ \sqrt{v_x^2 + v_y^2}$
This ensures that your drag force always points in the reverse direction from $\vec v$, and grows like $v^2$.
You can also include a wind $w$ in the $x$-direction by replacing (on the right hand side only!) $v_x$ with $(v_x - w)$. This is important because the drag force is relative to the air, not relative to the ground. With a little more effort you can draw a wind vector field $\vec w(x, y)$ and do modeling with "updrafts" and so forth.
A: You made a mistake in the direction of your drag force (vector). You calculated the magnitude of this force correctly, then applied that magnitude both along your horizontal and vertical basis vectors for a total of $\sqrt{2}$ of the desired drag force, and pointing in the wrong direction!
The missing direction is given by $-\vec{v}^0 = -\vec{v} / \left| \vec{v} \right|$. So multiply your drag force magnitude by $v_x / \left| \vec{v} \right|$ for the horizontal ($x$) direction, and analogously for the vertical direction.
