How can I incorporate wind resistance into my projectile motion calculations?

In summary, the conversation discusses adding horizontal variables for wind resistance in a projectile motion problem and how it affects the equations and calculations. The use of Euler's method to solve the coupled differential equations for the motion is suggested. The conversation also touches on using programming code to calculate the position and velocity of the projectile at a specific time after launch.
  • #1
python
7
0

Homework Statement


I'm currently in computer programming class, and I've finished a project and want to improve on it. We had to figure out how to calculate the gravitational acceleration and time traveled of a projectile to hit a target. I'd like to add horizontal variables in my code, like wind resistance left and right. What would the formula be for something like this? The user inputs the initial velocity and also the launch angle.
v = velocity
r = launch angle in radians
g = gravitational acceleration

Homework Equations


time of travel = 2 * v * sin(r) / 32
distance = velocity * cos(r) * time

The Attempt at a Solution


No attempt, don't know the correct equation.
 
Physics news on Phys.org
  • #2
Your equations for the version without wind resistance look fine. Apparently you are using U.S. customary units (feet and seconds).

Adding in wind resistance makes the problem vastly more difficult. A key problem is that wind resistance makes it so that the vertical part of the motion and the horizontal part of the motion are no longer independent. Instead they become a pair of "coupled" differential equations. You cannot solve for time of flight based purely on initial vertical velocity. You cannot solve for distance traveled based purely on time of flight and initial horizontal velocity. You have to solve the two equations together.

One way proceed to split the time interval into small pieces and work a simulation forward one tick at a time. Keep track of the projectile's vertical and horizontal position and its vertical and horizontal velocity. Run the simulation in a loop until the vertical position becomes negative.

Suppose that the wind resistance formula take the form: f = -kv^2 for some constant k and that you have the current position and velocity stored in variables x_cur, y_cur, vx_cur and vy_cur. Can you write code to compute a reasonable approximation for x_next, y_next, vx_next and vy_next?
 
  • #3
jbriggs444 said:
Your equations for the version without wind resistance look fine. Apparently you are using U.S. customary units (feet and seconds).

Adding in wind resistance makes the problem vastly more difficult. A key problem is that wind resistance makes it so that the vertical part of the motion and the horizontal part of the motion are no longer independent. Instead they become a pair of "coupled" differential equations. You cannot solve for time of flight based purely on initial vertical velocity. You cannot solve for distance traveled based purely on time of flight and initial horizontal velocity. You have to solve the two equations together.

One way proceed to split the time interval into small pieces and work a simulation forward one tick at a time. Keep track of the projectile's vertical and horizontal position and its vertical and horizontal velocity. Run the simulation in a loop until the vertical position becomes negative.

Suppose that the wind resistance formula take the form: f = -kv^2 for some constant k and that you have the current position and velocity stored in variables x_cur, y_cur, vx_cur and vy_cur. Can you write code to compute a reasonable approximation for x_next, y_next, vx_next and vy_next?
Yes, I could make the variable count upwards or downwards. Would it be a constant curve?
 
  • #4
I'm not sure that we are understanding one another. Can you show what you had in mind?
 
  • #5
jbriggs444 said:
I'm not sure that we are understanding one another. Can you show what you had in mind?
This is what my code prints out for the user.

Attempt 1
-----------
The target is 2914 feet away.
Input the velocity.400
Input the launch angle15
Too short.
You were 414.00 feet away!
Distance traveled was 2500.00 feet
It took you 6 seconds travel time.

I want to add code to calculate how far left or right the projectile will go when I add wind to it.
 
  • #6
What would code look like to compute where the projectile would be one tenth of a second after launch?
What would code look like to compute what velocity the projectile would have one tenth of a second after launch?
 
  • #7
jbriggs444 said:
What would code look like to compute where the projectile would be one tenth of a second after launch?
What would code look like to compute what velocity the projectile would have one tenth of a second after launch?
I could use my original variable, time, to find one tenth of a second, the line would look like this.
variable is time
time - time + .1 = new variable
That would be easy to find, however, I don't know how to calculate the decline of velocity. I'm not currently a physics student, I'm taking that next year.
 
  • #8
python said:
I could use my original variable, time, to find one tenth of a second, the line would look like this.
variable is time
time - time + .1 = new variable
Help me out here. What programming language do you use where the result of an assignment statement is on the right? And why would one write "time - time + 0.1" when one could simplify and write "0.1" instead?
 
  • #9
jbriggs444 said:
Help me out here. What programming language do you use where the result of an assignment statement is on the right? And why would one write "time - time + 0.1" when one could simplify and write "0.1" instead?
Sorry, I didn't know if you knew code.
I'm using python for this project.
The code would look something like:
newvar = .1
And as long as I have the equation, I can figure out the code for it. I just need the formula really, and maybe an explanation for it.
 
  • #10
