Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python Problem-3 (Total points: 25) Problem Description: Consider that you and your friend are visiting a building that has 15 floors. Assume that you both
Python
Problem-3 (Total points: 25) Problem Description: Consider that you and your friend are visiting a building that has 15 floors. Assume that you both are going to play a game where your friend will drop a ball from different floors of that building and you have to catch it by staying on the ground. You find that everytime your friend goes to a higher floor and drops the ball, the ball travels with a much higher velocity (hence, difficult to catch the ball on the ground, when compared to the ball being dropped from the lower floors. This spikes your curiosity and thus, your task is now to find the velocity of the ball when your friend drops the ball from different floors. Each floor is at a different height from the ground and the velocity with which the ball comes down will depend on the heights from which the ball is dropped. Below you can find the table that enlists the height of different floors from the ground in the units of foot (plural form: foet). Floor number Height from the ground (feet) 3 9 15 6 18 24 9 27 11 33 12 36 14 42 You would have learned in high school that there are two forms of energy. Potential energy and kinetic energy. And, you also know that Earth has gravity and it is because of Earth's gravity that any object (in this caso, bal) must come down when it is dropped from a particular height. Potential energy is the energy that the object possesses because of its position in a gravitational space in this case, Earth's gravity) and hence, it depends on the mass of the bal, Earth's gravity, and the height from which the ball is dropped. Simply put, You would have leamed in high school that there are two forms of energy. Potential energy and kinetic energy. And, you also know that Earth has gravity and it is because of Earth's gravity that any object (in this case, ball) must come down when it is dropped from a particular height. Potential energy is the energy that the object possesses because of its position in a gravitational space in this case, Earth's gravity) and hence, it depends on the mass of the ball, Earth's gravity, and the height from which the ball is dropped. Simply put, Potential energy = mass X gravity x height (1) Further, kinetic energy is the energy of the object while in motion and hence, it depends on the mass of the ball and the velocity of the ball when it is moving downwards towards the ground. Simply put, Kinetic energy 1 2 x mass X velocity When the ball is dropped from a certain height, the potential energy of the ball that is initially at rest before dropping it is converted into kinetic energy when it is in motion (.o. moving downwards towards the ground). So, in order to get the velocity of the ball you have to simply equate the formulas for potential energy and kinetic energy based on the concept of conservation of energy Potential energy = Kinetic energy mass X gravity x height = = x mass X velocity Assume that the mass of the ball that your friend drops from different floors (.e. different heights from the ground) is (1000 + last two digits of your R- number) grams. The gravity of the Earth is 9.8 meter/second? You have to now use Equation (4) to find the velocity of the ball (in the units of meter/second) that is dropped from different heights as given in the table above. Specific tasks for this problem are given below. Task-1 (5 points): Convert the values of height (in feet) that is given in the table to the unit of meters. To do this, define a list which will contain all the height values in feet and store it in a variable name heights feet. Following this, loop over each height value (in feet) in the list heights_feet and convert it to meters (conversion from feet to meters is given below). Append the converted height values in meters to a new list and store it in a new variable name heights meters. Print heights meters to the output 1 feet = 0.3048 meters Note: In order to use the values of height in meters for the other tasks in this problern, create an empty list and store it in a variable name heights_meters to which you will append the height values in meters after conversion. Also, refer to Problem-1 to know how to define an empty list and to append values to an empty list 11: "GIVE THE SOLUTION FOR TASK-1 IN THIS CELL: Task-2 (5 points): Calculate the velocity of the ball dropped from different heights in meter/second. To do this tank, write a loop again and use the values of mass of the ball, gravity, and the list heights meters that contains the height values in meters in Equation (4). Make sure you store the values of mass and gravity in variable namos mass and gravity, respectively. Append the calculated velocity values based on different height values to a new lint and store it in a new variable name velocity values. Print velocity values to the output. Note: Cronto an empty list and store it in a variablo name velocity values to which you will appond the velocity values that you will calculate based on Equation ( Inside the loop. Also, refer to Problem-1 to know how to define an empty list and to append value to an empty list I: NGIVE THE SOLUTION FOR TASK-2 IN THIS CELL: Task-3 (5 points): Perform the same task as above but in this case, you have to do it inside a tunction. Specifically, you have to write a function velocity func that will take the values of mass, gravity, and the list heights_meters as inputs and then calculate the velocity values based on different heights inside the function using Equation (4). When you call the function, give it a new variable name ball_velocity. Print ball_velocity and the type of ball_velocity to the output. Note: Make sure that the function that you write returns a list which could be done by creating an empty list with a variable name velocity values inside the function to which you will append tho velocity values that you will calculate based on Equation (4). Also, refer to Problem-1 to know how to define an empty list and to append value to an empty list. 1): #GIVE THE SOLUTION FOR TASK-3 IN THIS CELL: Task-4 (5 points): Perform the same task as above but in this case, you have to pass a NumPy array with a variable name heights_meters_array that consists of values of heights in meters to the user-defined function. Specifically, you have to write a function velocity_func_array that will take the value of mass, gravity, and the numpy array heights_meters_array as inputs and calculate the velocity values based on different heights inside the function using Equation (4). When you call the function, give it a new variable name ball_velocity_array. Print ball_velocity_array and the type of ball_velocity_array to the output. Note-1: You have to convert the list helghts_meters to a NumPy array heights_meters_array which you will pass to the function and also make sure that the function that you write returns a Numpy array. Note-2: When you use the values in NumPy array heights_meters_array in Equation (4) along with the mass and the gravity values to get the velocity values, think what should be done differently when compared to the previous task. In other words, you would have to write a loop in the previous task to get the velocity values for each value of height in meters. Is that necessary here? Remember one of the main advantages of using NumPy arrays over lists. [ 1: GIVE THE SOLUTION FOR TASK4 IN THIS CELL: Task-5 (2 points): You somehow find that when the ball travels greater then 11 meter/second, it becomes difficult to catch the ball on the ground. Now, in this task, you would like to know how many velocity values are greater than 11 meter/second. In other words, you would like to find how many floors contribute to velocities greater than 11 meter/second. For this, do a conditional selection on ball velocity_array such that you pick velocity values that are greater than 11 meter/second and store it in a new variable name ball velocity selection Use ball velocity selection to find the number of velocity values that satisfied the condition and store it in a new variable name ball velocity size. Print ball_velocity selection and ball_velocity size to the output In U 1: *GIVE THE SOLUTION FOR TASK-5 IN THIS CELL: Task-6 (3 points) You would now like to find the kinetic energy of the ball in Joutes (J) when it travels at a maximum velocity. The conversion for Joule is given below. 1 Joule = 15$ To finish this task, first get the maximum velocity value from ball velocity selection and store it in a new variable narne ball_velocity_maximum. Use ball velocity maximum to calculate the kinetic energy in Joules based on Equation (2) Store the kinetic energy value that you get in a new variable name kinetic energy. Print ball velocity maximum and kinetic energy to the output. Note: Be careful with the unit conversions to get the kinetic energy value in Joules. In 1): GIVE THE SOLUTION FOR TASK-6 IN THIS CELL: --END OF PROBLEM-3 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started