Solving ODE’s Repetition

Here is a possible problem, that could be part of the exam. The code implements the solution of the ODE for projectile motion. Most of the code is given. Only a part of it should be added. For this particular type of problem, we would not ask for a plot. Note that in the exam, no additional hints nor the final solution will be given.

Projectile Motion with Air Resistance

In introductory physics, projectile motion is often taught without air resistance, resulting in a parabolic trajectory. However, in real-world scenarios, air resistance significantly affects the path and range of projectiles. A projectile experiencing quadratic air resistance (proportional to the square of velocity) is governed by the following system of ODEs:

\[\begin{align} \frac{dx}{dt} &= v_x\\ \frac{dy}{dt} &= v_y\\ \frac{dv_x}{dt} &= -\frac{b}{m}v_x\sqrt{v_x^2 + v_y^2}\\ \frac{dv_y}{dt} &= -g - \frac{b}{m}v_y\sqrt{v_x^2 + v_y^2} \end{align}\]

where:

  • \((x,y)\) is the position
  • \((v_x,v_y)\) is the velocity
  • \(g\) is the acceleration due to gravity
  • \(b\) is the drag coefficient
  • \(m\) is the mass of the projectile
Self-Exercise: Projectile Motion with Air Resistance

Implement a numerical solution to the projectile motion problem with air resistance and compare it to the ideal case without air resistance. You only need to insert the equations for the speed and the acceleration in the code as well as the ideal solution at the positions marked with “____”.

  1. The speed magnitude is \(v = \sqrt{v_x^2 + v_y^2}\)

  2. The acceleration components with air resistance are:

    • \(a_x = -\frac{b}{m}v_x \cdot v\)
    • \(a_y = -g - \frac{b}{m}v_y \cdot v\)
  3. For ideal motion without air resistance:

    • \(x = v_{0x} \cdot t\)
    • \(y = v_{0y} \cdot t - \frac{1}{2}gt^2\)
  4. The time to hit the ground in the ideal case is \(t_{final} = \frac{2v_{0y}}{g}\)

Solution