So far in these physics-related problems we have been ignoring the effects of air resistance. In reality, the factors of air resistance can have a significant impact on the trajectory of an object. However, the reason why this factor is so often omitted from practice problems is that the equations involved can get extremely complicated.
For this problem let's stick to a relatively simple model known as Viscous Resistance, Linear Drag, or Stokes' Drag. For a sphere traveling through a viscous fluid, the Drag Force resisting the object's movement is
$$ \huge F_d = - 6 \pi \cdot \eta \cdot r \cdot \text{v} $$
Where
F_d is the Drag Force, in units of Newtonsη (eta) is the fluid Viscosity, in units of centipoise (cP)r is the Radius of the sphere, in units of metersv is the Velocity of the object, in units of meters per secondAnd so we can see that the faster that the object is moving through the fluid,
the more resistance it experiences. To provide a general idea of scale, the fluid
viscosity of air is roughly 0.0181 cP, the fluid visosity of water is
roughly 1.002 cP, and the fluid viscosities of some vegetable oils can reach 100 cP.
So how do we start implementing this into our solutions? Instead of trying to create an equation to find an exact solution, there is another option - to virtually simulate the forces, speeds, and positions involved in the problem to determine the outcome. The difficulty here comes from that fact that these parameters are constantly changing with time.
The Euler Method is a relatively straightforward approach to this: first we
define our initial coniditions with respect to accelerations, velocities, and
positions. Then we choose some time interval dt (in seconds) which is typically much
smaller than the total time of whatever process we are trying to simulate. Then
we ask ourselves - if we assume that the parameters stay constant for the
duration of each time interval dt, and only change when transitioning from
one interval to the next, the problem is greatly simplified and we can start
simulating in these time interval "chunks".
For example let's say we have some projectile on a trajectory through the air.
At time t, it has acceleration A(t), velocity V(t), and also some
position x(t) and y(t). We can break both the acceleration and velocity
down into their vertical and horizontal components along each axis, having
Ax and Ay components of acceleration, Vx and Vy components of velocity,
and x and y components of position. At the beginning of each time interval
(including the first), we update each parameter according to the following
rules:
$$ \large V_x (t + dt) = V_x (t) + A_x (t) \cdot dt $$ $$ \large V_y (t + dt) = V_y (t) + A_y (t) \cdot dt $$ $$ \large x(t + dt) = x(t) + V_x(t) \cdot dt $$ $$ \large y(t + dt) = y(t) + V_y(t) \cdot dt $$
Let's imagine we have some object with mass m (in kg) and radius r, launched from a
cannon across a field at initial
height y0 with initial velocity v0 and at angle θ (theta) degrees relative the the ground.
The object will
experience Stokes's drag through the air, which has viscosity η.
How far does the object travel before landing?
Assume acceleration due to gravity is constant g = -9.8 m/s^2
Input Data
First line will be Q, the quantity of testcases.
Q lines will then follow, each having a single testcase.
Testcases are a string of seven space-separated values in the format
m r y0 v0 θ η dt.
Answer
Should consist of Q space-separated values, each being the object's x position at
first time when any part of the projectile is below y = 0.
Error should be less than 1e-6.
Example
input data:
4
1.000 2.000 3.000 100.000 45.000 0.000 0.001
1.000 2.000 3.000 100.000 45.000 0.018 0.001
1.000 2.000 3.000 100.000 45.000 1.002 0.001
1.000 2.000 3.000 100.000 45.000 1.002 0.100
answer:
1021.345035 1014.745166 740.743246 737.544339