Maple Homework 1: Creating and Solving Linear Equations with Matrices in Maple - Prof. Kar, Assignments of Linear Algebra

Instructions on how to create matrices and vectors in maple, and then solve linear equations using these matrices. It covers various ways to create matrices, the concept of row and column vectors, and the use of maple's linearalgebra package. The document also includes exercises for students to practice creating matrices and solving linear equations.

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-n3v
koofers-user-n3v 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MATH 217-4, MAPLE HOMEWORK #1
First, lets start with a little notation. A matrix has size 4 ×5 if it has 4 rows and 5 columns.
Generally speaking, a matrix has size m×nif it has mrows and ncolumns.
We want to introduce how to enter matrices into Maple.
Open up Maple, and enter the following code.
with(LinearAlgebra);
with(Student[LinearAlgebra]);
This loads the linear algebra package into Maple. Let’s create a (coefficient) matrix. There are
several ways to go about doing this. Try entering all of the following lines and see what happens.
M := Matrix([[1, 2, 3], [4, 5, 6], [7,8,10]]);
N := Matrix(1,4);
L := Matrix(3,2);
L[1,2] := 2;
L[2,1] := 5;
L[3,2] := -1;
L;
K := RandomMatrix(3,4);
One often thinks of a matrix Mas a list of rows (or sometimes column) vectors. A column vector
is a vertical vector. A row vector is a horizontal vector. We create vectors in Maple by doing the
following.
v := Vector([1,2,3]);
w := Matrix(3,1);
u :=<4,2,1>;
We can then turn these vectors into a matrix as follows
P := <u|v|w>;
R :=<M|u>;
If we want to create row vectors, we can do the following (note we can also combine them into
a matrix)
a := Vector[row]([1,2,3]);
b := Matrix(1,3);
b[1,2] := 8;
c :=<1|0|1>;
Q :=<a,b,c>;
1
pf3

Partial preview of the text

Download Maple Homework 1: Creating and Solving Linear Equations with Matrices in Maple - Prof. Kar and more Assignments Linear Algebra in PDF only on Docsity!

MATH 217-4, MAPLE HOMEWORK

First, lets start with a little notation. A matrix has size 4 × 5 if it has 4 rows and 5 columns. Generally speaking, a matrix has size m × n if it has m rows and n columns. We want to introduce how to enter matrices into Maple. Open up Maple, and enter the following code. with(LinearAlgebra); with(Student[LinearAlgebra]); This loads the linear algebra package into Maple. Let’s create a (coefficient) matrix. There are several ways to go about doing this. Try entering all of the following lines and see what happens. M := Matrix([[1, 2, 3], [4, 5, 6], [7,8,10]]); N := Matrix(1,4); L := Matrix(3,2); L[1,2] := 2; L[2,1] := 5; L[3,2] := -1; L; K := RandomMatrix(3,4); One often thinks of a matrix M as a list of rows (or sometimes column) vectors. A column vector is a vertical vector. A row vector is a horizontal vector. We create vectors in Maple by doing the following. v := Vector([1,2,3]); w := Matrix(3,1); u :=<4,2,1>; We can then turn these vectors into a matrix as follows P := ; R :=; If we want to create row vectors, we can do the following (note we can also combine them into a matrix) a := Vectorrow; b := Matrix(1,3); b[1,2] := 8; c :=<1|0|1>; Q :=;

1

Ok, now that we know how to create matrices and vectors, lets solve some linear equations! First lets make sure we understand the setup. If we think of the following matrices as augmented matrices corresponding to systems of equations, how many variables and how many equations are in each: In L, M , P , R, K, Q, how many equations, how many variables?

Translate L and R into systems of equations. Can you immediately tell if either are consistent or inconsistent (consistent means there is at least one solution). Use row reduction to solve these equations.

Check your work (and some other matrices) using the following commands. L2 := ReducedRowEchelonForm(L); R2 := ReducedRowEchelonForm(R); M2 := ReducedRowEchelonForm(M); K2 := ReducedRowEchelonForm(K); ReducedRowEchelonForm(); Maple can solve linear equations as well. Try the following code. Then try to interpret what Maple tells you in terms of the row reduced forms. LinearSolve(L); LinearSolve(R); LinearSolve(M); LinearSolve(K);