Question: Implement a new function bounce_y(t,v_0,e) that will produce the trajectory of a bouncing ball Part C (8 points) Alright, lumps of clay are still pretty
Implement a new function bounce_y(t,v_0,e) that will produce the trajectory of a bouncing ball

Part C (8 points) Alright, lumps of clay are still pretty boring. A much more interesting version of this problem is to simulate the motion of a bouncing ball, which will fly up into the air again once it hits the ground. The simplest way to model a bouncing ball is using the coefficient of restitution e, which is equal to the ratio of incoming to outgoing speed when the ball bounces. For example, a tennis ball with e = 0.75 that hits the ground at 4 m/s will bounce back up with a speed of 3 m/s - after which it obeys the same simple equation of motion as above. Implement a new function bounce_y(t, v_0, e) that will produce the trajectory of a bouncing ball. (Hint: the art of this solution is all in finding a good algorithm! My suggestion is the following, which is nicely adapted to a while loop:) Start by calculating the full y(t) without bouncing, letting y go negative. Now, look the subarray of y(t) values for where the current trajectory y is negative: this entire part of the trajectory should be replaced by a new trajectory that starts with a bounce. For this part of the trajectory, the starting vertical speed of the bounce is equal to the ending speed of the previous trajectory, times the coefficient of restitution e. You could calculate u(t), but you could also take advantage of the very simple relation between the initial and final speeds due to energy conservation - remember, energy is still conserved in between bounces! Don't forget to include yo in your conservation of energy calculation... you should sketch this out on paper first. Repeat the steps above until there are no negative y values left. The np.any () function will definitely come in handy for your while loop. For replacing only the negative part of y , you'll need a mask - and remember, when assigning to a mask of an array a [mask] = b, the array b had better be the same length as a[mask) ...) g = 9.8 ## m/s^2 def traj_y_bounce(t, v_0, y_0=0, e=0.75): Computes y(t) for 1-d projectile motion. Projectile is a bouncing ball, with coefficient of restitution e. The ground is taken to be at y=0. Arguments: - t: array of t-values to compute the motion for. - V_O: initial speed in the y-direction. - y_0: starting height (must be non-negative!) [default: 0.] - e: coefficient of restitution [default: 0.75.] Returns: - y: array containing the trajectory y(t). ## YOUR CODE HERE Part C (8 points) Alright, lumps of clay are still pretty boring. A much more interesting version of this problem is to simulate the motion of a bouncing ball, which will fly up into the air again once it hits the ground. The simplest way to model a bouncing ball is using the coefficient of restitution e, which is equal to the ratio of incoming to outgoing speed when the ball bounces. For example, a tennis ball with e = 0.75 that hits the ground at 4 m/s will bounce back up with a speed of 3 m/s - after which it obeys the same simple equation of motion as above. Implement a new function bounce_y(t, v_0, e) that will produce the trajectory of a bouncing ball. (Hint: the art of this solution is all in finding a good algorithm! My suggestion is the following, which is nicely adapted to a while loop:) Start by calculating the full y(t) without bouncing, letting y go negative. Now, look the subarray of y(t) values for where the current trajectory y is negative: this entire part of the trajectory should be replaced by a new trajectory that starts with a bounce. For this part of the trajectory, the starting vertical speed of the bounce is equal to the ending speed of the previous trajectory, times the coefficient of restitution e. You could calculate u(t), but you could also take advantage of the very simple relation between the initial and final speeds due to energy conservation - remember, energy is still conserved in between bounces! Don't forget to include yo in your conservation of energy calculation... you should sketch this out on paper first. Repeat the steps above until there are no negative y values left. The np.any () function will definitely come in handy for your while loop. For replacing only the negative part of y , you'll need a mask - and remember, when assigning to a mask of an array a [mask] = b, the array b had better be the same length as a[mask) ...) g = 9.8 ## m/s^2 def traj_y_bounce(t, v_0, y_0=0, e=0.75): Computes y(t) for 1-d projectile motion. Projectile is a bouncing ball, with coefficient of restitution e. The ground is taken to be at y=0. Arguments: - t: array of t-values to compute the motion for. - V_O: initial speed in the y-direction. - y_0: starting height (must be non-negative!) [default: 0.] - e: coefficient of restitution [default: 0.75.] Returns: - y: array containing the trajectory y(t). ## YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
