Question: Exercise 3 a) Write a function that, given an angle in degrees, returns the angle in radians. Hint: For use the constant provided by NumPy

 Exercise 3 a) Write a function that, given an angle in

Exercise 3 a) Write a function that, given an angle in degrees, returns the angle in radians. Hint: For use the constant provided by NumPy numpy. pi. If you want to test the function yourself, try to call the function using angles that you know the answer for. In [ ]: def degrees_rad(theta): un Write the docstring here \# YOUR CODE HERE raise NotImplementedError() In[]: b) Write a function that, given an angle in radians, returns the angle in degrees. Hint: For use the constant provided by NumPy numpy. pi. If you want to test the function yourself, try to call the function using angles that you know the answer for. In [ ]: def radians_deg(alpha): Write the docstring here \# YOUR CODE HERE raise NotImplementedError() In [ ] : c) Write a function that rotates a 2D vector by an angle. The rotation of a vector by an angle is defined by: [xrotyrot]=[cos()sin()sin()cos()][xy] - Design your function considering the input vector as a NumPy array, and the angle in radians. - To compute the sin and cos of an angle, use numpy. sin() and numpy. cos() (these functions take angles in radians). - To define the matrix, use numpy.array ( ) (review lesson 4). - If you don't remember how to multiply matrices, review lesson 4. Tip: You can test your function by calling it with a vector and angle for which you can predict the result. For example, rotating a vector with coordinates (1,0) by an angle , the result should be (1,0). Probably, because numpy.pi can't contain all the decimals for , the second coordinate will be something really small, of the order of 1e16. That's fine. In [ ]: def rotate_vector(vector, angle): wuwrite docstring hre \# YOUR CODE HERE raise NotImp lementedError() In []

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!