1 What's New (Decemeber 2005)
3 (1) New texi documentation; courtesy of Robert Dodier.
5 (2) Added function mat_fullunblocker; a fully recursive version of
8 (3) Added function mat_trace; a block matrix friendly function for
11 (4) Improved algorithm for matrix condition number estimation.
13 The new version of linalg can be downloaded from
14 http://www.unk.edu/facstaff/profiles/willisb/.
16 A tour of new functions:
18 (1) The file linearalgebra/conjugate.lisp has an alternative to
19 the /eigen/conjugate function. The /eigen/conjugate function
20 only does the substitution %i --> -%i. The conjugate
21 function in linearalgebra is (I hope) somewhat smarter.
23 (%o1) c:/maxima/linearalgebra/linalg.mac
24 (%i2) declare(z,complex)$
25 (%i3) conjugate([z,z^2,sqrt(z)]);
26 (%o3) [conjugate(z),conjugate(z)^2,conjugate(sqrt(z))]
28 Off the branch cut of sqrt, conjugate and sqrt commute. Telling
29 Maxima that z isn't on branch cut allows it to transform
30 conjugate(sqrt(z)) --> sqrt(conjugate(z)).
32 (%i4) assume(imagpart(z) > 0)$
33 (%i5) conjugate(sqrt(z));
34 (%o5) sqrt(conjugate(z))
36 (2) New functions for generating matrices:
38 (%i6) hilbert_matrix(2);
39 (%o6) matrix([1,1/2],[1/2,1/3])
40 (%i7) vandermonde_matrix([a,b]);
41 (%o7) matrix([1,a],[1,b])
43 (3) A matrix kronecker_product
45 (%i9) kronecker_product(hilbert_matrix(2), vandermonde_matrix([5,6]));
46 (%o9) matrix([1,5,1/2,5/2],[1,6,1/2,3],[1/2,5/2,1/3,5/3],[1/2,3,1/3,2])
48 (4) A function that converts block matrices to unblocked matrices
50 (%i12) matrix([matrix([4,5]), matrix([6,7])]);
51 (%o12) matrix([matrix([4,5]),matrix([6,7])])
52 (%i13) mat_unblocker(%);
53 (%o13) matrix([4,5,6,7])
57 There is code for LU factorization. It uses partial pivoting when
58 the matrix is numeric.
61 Warning - you are redefining the Maxima function RANK
62 (%o1) c:/maxima/linearalgebra/linalg.mac
63 (%i2) lu_factor(matrix([a,b],[c,d]));
64 (%o2) [matrix([a,b],[c/a,d-(b*c)/a]),[1,2]]
66 Do the LU factorization using CRE expressions. Try this using
67 the general representation -- it is very slow.
69 (%i4) lu_factor(vandermonde_matrix([a,b,c,d,e]),crefield)$
71 (%i6) factor(product(m[i,i],i,1,5));
72 (%o6) (b-a)*(c-a)*(c-b)*(d-a)*(d-b)*(d-c)*(e-a)*(e-b)*(e-c)*(e-d)
74 LU factor using CL complex numbers
76 (%i14) w[i,j] := ?random(1.0) + %i * ?random(1.0)$
77 Evaluation took 0.00 seconds (0.00 elapsed)
78 (%i15) m : genmatrix(w,100,100)$
79 Evaluation took 0.45 seconds (0.45 elapsed)
80 (%i16) lu_factor(m,complexfloatfield)$
81 Evaluation took 1.73 seconds (1.73 elapsed)
83 (This code will not win any speed awards.)
85 There is also code for solving linear systems using the LU
88 (%i19) m : hilbert_matrix(5)$
89 (%i20) m : lu_factor(m)$
90 (%i21) lu_backsub(m, matrix([1],[1],[1],[1],[1]));
91 (%o21) matrix([5],[-120],[630],[-1120],[630])
92 (%i22) hilbert_matrix(5) . %;
93 (%o22) matrix([1],[1],[1],[1],[1])
95 (6) My spectral representation code is now included in linalg.
97 As always, let me know how I can improve this code.