File: rtest_lu.mac

package info (click to toggle)
maxima 5.42.1-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 150,192 kB
  • sloc: lisp: 382,565; fortran: 14,666; perl: 14,365; tcl: 11,123; sh: 4,622; makefile: 2,688; ansic: 444; xml: 23; awk: 17; sed: 17
file content (174 lines) | stat: -rw-r--r-- 3,208 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
(kill(values),0);
0$

(saveratprint : ratprint, savefloat2bf : float2bf, ratprint : false, float2bf : true, 0);
0$

(lu_test(m) := block([mp],
  mp : get_lu_factors(lu_factor(m,generalring)),
  zeromatrixp(m - mp[1] . mp[2] . mp[3])),0);
0$
     
lu_test(matrix([1]));
true$

lu_test(matrix([0,1],[1,0]));
true$

lu_test(matrix([0,a],[b,0]));
true$

lu_test(matrix([a,b],[c,d]));
true$

lu_test(matrix([a,b],[b,d]));
true$

lu_test(matrix([1/2,b],[b,2/3]));
true$

lu_test(matrix([1/2 + %i, %i - 1],[9 - %i, 19 + %i]));
true$

lu_test(matrix([0,1,0],[0,0,1],[1,2,4]));
true$

lu_test(matrix([0,a,0],[b,0,0],[0,0,c]));
true$

lu_test(matrix([a,b,c],[d,e,f],[g,h,i]));
true$

lu_test(matrix([0,0,1],[1,0,0],[0,1,0]));
true$

lu_test(matrix([0,0,1],[1,0,0],[0,1,x]));
true$

lu_test(hilbert_matrix(3));
true$

lu_test(hilbert_matrix(4));
true$

lu_test(hilbert_matrix(5));
true$

lu_test(vandermonde_matrix([1,2,%i]));
true$

lu_test(vandermonde_matrix([1 + %i,1 - %i, 8, 32]));
true$

(lu_test(m, tol) := block([mp],
  mp : get_lu_factors(lu_factor(m,bigfloatfield)),
  every(lambda([s], is(cabs(s) < tol)), m - mp[1] . mp[2] . mp[3])),0);
0$

(fpprec : 20,0);
0$

lu_test(vandermonde_matrix([1,1/2,1/3,1/4]), 1.0e-18);
true$

(fpprec : 40,0);
0$

lu_test(vandermonde_matrix([1,1/2,1/3,1/4]), 1.0e-38);
true$

lu_test(hilbert_matrix(13), 1.0e-38);
true$

lu_test(hilbert_matrix(4) + %i * vandermonde_matrix([1,2,3,4]), 1.0e-15);
true$

(lu_test(m, tol) := block([mp],
  mp : get_lu_factors(lu_factor(m,complexfield)),
  every(lambda([s], is(cabs(s) < tol)),m - mp[1] . mp[2] . mp[3])),0);
0$

lu_test(hilbert_matrix(7) + %i * vandermonde_matrix([1,2,3,4,5,6,7]), 1.0e-10);
true$

(m : matrix([1,2,3],[4,5,6],[7,8,10]),0);
0$

(b : m . matrix([x],[y],[z]),0);
0$

lu_backsub(lu_factor(m,crering), b);
''(rat(matrix([x],[y],[z])))$

(m : matrix([0,2,3],[0,5,6],[7,8,10]),0);
0$

(b : m . matrix([x],[y],[z]),0);
0$

lu_backsub(lu_factor(m, crering), b);
''(rat(matrix([x],[y],[z])))$

(m : matrix([0,2,3],[0,5,6],[7,8,10]),0);
0$

(b : m . matrix([x],[y],[z]),0);
0$

lu_backsub(lu_factor(m, crering), b);
''(rat(matrix([x],[y],[z])))$


(m : matrix([0,1,2],[1,0,1],[0,0,8]),0);
0$

(b : m . matrix([x],[y],[z]),0);
0$

lu_backsub(lu_factor(m, crering), b);
''(rat(matrix([x],[y],[z])))$

(m : matrix([matrix([0,1],[1,0]), matrix([1,0],[%i,0])], 
            [matrix([1,0],[0,1]), matrix([1,1],[-1,1])]),0);
0$

(m1 : get_lu_factors(lu_factor(m, noncommutingring)),0);
0$

(matrix_element_mult : ".",0);
0$

zeromatrixp(m1[1] . m1[2] . m1[3] - m);
true$

(m : matrix([matrix([matrix([8,4],[4,13]),matrix([2,4],[7,9])],[matrix([2,7],[4,9]),matrix([10,6],[6,15])]),matrix([matrix([4,4],[12,5]),matrix([0,6],[6,8])],[matrix([8,3],[13,3]),matrix([6,5],[5,6])])],[matrix([matrix([4,12],[4,5]),matrix([8,13],[3,3])],[matrix([0,6],[6,8]),matrix([6,5],[5,6])]),matrix([matrix([18,5],[5,4]),matrix([5,9],[2,6])],[matrix([5,2],[9,6]),matrix([6,3],[3,11])])]),0);
0$

(m1 : get_lu_factors(lu_factor(m,'noncommutingring)),0);
0$

zeromatrixp(m1[1] . m1[2] . m1[3]-m);
true$

(ratprint : saveratprint, float2bf : savefloat2bf, 0);
0$

(kill(values),0);
0$

(kill(lu_test),0);
0$

(matrix_element_mult : "*",0);
0$