cell
inputa
no
screen
output
lf
swiss13
on
~\n
1
nolist
inptr
\n\N
no
input
1
yes
fixed
4
degrees
off
5.0000
-5.0000
5.0000
-5.0000
5
5
home,home
a01
1.0000 |
a02
0.0000 |
a03
0.0000 |
a04
0.2790 |
a05
0.0000 |
a06
1.0000 |
a07
0.0000 |
a08
-0.8267 |
a09
0.0000 |
a10
0.0000 |
a11
1.0000 |
a12
-2.4665 |
a13
0.0935 |
a14
0.0169 |
a15
-0.0340 |
a16
-0.2011 |
a17 |
a18 |
a19 |
a20 |
a21 |
a22 |
a23 |
a24 |
a25 |
b1
0.6333 |
b2
-0.3367 |
b3
-0.7675 |
b4
-0.2342 |
b5 |
cdx
3.0000 |
home
This web illustrates the use of Mathweb's builtin functions rref() and gaussj() for manipulating matrices.
The cell 'row_reduce' contains a script which demonstrates the use of the Mathweb builtin function rref(), which converts a matrix to its reduced row echelon form.
The cell 'inverta' has a script which illustrates the use of the Mathweb builtin function gaussj() which, among other things, inverts a square matrix.
The cell 'solveab' demonstrates the use of gaussj() to solve the matrix equation:
Mx=b
where M is a 4X4 matrix, and b is 4X1 column matrix.
0.00 |
inputa
12 8 -7 14
-3 21 -9 4
-1 -3 -6 17
5.5 6 -3 -1
|
inputb
7
-3
1
4
|
inverta
To generate the inverse of a square matrix, gaussj() may be called with two arguments:
A quoted cell name, which tells which cell is the first cell
in the matrix to be inverted.
An expression which evaluates to the number of rows
and columns in the square matrix.
The cells of the matrix are laid out in row-column order in the sequence of cells beginning with the quoted cellname.
|
OUTPUT
1 2 -4 3
7 -4 1 2
-6 3 2 1
1 3 -1 0 |
outputa
|
outputb
|
rdx
2.0000 |
row_reduce
This cell puts an 3X4 matrix into its reduced row echelon form. This technique will work with matrices with up to 60 or 70 total cells.
The function rref() takes two arguments:
1) The quoted name of the cell which begins the matrix to be reduced.
2) The number of rows in the matrix to be reduced.
3) The number of columns in the matrix to be reduced.
Cells with values below a certain delta are assumed to have zero value. To set delta, set the number of decimal places in the Numeric Preferences. For Fixd and Scientific type numbers, delta is half of 10E-d, where d is the number of decimal places. For general type numbers, delta is 0.5*10E-14.
|
solveab
In this cell, gaussj() is used to compute the solution to four linear equations in four unknowns. The method can easily be expanded to support 7 or eight equations in as many unknowns.
The linear equation coefficients are represented by the value of the matrix which begins at cell "a01". The right hand sides of the equations are contained in the column vector which starts at cell "b1".
Gaussj is called with four arguments:
1) The quoted name of the cell that begins the matrix.
2) An expression which evaluates to the number of rows and columns in the square matrix.
3) The name of the cell which begins the column matrix containing the right hand side(s) of the equations.
(It is possible to solve for the unknowns using more than one set of right hand side values. This example uses only one set.)
4) The number of right-hand side column vectors
Gaussj() returns zero when it succeeds, and -1 if the matrix supplied is singular.
|