Add some basic letsimp tests based on bug #3950
[maxima.git] / share / linearalgebra / rtest_eigens_by_jacobi.mac
blob7ba99e805e31f907e49dcda5969431b81cf48732
1 (listequalp(p,q) := block([listarith : true], every(lambda([x], is(abs(x) < ?flonum\-epsilon * 10000)), sort(p) - sort(q))),0);
2 0$
4 (matrixequalp(p,q) := every(lambda([x], is(abs(x) < ?flonum\-epsilon * 10000)),p-q),0);
5 0$
7 (m : matrix([1]),0);
8 0$
10 eigens_by_jacobi(m,floatfield);
11 [[1.0], matrix([1.0])];
13 eigens_by_jacobi(m,bigfloatfield);
14 [[1.0b0], matrix([1.0b0])];
16 (m : matrix([0]),0);
19 eigens_by_jacobi(m,floatfield);
20 [[0.0], matrix([1.0])];
22 eigens_by_jacobi(m,bigfloatfield);
23 [[0.0b0], matrix([1.0b0])];
25 (m : matrix([%i]),0);
28 errcatch(eigens_by_jacobi(m,floatfield));
29 []$
31 errcatch(eigens_by_jacobi(m,bigfloatfield));
32 []$
34 (m : matrix([0,0],[0,0]),0);
37 eigens_by_jacobi(m,floatfield);
38 [[0.0,0.0], matrix([1.0,0.0],[0.0,1.0])]$
40 eigens_by_jacobi(m,bigfloatfield);
41 [[0.0b0,0.0b0], matrix([1.0b0,0.0b0],[0.0b0,1.0b0])]$
44 /*-------*/
45 (m : matrix([1,2],[2,1]),0);
48 (e : eigens_by_jacobi(m),0);
51 listequalp(first(e),[-1,3]);
52 true$
54 matrixequalp(transpose(second(e)) . m . second(e), apply('diag_matrix, first(e)));
55 true$
57 /*(e : eigens_by_jacobi(m,bigfloatfield),0);
60 listequalp(first(e),[-1,3]);
61 true$
63 matrixequalp(transpose(second(e)) . m . second(e), apply('diag_matrix, first(e)));
64 true$
66 /*-------*/
67 (m : matrix([14,32,50],[32,77,122],[50,122,194]),0);
70 (e : eigens_by_jacobi(m),0);
73 listequalp(first(e), map('rhs, allroots(charpoly(m,z))));
74 true$
76 matrixequalp(transpose(second(e)) . m . second(e), apply('diag_matrix, first(e)));
77 true$
79 (remvalue(m,e),0);
82 (remfunction(matrixequalp, listequalp),0);