A ball thrown at an angle 0 with initial speed vo on Earth follows a trajectory f(x) = I tan 0 + Yo 2 v cos? e where g = 9.81 ms2, speed in units of ms and an initial height yo in metres. Set yo = 0 and write a function 'trajectory0' that • has three input variables: xdata (a list), speed and angle (constant numbers each, angle in degrees) in that order. . Return the calculated list of height values, f(x), containing only positive or zero values for the ball height, i.e. remove all negative values before returning the resulting list. • The moodleX test code will take the returned list and test maximum height at given speed and angle. You can test your function with Spyder by writing a test function, calling your trajectory function with a speed of 20 ms, an angle of 45 degrees an list made from the python function 'range(100)'. Printing the maximum of the list with 'max(result)" where result is the output of the trajectory functis should yield 10.19 in this example. Answer: (penalty regime: 10, 20, . %)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question
How do I do this in python?
A ball thrown at an angle 0 with initial speed vo on Earth follows a trajectory
f(x) = x tan e
+ Y0
2 v cos? e
where g 9.81 ms, speed in units of ms" and an initial height yo in metres. Set yo =0 and write a function 'trajectory0' that
• has three input variables: xdata (a list), speed and angle (constant numbers each, angle in degrees) in that order.
• Return the calculated list of height values, f(x), containing only positive or zero values for the ball height, i.e. remove all negative values before
returning the resulting list,
• The moodleX test code will take the returned list and test maximum height at given speed and angle.
You can test your function with Spyder by writing a test function, calling your trajectory function with a speed of 20 ms, an angle of 45 degrees and a
list made from the python function 'range(100)'. Printing the maximum of the list with 'max(result)' where result is the output of the trajectory function
should yield 10.19 in this example.
Answer: (penalty regime: 10, 20, ... %)
1
Transcribed Image Text:A ball thrown at an angle 0 with initial speed vo on Earth follows a trajectory f(x) = x tan e + Y0 2 v cos? e where g 9.81 ms, speed in units of ms" and an initial height yo in metres. Set yo =0 and write a function 'trajectory0' that • has three input variables: xdata (a list), speed and angle (constant numbers each, angle in degrees) in that order. • Return the calculated list of height values, f(x), containing only positive or zero values for the ball height, i.e. remove all negative values before returning the resulting list, • The moodleX test code will take the returned list and test maximum height at given speed and angle. You can test your function with Spyder by writing a test function, calling your trajectory function with a speed of 20 ms, an angle of 45 degrees and a list made from the python function 'range(100)'. Printing the maximum of the list with 'max(result)' where result is the output of the trajectory function should yield 10.19 in this example. Answer: (penalty regime: 10, 20, ... %) 1
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning