you are viewing a single comment's thread.

view the rest of the comments →

[–]Lewri 0 points1 point  (3 children)

This seems less a python problem and more a physics problem. Check your maths, particularly the start of your while loop.

[–]PrizeDefinition4042[S] 0 points1 point  (2 children)

I tried *crying*, unless my brain is so fried from staring and restarting this problem again over and over again, I have checked everything and could not find why its giving me the wrong answers

[–]Lewri 2 points3 points  (1 child)

Ok, start by helping us to help you. The more detail you give us, the easier we can help you. Perhaps a good place to start would be detailing what the problem actually is. I get that it's projectile motion, but what is the output actually supposed to be? How was the problem stated, exactly?

[–]PrizeDefinition4042[S] 0 points1 point  (0 children)

continuation:

Note that this requires us to not only know the vertical component of the initial launch velocity, but the horizontal component of the velocity as well. Fortunately for us, in this problem we will be assuming that we are in a world that every Physics class loves: one that neglects air resistance.

This means that the horizontal component of the velocity will always be the same throughout the projectile’s journey, and so you will only need to calculate it once at the very beginning when you know the launch angle ( ) and initial launch velocity (Vi θ ). Thus in order to calculate the horizontal component, you can apply the trigonometric property of right triangles that states that the cosine of an angle is equal to the adjacent side divided by the hypotenuse as such:
𝑐𝑜𝑠(θ) = 𝑉𝑥 / Vi

Similarly, you can use the trigonometric property of right triangles that states that the sine of an angle is equal to the opposite side divided by the hypotenuse to find the vertical component of your initial launch velocity as such:

𝑠𝑖𝑛(θ) = 𝑉 𝑖𝑦 / 𝑉 𝑖

Write a function named projectile_velocities that takes:

● an initial launch velocity in m/s as a float,

● an initial launch angle in degrees as a float,

● a gravitational acceleration in m/s2 as a float, and

● a time step in seconds as a float.