|
|
Output from imlasn4.sas |
Source
0 Graphs |
|---|
NOTE: Capture of log output started.
NOTE: %INCLUDE (level 1) file n:\psy6140\examples\iml\imlasn4.sas is file
n:\psy6140\examples\iml\imlasn4.sas.
227 +title 'Green & Carroll problems'; 228 + * ------------------------ ; 229 + 230 +proc iml;
IML Ready
231 + reset print log fuzz fw=6;
232 +
233 +*-- 4.7b,c ;
234 +A = { 3 2 4, 2 0 2, 4 2 3};
A 3 rows 3 cols (numeric)
3 2 4
2 0 2
4 2 3
235 +r = echelon(A);
R 3 rows 3 cols (numeric)
1 0 0
0 1 0
0 0 1
236 +rank = (((echelon(A)^=0)[,+]) ^=0)[+,];
RANK 1 row 1 col (numeric)
3
237 +
238 +A = { 4 3 2 18, 2 1 3 10, 5 7 2 29};
A 3 rows 4 cols (numeric)
4 3 2 18
2 1 3 10
5 7 2 29
239 +r = echelon(A);
R 3 rows 4 cols (numeric)
1 0 0 2.36
0 1 0 2.16
0 0 1 1.04
240 +rank = (((echelon(A)^=0)[,+]) ^=0)[+,];
RANK 1 row 1 col (numeric)
3
241 + *-- Only 3 columns are linearly independent;
242 + * so, we can solve for one as linear comb of other three;
243 + * e.g., solve A[,{1 2 3}] * x = A[,4];
244 +x = solve(A[,1:3], A[,4]);
X 3 rows 1 col (numeric)
2.36
2.16
1.04
245 +print (A[,4]) '=' (A[,1:3] * x);
#TEM1001 #TEM1004
18 = 18
10 10
29 29
246 +
247 +*-- 4.9a;
248 +A = {2 1 4, 1 -1 1, 1 2 3};
A 3 rows 3 cols (numeric)
2 1 4
1 -1 1
1 2 3
249 +b = {13, 2, 10};
B 3 rows 1 col (numeric)
13
2
10
250 +r = echelon(A);
R 3 rows 3 cols (numeric)
1 0 1.6667
0 1 0.6667
0 0 0
251 +r = echelon(A||b);
R 3 rows 4 cols (numeric)
1 0 1.6667 0
0 1 0.6667 0
0 0 0 1
252 + *-- Inconsistent: No exact solution;
253 +
254 +*-- 4.9b;
255 +A = {1 2 6, 1 3 -1, 1 2 0};
A 3 rows 3 cols (numeric)
1 2 6
1 3 -1
1 2 0
256 +b = {16, 12, 10};
B 3 rows 1 col (numeric)
16
12
10
257 +r = echelon(A);
R 3 rows 3 cols (numeric)
1 0 0
0 1 0
0 0 1
258 +r = echelon(A||b);
R 3 rows 4 cols (numeric)
1 0 0 4
0 1 0 3
0 0 1 1
259 + *-- Unique solution; 260 +x = solve(A, b);
X 3 rows 1 col (numeric)
4
3
1
261 +print (A * x) '=' b;
#TEM1001 B
16 = 16
12 12
10 10
262 +quit;
Exiting IML.
NOTE: The PROCEDURE IML used 1.2 seconds.
263 +
NOTE: %INCLUDE (level 1) ending.