Exercise 1: Define the trajectory function The partial code for this function is shown in the cell below. Do the following: Replace raise NotImplementedError() with code that starts with y = and calculates the value of y according to Eq. (3.4.8).

College Physics
11th Edition
ISBN:9781305952300
Author:Raymond A. Serway, Chris Vuille
Publisher:Raymond A. Serway, Chris Vuille
Chapter1: Units, Trigonometry. And Vectors
Section: Chapter Questions
Problem 1CQ: Estimate the order of magnitude of the length, in meters, of each of the following; (a) a mouse, (b)...
icon
Related questions
Question

Exercise 1: Define the trajectory function

The partial code for this function is shown in the cell below. Do the following:

  1. Replace raise NotImplementedError() with code that starts with y = and calculates the value of y according to Eq. (3.4.8).
Next, we define a function y(x, 0) that describes the trajectory, i.e. the height y above ground vs. horizontal distance x and launch angle 0. This function is
given by Eq. (3.4.8) in the lab manual:
y(x) =
g
2u² cos² (0)
− x² + tan(0) x + H
Transcribed Image Text:Next, we define a function y(x, 0) that describes the trajectory, i.e. the height y above ground vs. horizontal distance x and launch angle 0. This function is given by Eq. (3.4.8) in the lab manual: y(x) = g 2u² cos² (0) − x² + tan(0) x + H
In [1]:
Notes:
Python, like most other programming languages, expects the arguments of trigonometric functions in radians. However, we'd like to work in degrees, so
that's what the second argument of our function y(x, 0) will be. Inside the function, the angle in degrees theta_deg is converted to radians
(theta_rad) by multiplying it with The cosine and tangent functions are provided by the numpy module, so call them as np.cos(theta_rad)
and np.tan (theta_rad).
180°
• The expression you are going to code has a fraction with multiple factors in the denominator. You may need to use parentheses () to enforce the correct
order of operations. Remember, operations with the same priority (e.g. multiplication and division) will be carried out in their order of appearance (from left
to right), unless parentheses are used.
• However, parentheses should be used sparingly, i.e. only where really needed. For example, the expression
3x²
5x+2
●.
could be coded as
or
(3* (x) **2/ (( 5* (x) +2 ) ) )
3*x**2 (5*x+2)
Both codes return the same value, but the second example is much easier to read for us humans!
• The multiplication operator * is mandatory! For example, 2v? must be coded as 2*vi**2.
g = 9.8
vi = 2.865
H = 0.3347
▾def y(x, theta_deg):
theta_rad = theta_deg*np.pi/180
# YOUR CODE HERE
raise Not ImplementedError()
return y
#free-fall acceleration
#initial velocity. REPLACE WITH YOUR OWN VALUE
# initial height. REPLACE WITH YOUR OWN VALUE
# The colon (:) at the end of the "def" line is mandatory
#angle unit conversion. pi=3.141... is defined in numpy,
#hence the np. prefix
II
# this is the value that the function "returns'
Transcribed Image Text:In [1]: Notes: Python, like most other programming languages, expects the arguments of trigonometric functions in radians. However, we'd like to work in degrees, so that's what the second argument of our function y(x, 0) will be. Inside the function, the angle in degrees theta_deg is converted to radians (theta_rad) by multiplying it with The cosine and tangent functions are provided by the numpy module, so call them as np.cos(theta_rad) and np.tan (theta_rad). 180° • The expression you are going to code has a fraction with multiple factors in the denominator. You may need to use parentheses () to enforce the correct order of operations. Remember, operations with the same priority (e.g. multiplication and division) will be carried out in their order of appearance (from left to right), unless parentheses are used. • However, parentheses should be used sparingly, i.e. only where really needed. For example, the expression 3x² 5x+2 ●. could be coded as or (3* (x) **2/ (( 5* (x) +2 ) ) ) 3*x**2 (5*x+2) Both codes return the same value, but the second example is much easier to read for us humans! • The multiplication operator * is mandatory! For example, 2v? must be coded as 2*vi**2. g = 9.8 vi = 2.865 H = 0.3347 ▾def y(x, theta_deg): theta_rad = theta_deg*np.pi/180 # YOUR CODE HERE raise Not ImplementedError() return y #free-fall acceleration #initial velocity. REPLACE WITH YOUR OWN VALUE # initial height. REPLACE WITH YOUR OWN VALUE # The colon (:) at the end of the "def" line is mandatory #angle unit conversion. pi=3.141... is defined in numpy, #hence the np. prefix II # this is the value that the function "returns'
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Multidimensional system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, physics and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
College Physics
College Physics
Physics
ISBN:
9781305952300
Author:
Raymond A. Serway, Chris Vuille
Publisher:
Cengage Learning
University Physics (14th Edition)
University Physics (14th Edition)
Physics
ISBN:
9780133969290
Author:
Hugh D. Young, Roger A. Freedman
Publisher:
PEARSON
Introduction To Quantum Mechanics
Introduction To Quantum Mechanics
Physics
ISBN:
9781107189638
Author:
Griffiths, David J., Schroeter, Darrell F.
Publisher:
Cambridge University Press
Physics for Scientists and Engineers
Physics for Scientists and Engineers
Physics
ISBN:
9781337553278
Author:
Raymond A. Serway, John W. Jewett
Publisher:
Cengage Learning
Lecture- Tutorials for Introductory Astronomy
Lecture- Tutorials for Introductory Astronomy
Physics
ISBN:
9780321820464
Author:
Edward E. Prather, Tim P. Slater, Jeff P. Adams, Gina Brissenden
Publisher:
Addison-Wesley
College Physics: A Strategic Approach (4th Editio…
College Physics: A Strategic Approach (4th Editio…
Physics
ISBN:
9780134609034
Author:
Randall D. Knight (Professor Emeritus), Brian Jones, Stuart Field
Publisher:
PEARSON