Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help on parts A and B, C is correct already. a) Write a function that, given an angle in degrees, returns the angle in

image text in transcribed

Need help on parts A and B, C is correct already.

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. import numpy as np def degrees_to radians (degrees): radians = degrees * np.pi / 180 return radians ] : 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. def radians_to_degrees (radians): degrees = radians 180ppi return degrees ]: 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. def rotate_vector (vector, angle): rotation_matrix = np.array ([ [np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]]) return np.matmul(rotation_matrix, vector)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

5. Discuss the key components of behavior modeling training.

Answered: 1 week ago

Question

4. Develop a self-directed learning module.

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago