Projectile motion with air resistance using Euler's method

In summary, the goal is to calculate the trajectory of a cannon shell, taking into account air drag and reduced air density at high altitudes, in order to reproduce the results shown in Figure 2.5. Additionally, by performing calculations for different firing angles, we can determine the angle that gives the maximum range. The code provided is an example of how to approach this problem using C language and basic computational physics principles.
  • #1
zheng89120
149
0

Homework Statement



Calculate the trajectory of our canon shell including both air drag and reduced air density at high altitudes so that you can reproduce the results in Figure 2.5. Perform your calculation for different firing angles and determine the value of the angle that gives the maximum range. //what are the speed and angle of the canon ball? using 700 m/s and 30,35,40,45,50,55 degrees

Homework Equations



C language and basic Computational physics

The Attempt at a Solution

/* This is Problem 2_9 of 313's Problem set 2, by Zach Zheng */

#include <stdio.h>
#include <math.h>

main()
{
/* Declare variables */
double x; //Eulers ball position in x
double y; //Eulers ball position in y
double x_o; //Initial ball position in x
double y_o; //Initial ball position in y
double v; //Eulers ball speed
double v_x; //Eulers ball speed in x
double v_y; //Eulers ball speed in y
double v_x_o; //Initial ball speed in x
double v_y_o; //Initial ball speed in y
double p; //Air density
double p_o; //Initial air density
double m; //Ball mass
double g; //gravity constant
double theta; //Initial launch angle
double C; //Drag constant
double A; //Ball area
double dt,tmax,t; // Timestep, Maximum time,Current time

/* Set initial values for variables */
v = 700.0; //set initial speed
theta = M_PI/6.0; //set initial angle to 30 degrees
v_x = v_x_o; //set initial speed variable in x
v_x_o = v*cos(theta); //set initial speed constant in x
v_y = v_y_o; //set initial speed variable in y
v_y_o = v*sin(theta); //set initial speed constant in y
x = 0.0; //initial position
y = 0.0; //initial position
y_o = 10000.0; //initial sea height
m = 1.0; //set ball mass
p = 1.4; //density of air
g = 9.8; //gravity constant
C = 1.0; //set drag constant
A = 0.01; //set ball area
t = 0.0; //set initial time
dt = 0.5; //set time steps
tmax = 50.0; //maximum time

/* Now go through the steps until tmax is exceeded */
while (t < tmax )
{
//no exact solution

printf("%lf\t%lf\t%lf\n", t, x, y); //print statement

v = sqrt(v_x*v_x + v_y*v_y); //total speed

v_x = v_x - exp(-y/y_o)*(1.0/(2.0*m))*C*p*A*fabs(v_x)*v_x*dt; //Euler's solution in x

v_y = v_y - g*dt - exp(-y/y_o)*(1.0/(2.0*m))*C*p*A*fabs(v_y)*v_y*dt; //Euler's solution in y

x = x + v_x*dt; //Position in x as function of speed

y = y + v_y*dt; //Position in y as function of speed

t = t + dt; //time steps
}
}
 
Last edited:
Physics news on Phys.org
  • #2


/* Results
30 degrees = 0.0
35 degrees = 0.0
40 degrees = 0.0
45 degrees = 0.0
50 degrees = 0.0
55 degrees = 0.0

Based on the results, it seems that the maximum range is achieved at an angle of 45 degrees. However, the results may vary depending on the specific values used for the variables. It is important to also consider other factors such as wind speed and direction, as well as the specific characteristics of the cannon and shell being used. Further experiments and calculations may be needed to determine the most accurate angle for maximum range.
 

FAQ: Projectile motion with air resistance using Euler's method

What is Euler's method and how is it used in projectile motion with air resistance?

Euler's method is a numerical method used to solve differential equations, which are equations that relate the rate of change of a variable to its current value. In projectile motion with air resistance, Euler's method is used to approximate the trajectory of a projectile by breaking it into small time intervals and calculating the position and velocity at each interval.

How does air resistance affect projectile motion?

Air resistance is a force that acts in the opposite direction of motion and is proportional to the velocity of the object. In projectile motion, air resistance decreases the velocity of the projectile, causing it to have a shorter range and a lower maximum height compared to motion in a vacuum.

What are the limitations of using Euler's method in projectile motion with air resistance?

Euler's method is an approximation and not an exact solution, so it can introduce errors in the calculation of the trajectory. Additionally, it assumes a constant air resistance, which may not be accurate for all situations. It also does not account for other factors such as wind or spin on the projectile.

Can Euler's method be used for all types of projectile motion with air resistance?

Yes, Euler's method can be used for any type of projectile motion with air resistance, as long as the air resistance can be modeled as a constant force and the time intervals are small enough to provide an accurate approximation.

How can the accuracy of Euler's method be improved in analyzing projectile motion with air resistance?

The accuracy of Euler's method can be improved by using smaller time intervals, as this will result in a more accurate approximation of the trajectory. Additionally, using a more sophisticated numerical method, such as the Runge-Kutta method, can also improve the accuracy of the calculation.

Back
Top