Question: Help with numpy in python for matrix calculations! We can also represent the rotation operation using matrices as well. Given a point (x,y) the rotated

Help with numpy in python for matrix calculations! We can also representHelp with numpy in python for matrix calculations!

We can also represent the rotation operation using matrices as well. Given a point (x,y) the rotated point around the origin is given by (you will later learn how to derive these equations): x=xcosysiny=xsin+ycos Check your answers! Using the equations above, create and plot a rotation 90 degrees counter-clockwise around the origin. Hint: how can you turn the above into a matrix? Can you rewrite this as [xy]=A[xy] ? First store the rotation matrix in rotation (note: use radians with np.pi ): \#grade (enter your code in this cell - DO NOT DELETE THIS LINE) Then store the rotated bunny in bunny_rot : \#grade (enter your code in this cell - DO NOT DELETE THIS LINE) What does the rotation matrix look like? Is the structure similar to the identity matrix and mirror transformation from above? Plot the rotated bunny below: ax=plt.gca() ax.set_aspect('equal') ax.plot(bunny_rot [], bunny_rot[1], 'o-') By multiplying these matrices together, we can combine multiple operations into one matrix: TrotTscalex=(TrotTscale)x=Tbothx Note that the first transformation we apply is first on the left multiplying our vector - matrix multiplication in general is not commutative so this distinction is important. Check your answers! Try creating a transformation matrix that first scales points by two in each direction, then rotates 90 degrees around the origin. Store the transformed bunny in bunny_trans . \#grade (enter your code in this cell - DO NOT DELETE THIS LINE)

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!