cell
inputy
no
screen
OUTPUT
lf
swiss8
off
~\n
1
nolist
fmt
\n\N\n\S
yes
1
yes
fixed
2
degrees
off
5.00
-5.00
5.00
-5.00
5
5
home,home
cdx
1.00 |
home
The script of the home cell of this web inputs from the text field of cell inputm the values of the matrix elements:
m11 m12 ... m14
m21 m22 ... m24
........ ........ ... .......
m41 m42 ... m44
Then it inputs from the text field of cell inputy the values of the right side matrix:
y11 y12
y21 y22
y31 y32
y41 y42
Then it calls the builtin function:
gaussj("m11",4,"y11",2) with four arguments:
"m11" Quoted name of the first cell in the 4x4 matrix
4 Number of rows and columns in the matrix
"y11" Quoted name of the first cell in the y matrix
2 Number of columns in the y matrix
If the function returns zero, the solutions to the four equations:
m11*w+m12*x+m13*y+m14*z=y11
m21*w+m22*x+m23*y+m24*z=y21
m31*w+m32*x+m33*y+m34*z=y31
m41*w+m42*x+m43*y+m44*z=y41
and the four equations:
m11*p+m12*q+m13*r+m14*s=y12
m21*p+m22*q+m23*r+m24*s=y22
m31*p+m32*q+m33*r+m34*s=y32
m41*p+m42*q+m43*r+m44*s=y42
are contained in the y matrix.
w=y11 p=y12
x=y21 q=y22
y=y31 r=y32
z=y41 s=y42
gaussj() returns -1 if the matrix m is singular.
|
inputm
1 2 -3 7
-6 21 14 1
2 10 -3 4
-7 -2 1 2
|
inputy
1.7 14
2.1 -5.6
13 -2
21 -7
|
m11
0.09 |
m12
0.01 |
m13
-0.08 |
m14
-0.16 |
m21
-0.06 |
m22
0.01 |
m23
0.10 |
m24
0.01 |
m31
0.12 |
m32
0.06 |
m33
-0.18 |
m34
-0.09 |
m41
0.20 |
m42
0.02 |
m43
-0.09 |
m44
-0.02 |
OUTPUT
Coefficient Matrix:
1 -6 2 -7
2 21 10 -2
-3 14 -3 1
7 1 4 2
Right side Matrix:
1.7 13
14 -2
2.1 21
-5.6 -7
Solution vectors:
-4.33 -3.86
2.51 2.27
1.50 -1.22
-1.20 2.96 |
outputm
for(rdx=0 to %1-1) {
for(cdx=0 to %2-1) {
out(m11[%1*cdx+rdx]," ")
}
out("\n")
}
|
outputy
|
rdx
3.00 |
y11
-4.33 |
y12
2.51 |
y13
1.50 |
y14
-1.20 |
y21
-3.86 |
y22
2.27 |
y23
-1.22 |
y24
2.96 |