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 v
2 term. The v
x/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 (dv
x/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 f
x based on the starting velocity using equation 1.
You would then compute the rate of change of v
x based on f
x 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 dv
x/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?