Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the function tray_y_clay(t,v_0,y_0) below, which returns the array y(t) according to the formula below, computed for the array of t values given as input.

Implement the function tray_y_clay(t,v_0,y_0) below, which returns the array y(t) according to the formula below, computed for the array of t values given as input.

image text in transcribed

5.2 - Ballistics, masks, and bouncing balls (20 points) There are some interesting problems that we can now solve (and visualize) with the help of the computer, even in something as simple as one-dimensional motion under gravity. For a projectile moving vertically with initial height yo and vertical speed vo, its height as a function of time will be described by the equation y(t) = y0 + vot 5812 As we've seen, NumPy arrays enable us to work with large sets of structured data easily - so we can compute the entire trajectory y(t) at once as a single array. We can use this to add in a complication: what happens when our projectile meets the ground? Part A (4 points) To start with, we assume our projectile is a lump of clay: if it hits the ground (which we define to be y=0), then it will just stick there. Implement the function trajy_clay(t, v_0, y_0) below, which returns the array y(t) according to the formula above, computed for the array of t values given as input. Again, as soon as the lump of clay hits the ground at y=0, the trajectory from that point should just be y=0 for any larger x ! (Hint: you should implement this by computing y(t) ignoring the ground, and then using a mask to zero out the trajectory after it hits the ground.) g = 9.8 ## m/s^2 def traj_y_clay(t, v_0, y_0=0): Computes y(t) for 1-d projectile motion. Projectile is a lump of clay, which sticks to the ground at y=0 as soon as it hits. Arguments: - t: array of t-values to compute the motion for. - V_0: initial speed in the y-direction. - y_0: starting height (must be non-negative!) Returns: - y: array containing the trajectory y(t). assert y_0 >= 0 ## YOUR CODE HERE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started