Projectile Motion with Drag

The overall goal is to write a Mathematica program that will compute the launch angle that will yield the greatest range with using [RandomInt] function, but I was having trouble with the physics.

In 2D Trajection with no friction, the greatest range came at angle $45^\circ$.

But using the quadratic model of friction,

$$F_{drag} = -kv^2, k = \frac{1}{2}C_D\rho A$$

where $\rho$ is the density of air, $A$ is the cross sectional area of the moving object (circle in this case), and $C_D$ is the drag coefficient. $$v^2 = v_x^2 + v_y^2$$

At this point, I'm not sure on how to set up the problem, as $v$ is dependent on both $v_x$ and $v_y$, and cannot be modeled as linearly independent of each other.

Some given parameters of the sphere projectile: (I'm assuming these values can be easily plugged into the general equation when writing the program)

Intial Velocity = Between $30-40 \frac{m}{s}$ Mass = 0.145 $kg$ Radius = 0.0367 $m$ Air density = $1.2 kg/m^3$ Drag Coefficient = 0.46

How would I incorporate both velocities in an equation? For simple kinematics, it is simply: $$Total Range = v_xt$$ and we solved for $v_x$ by using trig properties from $v_0$. But is it correct to model this drag force with the same trig properties?

$$v_y = vsin\theta, v_x = vcos\theta$$

$$\sum F = ma = kv^2 - mg = (\frac{1}{2}C_D\rho A({vsin\theta}^2+{vcos\theta}^2) - mg$$

• 2D quadratic drag was also considered in this Phys.SE post and links therein. Sep 5, 2014 at 22:16

In two dimensions, Newton's second law can be written in vector form as $$\mathbf F_\mathrm{net} = m\mathbf a$$ In this case, the net force is $$\mathbf F_\mathrm{net} = m\mathbf g - kv^2\frac{\mathbf v}{v} = m\mathbf g - kv\mathbf v$$ so the equation of motion is $$m\mathbf a = m\mathbf g - kv\mathbf v$$ In components, if we choose the positive $y$ direction to be vertical, and using $v = \sqrt{v_x^2 + v_y^2}$ as you point out, we obtain $$ma_x = -k\sqrt{v_x^2+v_y^2} v_x, \qquad ma_y = -mg-k\sqrt{v_x^2+v_y^2}v_y$$ as you can see, these differential equations are coupled; the $x$ equation involves $v_y$ and the $y$-equation involves $v_x$ unlike the case in which there is no drag. You should be able to numerically solve these simultaneous equations pretty easily on Mathematica.
In particular, you can solve these equations by specifying the initial position $\mathbf x(0) = (x(0), y(0)$ and the initial velocity $\mathbf v(0) = (v_x(0), v_y(0)) = (v(0)\cos\theta, v(0)\sin\theta)$ where $\theta$ is the initial angle at which the projectile is launched.
I suggest define a function $f(\theta)$ that gives you the range of the projectile for a given angle. Compute $f$ solving numerically the ODE (you could use a Runge-Kutta method for this task http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods) $$m \, \frac{d^2 \overrightarrow{x}}{dt^2} = m\overrightarrow{g} - k v \, \overrightarrow{v}$$ with initial condition $$\overrightarrow{x}(0)=(0,0) \quad \overrightarrow{v}(0)=v_x \cos(\theta) + v_y \sin(\theta)$$ Then use ternary search in this $f$ for get your result: http://en.wikipedia.org/wiki/Ternary_search . You should be able to implement this algorithm in the programming language of your preference .