LinearTransformations.mw

Math 22 Fall 2004

Linear Algebra with Applications


Linear Transformations

October 6, 2004

    Load the packages for graphics and  Linear Algebra

> with(Student[LinearAlgebra]): with(plottools): with(plots):

Warning, the previous binding of the name arrow has been removed and it now has an assigned value

   Define an object in the plane we are going to  play with

> box := rectangle([0, 0], [2, 1], color = green):
face := ellipse([1, 6], 0.7, 1):

lefteye := ellipse([0.7, 6.3], 0.2, 0.15, filled = true, color = red):

righteye := ellipse([1.3, 6.3], 0.2, 0.15, filled = true, color = red):

nose := line([1, 6.1], [1, 5.5]):

smile := ellipticArc([1, 5.5], 0.4, 0.2, Pi..2*Pi):

body := line([1, 5], [1, 3]):

leftarm := line([1, 5], [0, 3]):

rightarm := line([1, 5], [2, 3]):

leftleg := line([1, 3], [0.5, 2]), line([0.5, 2], [0.5, 1]):

rightleg := line([1, 3], [1.5, 2]), line([1.5, 2], [1.5, 1]):

> guy := [face, lefteye, righteye, nose, smile, body, leftarm, rightarm, leftleg, rightleg]:

> picture := display(box, guy, scaling=constrained, view = [-10..10, -10..10], thickness = 2):

> display(picture);

[Plot]

    Perform a shear transformation

> A := <<1, 0> | <1.5, 1>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-5..15, -5..10], title = "");

A := Matrix([[1, 1.5], [0, 1]])

[Plot]

    Another shear transformation

> A := <<1, -2> | <0, 1>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-5..15, -5..10], title = "");

A := Matrix([[1, 0], [-2, 1]])

[Plot]

    Perform a contraction . . .

> A := <<0.5, 0> | <0, 0.5>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-5..15, -5..10], title = "");

A := Matrix([[.5, 0], [0, .5]])

[Plot]

    . . . and dilation

> A := <<2, 0> | <0, 2>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-5..15, -5..15], title = "");

A := Matrix([[2, 0], [0, 2]])

[Plot]

    Also a reflection . . .

> A := <<-1, 0> | <0, -1>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-10..10, -8..8], title = "");

A := Matrix([[-1, 0], [0, -1]])

[Plot]

    . . . and rotation

> A := <<0, 1> | <-1, 0>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-10..10, -5..10], title = "");

A := Matrix([[0, -1], [1, 0]])

[Plot]

    Another rotation

> A := <<1/sqrt(2), 1/sqrt(2)> | <-1/sqrt(2), 1/sqrt(2)>>;
ApplyLinearTransformPlot(A, picture, output = animation, iterations = 1, view = [-10..10, -5..10], title = "");

A := Matrix([[1/2*2^(1/2), -1/2*2^(1/2)], [1/2*2^(1/2), 1/2*2^(1/2)]])

[Plot]

>