LinearAlgebra Visualization - 1
The visualization component of the Student[LinearAlgebra] subpackage contains routines that can be used to work with and visualize various concepts in an introductory linear algebra course. This worksheet demonstrates the basics of this functionality for problems involving vectors, planes, and linear systems. The companion worksheet, LinearAlgebra Visualization - 2, demonstrates the similar functionality for problems relating to least squares approximation and eigenvectors.
For further information about the commands in the LinearAlgebra package, see the help page for that command. For a general overview, see LinearAlgebra.
Commands in the package can be referred to using the long form, that is, Student[LinearAlgebra][EigenPlot].
It is recommended to load the package first and then use the shorter command names.
The following examples show how the various routines work.
Note: If you set infolevel[Student] := 1 or infolevel[Student[LinearAlgebra]] := 1, many of the routines in this package provide additional information about the objects they are passed in the form of userinfo messages. This setting is recommended.
Vectors and Planes
The VectorSumPlot command displays the sum of a collection of vectors. The sum is displayed graphically by connecting the head of each vector in the collection to the tail of another vector in the collection. As there are many ways to form these connections, the routine by default displays all connections, effectively producing a lattice whose edges can be followed from the origin to the point that corresponds to the sum. By default, the sum vector is drawn in black.
sum = <4/3, -1/2>
sum = <1, -1, 1>
Alternatively, an animation showing the possible paths one at a time can be requested.
To run the animation sequence:
Click the plot produced by the following command.
sum = <1, -1, 1>
Click the animation controls in the Maple worksheet Context bar.
The cross product of 2 vectors can be displayed using the CrossProductPlot command. By default, the result is colored magenta.
<1, -1, 1/2> &x <0, 2, -1> =
<0, 1, 2>
The visualization commands in the Student[LinearAlgebra] subpackage allow you considerable control over the appearance of the resulting plot. Some controls are associated with particular components of the plot. For example, the colors of the vectors in a CrossProductPlot can be adjusted.
Other controls are global in nature.
CrossProductPlot⁡1,−1,12,0,2,−1,orientation=−50,50,title=Cross product with orientation and view specified,view=−3..3,−3..3,−3..3
To visualize planes and their related vectors in three dimensions, the Student[LinearAlgebra] package provides the PlanePlot command. This command allows you to specify a plane in different ways. It also displays the plane and, optionally, a normal vector, a pair of basis vectors, a vector to a point on the plane from the origin, and the vector from the origin to the closest point on the plane to the origin.
For example, you can specify the plane by specifying its normal vector and a point on it.
normal vector: <-1., .5000, 1.>
equation of plane: -1.*x+.5000*y+1.*z = -.5000
point on plane nearest origin: <.2222, -.1111, -.2222>
basis vectors: <1.155, -.2309, 1.270>, <.5774, 1.617, -.2309>
To see a pair of vectors that form a basis for the plane (when added to the specified point), use the showbasis option.
The plane can also be specified via a set or list of Vectors (the basis), a Vector-valued function of two parameters, or as an equation or algebraic expression in 3 variables. In either the normal vector form or the basis vectors form, if a point on the plane is not specified, then the plane passes through the origin.
normal vector: <.8944, 1.342, .4472>
equation of plane: .8944*x+1.342*y+.4472*z = 0.
point on plane nearest origin: <0., 0., 0.>
basis vectors: <1., -1., 1.>, <1., 0., -2.>
normal vector: <1.095, -.5477, .5477>
equation of plane: 1.095*x-.5477*y+.5477*z = 1.095
point on plane nearest origin: <.6667, -.3333, .3333>
basis vectors: <0., 1.225, 1.225>, <-.7746, 0., 1.549>
In the equation or algebraic form, the variable names must be specified unless there are exactly 3 such names in the first argument.
normal vector: <0., 2., 3.>
equation of plane: 2.*y+3.*z = 2.
point on plane nearest origin: <0., .3077, .4615>
basis vectors: <-.5547, .6923, -.4615>, <-.8321, -.4615, .3077>
Projecting vectors onto lines and planes is a common and important operation. To visualize this operation, use the ProjectionPlot command.
Vector: <1, 1/2>
Projection: <.4615, -.3077>
Orthogonal complement: <.5385, .8077>
Norm of orthogonal complement: .9707
By default, the plot displays the vector being projected, the line or plane onto which it is being projected, the projected vector, and the projection onto the orthogonal complement of the projection line or plane. Furthermore, dashed lines from the head of the input vector to the heads of its projections onto the line or plane and its projection onto the corresponding orthogonal complement are drawn. Using various show... options you can suppress these components and optionally request that the vector or vectors used to define the projection line or plane be shown.
A plane to be projected on is specified as a set or list of vectors. Note: An option of the form option_name = true can be abbreviated to option_name.
Vector: <2, -1, 3>
Projection: <2.704, -1.023, .9336>
Orthogonal complement: <-.7045, .2348e-1, 2.066>
Norm of orthogonal complement: 2.183
Solutions of Linear Systems
Solving a linear system involves finding the set of points that simultaneously satisfy all the equations of the system. In 2-D space, this solution is one of the empty set, a point, or a line. In 3-D space it can be any of those, or a plane. By displaying a plot of the input equations, which represent lines or planes, the physical interpretation of this solution becomes clearer. For a 2-D plot, little more is required.
The solution is the point <.7000, .3000>
The solution is the point <.3000, -.3000>
In three dimensions, the solution to the system may not be apparent from the first presentation of the plot. However, by clicking on the plot and dragging with the mouse, you can manipulate the plot to get a better view. In the default presentation of the following system, one of the planes may appear as a line. Drag the plot to see all 3 planes and their common point of intersection more clearly.
The solution is the point <-.2500, -.2500, 1.500>
The input linear system can also be specified as a Matrix/Vector pair, or as an augmented Matrix.
The solution is the point <.4286, -.1429>
The dimensionality of the system (2x2 or 3x3) is normally determined from the system. In the case of a system specified by a set of equations, you can force the dimensionality to be higher than the apparent dimensionality by specifying the full set of variable names in a list.
The solution is the plane -1.*a-.5000*b = -1.
The Student[LinearAlgebra] subpackage provides two commands that can be used to visualize the action of a linear transformation. The first, LinearTransformPlot, displays domain and range objects in a single plot. The domain object is a line segment, circle, or sphere, as determined by the column dimension of the matrix, while the range object is the image of the domain object under the action of that matrix.
Eigenvector: < 1.366, 1. >
Eigenvector: < -.3660, 1. >
Eigenvector: < 1, -2, 1 >
Eigenvector: < .6856, .8425, 1. >
Eigenvector: < -2.183, -.5928, 1. >
The second command, ApplyLinearTransformPlot, can be used to show the action of a given linear transformation as applied to different domain objects. These input objects can be any of a regular set of objects (circle, square, sphere, cube, or grid) or an arbitrary plot object. The default object is a circle in the 2-D case and a sphere in the 3-D case. Also, by default, 4 successive applications of the transformation are applied (where the input at each step after the first is the output from the previous step).
Eigenvector: < .7070*I, 1. >
Eigenvector: < -.7070*I, 1. >
Eigenvector: < 2.757, 1. >
Eigenvector: < .2417, 1. >
This command can also produce animations.
To run the animation:
Norm: RootOf(576*_Z^3-1648*_Z^2+1116*_Z-121,index = 3)^(1/2)
Eigenvector: < .1983, -2.752, 1. >
Eigenvector: < .1780-.5844*I, .3238+.1260*I, 1. >
Eigenvector: < .1780+.5844*I, .3238-.1260*I, 1. >
To see the action of the transformation more clearly, use the iterations and trace options. If the norm of the matrix is large, use the logscale option.
Eigenvector: < .4000+.7116*I, 1. >
Eigenvector: < .4000-.7116*I, 1. >
Return to Index of Example Worksheets
Download Help Document