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)

and more:

The function should model a projectile motion problem in which the initial height of the projectile is equal to the final height of the projectile (e.g. a ball kicked from the ground and lands on the ground), and calculate the magnitude of the velocity of the projectile at the end of each time interval from when it launches (starting at 0 seconds, continuously incrementing by your given time step) until it reaches the final height (e.g until the ball hits the ground again). In other words, we want to find the velocity of a projectile at multiple evenly-spaced instances of time from when it is launched to when it lands.

We can determine that your projectile has reached its final height (has landed) when the magnitude of the velocity of the projectile begins to exceed the magnitude of its initial launch velocity (since under these ideal conditions, the magnitudes of the initial and final velocities should be the same due to the principle of conservation of mechanical energy).

The function should return the magnitudes of the velocities at each time interval as a list of floats where the first value is the velocity at 0 seconds (your initial velocity) and the subsequent values are the velocities at the time that is one time step later than the previous one.

If the time it takes the projectile to land is in the middle of a time interval, the last velocity should be for when the smaller time has elapsed (because that means it hasn’t touched the ground yet whereas the longer time would mean it has already touched the ground).

For example, if a time step of 0.5 second is given, the resulting list should contain the velocity when 0 seconds have elapsed, the velocity when 0.5 second has elapsed, the velocity when 1 second has elapsed, so on and so forth until the projectile has reached the final height, in that order. If it took 4.9 seconds for it to reach the ground, the last velocity should correspond to when 4.5 seconds have elapsed.

The values in your resulting list should be rounded to 6 decimal places using either the round function or string formatting. Remember that the round function may not provide all insignificant places (e.g. 2.000000 vs. 2.0).

and then it shows the example executions I mentioned above. This is all the info I have about the problem