QR factorization & backsubstitution



I have now given an exact and arbitrary precision implementation of QR decomposition, including back-substitution, at http://rosettacode.org/wiki/QR_decomposition#Maxima.  This is an adaptation of some code I wrote for Axiom.

Interestingly, an exact solution for the polynomial regression for Maxima (polyfit without the bfloats) lead to a stack overflow (cf. Axiom):

polyfit(x,y,n) := block([a,j],
  a : genmatrix(lambda([i,j], if j=1 then 1 else x[i,1]^(j-1)),
    length(x),n+1),
  lsqr(a,y));
polyfit(x, y, 2); /* fails on Windows 7 64 bit with Maxima 5.28.0 using SBCL 1.0.50 */

Kindly, Mark.
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Ether Jones
Sent: Friday, 8 March 2013 2:02 AM
To: maxima
Subject: QR factorization & backsubstitution

Does Maxima have QR factorization built in?

i.e.  A = Q*R

where A has more rows than columns, Q is orthogonal, and R is upper triangular?

Also, does  Maxima have a backsubstitution method, so that
the overdetermined linear system  Ax~b can be solved using QR factorization by solving Rx=Q'b by backsubstitution?