#2562 lu_factor needlessly fails

None
open
Barton Willis
None
4
2013-03-09
2013-03-09
Barton Willis
No

Example (from Marek Rychlik)

(%i42) lu_factor(matrix([1,1,1],[1,1,1],[1,1,3]));
Unable to compute the LU factorization

Maxima should be able to find this factorization:

(%i43) lu_factor(matrix([1,1,1],[1,1,1],[1,q,3]));
(%o43) [matrix([1,1,1],[1,0,0],[1,q-1,2]),[1,3,2],generalring]

(%i44) get_lu_factors(%);
(%o44) [matrix([1,0,0],[0,0,1],[0,1,0]),matrix([1,0,0],[1,1,0],[1,0,1]),matrix([1,1,1], [0,q-1,2],[0,0,0])]

(%i45) subst(q=1,%);
(%o45) [matrix([1,0,0],[0,0,1],[0,1,0]),matrix([1,0,0],[1,1,0],[1,0,1]),matrix([1,1,1], [0,0,2],[0,0,0])]

Check:

(%i46) first(%).second(%).third(%);
(%o46) matrix([1,1,1],[1,1,1],[1,1,3])

Discussion