Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Linear Transformations . Answer in PYTHON please write comment at every step in (b) The following code generates the cats picture. import numpy as np

Linear Transformations . Answer in PYTHON

please write comment at every step in (b)

The following code generates the cats picture.

import numpy as np import matplotlib.pyplot as plt topx=np.array([1, .98, .8, .83, .8, .77, .5, .25, 0, -.25, -.5, -.8, -.8, -.98, -1]) topy=np.array([0, .15, .7, 1.15, 1.03, 1.15, .85, .95, 1, .95, .85, 1.2, .7, .15, 0]) botx=-np.cos(np.pi*np.arange(1,10)/10) boty=-np.sin(np.pi*np.arange(1,10)/10) wiskx=np.array([.2, 1.3, .2, 1.4, .2, 1.4, .2, 1.3, .2, .17, .13, .08, .03, 0]) wisky=np.array([ 0, .3, 0, .1, 0, -.1, 0, -.3, 0, .1, -.1, .1, -.1, 0]) -.2 xeye=np.array([0, .2, .3, .4, .43, .45, .43, .4, .37, .35, .37, .4, .5, .6, .5, .4, .3, .2, 0]) yeye=np.array([.5, .5, .43, .4, .42, .5, .58, .6, .58, .5, .42, .4, .43, .5, .57, .6, .57, .5,.5])-.2 x=np.concatenate((topx,botx,wiskx,xeye,-xeye,-wiskx[::-1])) y=np.concatenate((topy,boty,wisky,yeye, yeye,wisky[::-1])) cat = np.array([x,y]).T plt.plot(cat[:,0], cat[:,1],'b') plt.xlim(-2, 2) plt.ylim(-2, 2) plt.show()

Do the following for each transformation below:

a) create the matrix associated to the given transformation

b) show the effect of applying this matrix to the picture.

The transformations are:

1.Reflection though the x-axis

2.Reflection though the y-axis

3.Reflection though the axis y=x

4.Reflection though the axis y=-x

5.Reflection though the origin

6.Horizontal Contraction by a factor 1/3

7.Vertical Contraction by a factor 1/5

8.Horizontal Expansions by a factor 3

9.Vertical Expansions by a factor of 4

10.HorizontalShearsbyafactorof-1.5then+1.5

11.VerticalShearsbyafactorof-1.5then+1.5

12.Projectionontothex-axis

13.Projectionontothey-axis

14.Rotationbyanangleof/3counterclockwise

15.Rotationbyanangleof/3clockwise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions