Question: Notice in the plot from the previous part that the watermelon should hit the ground at some time between 1.5 seconds and 2 seconds after
Notice in the plot from the previous part that the watermelon should hit the ground at some time between 1.5 seconds and 2 seconds after it is released. Next you will find a better estimate of this time by locating the precise intersection of the watermelon's trajectory with the horizontal line at . To do this, implement the function compute_impact_time(tf, n) that take the final time tf and the number of grid points n, and does the following: Used compute_position to obtain the trajectory tf=2 and n=20 (as in part 1.5) Find ipos and ineg, the indexes corresponding to the last positive value of x and the first negative value of x, respectively. Computes tg, watermelon-to-ground impact time, based on t[ineg], t[ipos], x[ineg], and x[ipos]. Here you will have to derive a formula for tg by assuming constant speed between t[ineg] and t[ipos] (ie that the line joining the two red dots in the figure below is straight). Returns ineg, ipos, and tg (in that order). def compute_impact_time(tf, n): ... ineg = ... ipos = ... ... tg = ... return ineg, ipos, tg
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
