> | restart; |
Step-by-Step Gauss Elimination -- "stepgauss" Program
Visualizing Linear Transfor m ations in the Plane
Rotation by an Angle
First execute the commands in the following prodedures.
> | with(plottools):with(linalg): |
Warning, the protected names norm and trace have been redefined and unprotected
> | trans:=proc(M,shape) map(v->convert(evalm(M&*v),list),shape); end proc: |
The following defines an asymetrical shape.
> | ASYshape:=[[7/4,0],[2,1/2],[2.1,1/2],[2.1,6/10],[2,6/10],[3/2,3/2],[0,0],[3/2,1/2]]; |
The following command plots the shape. Think of the corners of the shape as the tips of certain vectors. In order to draw the picture, we only have to tell maple what the corners are. The shape is a sequence of points in the plane. The polygon will be collection of line segments connecting one point to the next.
> | plots[display]( (polygon(ASYshape,linestyle=1,thickness=2)),scaling=constrained); |
We would like to translate the shape by the rigid motion that rotates it in the plane by an angle theta. As seen in the book, we use the following matrix representation of the linear transformation.
> | R:=theta->matrix(2,2,[cos(theta), -sin(theta), sin (theta), cos(theta)]);R(theta); |
Let's give the value Pi/3 to theta
> | R(Pi/3); |
> |
The command trans(matrix, shape) defined above will tranform the shape under the linear transformation. Notice that it is multiplying the shape which is a list of points (vectors) by the matrix representing the transformation. The output, is a new list of points, giving the coordinates of where the corners of the transformed shape. Straight lines map to straight lines under linear transformations.
Straight lines get mapped to straight lines. In the example above, we are assuming that a linear transformation will always map a straight line to a new straight line. Lets explore this idea. Think of the points as the tips of two vectors, u and v . An arbitrary point on this line segment gets mapped to a point on the line segment joining the points which are the tips of the vectors T( u ) and T( v ). Here is the proof. If (x,y) is on the line segment joining u and v then,
[x,y] = u + c( v-u ). So T([x,y]) = T( u ) + c(T( v ) - T( u )), which is on the line joining T( u ) and T( v ).
> | newshape:=trans(R(Pi/3),ASYshape); |
Then we can plot the new shape using the plot command.
> | plots[display]( (polygon(newshape,linestyle=1,thickness=2)),scaling=constrained); |
If we want to, we can plot them both in the same coordinate axes.
> | plots[display]( (polygon(ASYshape,linestyle=1,thickness=1)), (polygon(newshape,linestyle=1,thickness=2)),scaling=constrained); |
For which theta is R(theta) invertible? We notice that if sin(theta)=0 or cos(theta)=0 then R(theta) is invertible. If sin(theta)=cos(theta) not=0, R(theta) is invertible. And otherwise R(theta) is invertible with
Since it is invertible, we can represent it by a product of elementary matrices. We start off using stepgauss to find the first few row operations then continue to reduce R(theta) to reduced row echelon form. For each row operation used, we find the elementary matrix.
> | stepgauss(R(theta)); |
Matrix:
Starting column 1
Pivot at [1,1]
Add -sin(theta)/cos(theta) times row 1 to row 2
Starting column 2
Pivot at [2,2]
Row echelon form:
> | theta:=Pi/3; |
> | E1 := matrix(2,2,[1,0,-sin(theta)/cos(theta),1]); |
> |
> | E2 := matrix(2,2,[1/cos(theta),0,0,1]); |
> | E3 := matrix(2,2,[1,0,0,cos(theta)]); |
> | evalm(E3&*E2&*E1&*R(theta)); |
> | E4 := matrix(2,2,[1,sin(theta)/cos(theta),0,1]); |
> | evalm(E4&*E3&*E2&*E1&*R(theta)); |
Thus the product E4 E3 E2 E1 is the inverse of R(theta)
Since the inverse of the inverse of R(theta) is R(theta) itself, we find that
inverse (R(theta)) = inverse (E4 E3 E2 E1)= inverseE1 inverse E2 inverse E3 inverse E4
the inverse of an elementary matrix is still an elementary matrix. So we can see R expressed as a product of elementary matrices as follows.
> | EE1:= inverse(E1); |
> | EE2:= inverse(E2); |
> | EE3:= inverse(E3); |
> | EE4:= inverse(E4); |
check to see that we did everything correctly
> | evalm(EE1&*EE2&*EE3&*EE4); |
which is indeed R(theta) if you look at it right.
Each elementary matrix represents a certain kind of transformation. So now we can break down rotation by an angle theta into several components. on a given shape, you would first perform EE4 then EE3 then EE2 then EE1 So rotaion by an angle is equivalent to first
EE4 - a shear
EE3 - horizonal expansion
EE2 - vertical expansion
EE1 - another shear
We graph them one at a time
> | Firstshear:=trans(EE4,ASYshape): |
> | plots[display]( (polygon(ASYshape,thickness=1)), (polygon(Firstshear,thickness=2)),scaling=constrained); |
> | Horexp:=trans(EE3,Firstshear): |
> | plots[display]((polygon(Firstshear,thickness=1)),(polygon(Horexp,thickness=2)),scaling=constrained); |
> | Vertexp:=trans(EE2,Horexp): |
> | plots[display]((polygon(Horexp,thickness=1)),(polygon(Vertexp,thickness=2)),scaling=constrained); |
> | Secshear:=trans(EE1,Vertexp): |
> | plots[display]((polygon(Vertexp,thickness=1)),(polygon(Secshear,thickness=2)),scaling=constrained); |
> |
> |
> |
> |
> |
The boldfaced graph above is the same as newshape - which is the rotation of ASYshape by Pi/3
N. Eaton, 2002