The differential equations of motion for wind resistance that scales as the square of velocity would be:

##f_x = -kv^2\frac{v_x}{|v|}##
##\frac{dv_x}{dt} = \frac{f_x}{m}##

##f_y = -mg -kv^2\frac{v_y}{|v|}##
##\frac{dv_y}{dt} = \frac{f_y}{m}##

Setting newvar to 0.1 is only a small part of the job. What I am proposing is Euler's method to solve this differential equation numerically.
 
  • #11
jbriggs444 said:
The differential equations of motion for wind resistance that scales as the square of velocity would be:

##f_x = -kv^2\frac{v_x}{|v|}##
##\frac{dv_x}{dt} = \frac{f_x}{m}##

##f_y = -mg -kv^2\frac{v_y}{|v|}##
##\frac{dv_y}{dt} = \frac{f_y}{m}##

Setting newvar to 0.1 is only a small part of the job. What I am proposing is Euler's method to solve this differential equation numerically.
Could you explain the equation to me? Also, I could just calculate the resistance for one tenth of a second, and then multiply by the variable time to get the total distance traveled left or right?
 
  • #12
python said:
Could you explain the equation to me? Also, I could just calculate the resistance for one tenth of a second, and then multiply by the variable time to get the total distance traveled left or right?
No. Multiplying a constant velocity by time gets you distance travelled. Multiplying a variable velocity by time gets you garbage.

The first equation expresses the x component of force in terms of a constant k and the current velocity of the projectile. The constant represents a combination of how viscous the atmosphere and how large the cross-section of the projectile is. The total wind resistance scales with the square of the current velocity. That explains the v2 term. The vx/v term is there to express the fact that we are interested in only the x component of that force.

The second equation expresses how the rate of change of the x component of velocity with respect to time (dvx/dt) is equal to the x component of force divided by the mass of the projectile. This is Newton's second law, f=ma, rearranged by dividing through by m and expressing a as dv/dt.

The third equation expresses the y component of force. Again, there is the wind resistance component which is entirely analogous to the x component. In addition, there is the downward force of gravity.

The fourth equation is entirely analogous to the second.

You would use these equations by first computing fx based on the starting velocity using equation 1.
You would then compute the rate of change of vx based on fx using equation 2.
You would update the x position by adding the current velocity time the length of your selected time increment.
You would then update the x velocity by multiplying the dvx/dt by your selected time increment.

You would then use the entirely analogous process for the y component.

After performing these manipulations you should have a new x velocity, a new y velocity, a new x position, a new y position and a new time.

Your first task is to come up with a set of variable names to represent these quantities. Your second task is to write the code to perform one step of the computation. Can you do that and show us what you come up with?
 
  • #13
vSquared = v ** 2
force = -14.7 * vSquared
change =
yForce =
yChange =
This is what I got, but when I print it off to the console, it gives me a number in the millions. Am I doing something wrong?
 

1. What is air resistance?

Air resistance is the force that opposes the motion of an object through air. It is caused by the collision of air molecules with the surface of the object.

2. How does air resistance affect the motion of an object?

Air resistance decreases the speed of an object and reduces its acceleration. As the object moves through air, the air resistance force increases until it is equal to the force of gravity, resulting in a constant speed known as terminal velocity.

3. How is air resistance calculated?

The calculation of air resistance is complex and depends on factors such as the shape and size of the object, its velocity, and the density of the air. It is typically calculated using mathematical equations and computer simulations.

4. How can air resistance be reduced?

Air resistance can be reduced by changing the shape of the object to be more streamlined, decreasing its surface area, or increasing its velocity. Some objects, such as airplanes and cars, are specifically designed to reduce air resistance and improve their efficiency.

5. What are some real-life examples of objects experiencing air resistance?

Objects that are affected by air resistance in everyday life include cars, airplanes, parachutes, and even people skydiving. Sports such as skiing and cycling also involve dealing with air resistance. In fact, any object that moves through air will experience some degree of air resistance.

Similar threads

  • Introductory Physics Homework Help
Replies
13
Views
1K
  • Introductory Physics Homework Help
2
Replies
39
Views
2K
  • Introductory Physics Homework Help
Replies
11
Views
805
  • Introductory Physics Homework Help
Replies
8
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
748
Replies
2
Views
2K
  • Introductory Physics Homework Help
2
Replies
37
Views
3K
  • Introductory Physics Homework Help
Replies
15
Views
21K
  • Introductory Physics Homework Help
Replies
1
Views
1K
Back
Top