Singular Value Decomposiyion TI-89 calculator, approximate mode T means transpose sqrt = square root symbol ˆ :svd() :ClrIO :[[ 3,2,4][5,6,8][9,1,0]] ->a Any matrix :aT->at transpose :at*a->ata :eigVl(ata) ->k2 eigenvalues :eigVc(ata) ->k1 eigenvectors :diag( sqrt(k2)) -> e make diagonal matri :Disp ³e²,e :Pause :ClrIO :k1T-> ³v²,v transpose :Pause :ClrIO a*v^(-1)*e^(-1) ->u :Pause :ClrIO :Disp ³u*e*v²,u*e*v test :EndPrgm ======== HP49G+ calculator used in RPN mode in FIX 4 number style a= U*e*V U is a 3x3 matrix in which each column is unitary and the columns are right angle vectors. e is a diagonal matrix in descending order of size V is a 3x3 matrix in which each column is unitary and the columns are right angle vectors. Take an arbitrary 3x3 matrix | 3. 2. 4. | a = | 5. 6. 8. | | 9. 1. 0. | Compute SVD directly a SVD | -0.3845 -0.1410 -0.9128 | u = | -0.7820 -0.4755 0.4030 | | -0.4906 0 .8683 0.0725 | | -0.6950 -0.4364 -0.5714 | v = | 0.7137 -0.3226 -0.6217 | | -0.0869 0.8399 -0.5357 | ee = [ 13,6385 7.0259 0.7931 ] Make ee diagonal ee 3 DIAG-> | 13,6385 0 0 | e = | 0 7.0259 0 | | 0 0 0.7931 | a= U*e*V ======= Compute step by step | 3 5 9 | at = transpose a = | 2 6 1 | a TRN | 4 8 0 | | 115 45 52 | at*a = | 45 41 56 | | 52 56 80 | ata=at*a ata EGV Results | 1.0000 1.0000 -0.1035 | s5 = | 0.6279 -0.4520 1.0000 | | 0.8222 -0.8711 -0.6377 | s6 = [ 186.0077 49.3632 0.6291 ] square root[186.0077]=13.6385 square root[49.3632 ]= 7.0259 square root[ 0.6291 ]= 0.7931 Members of diagonal Create a progran named UNIT to do Gram-Schmidt process on matrix B to produce three vectors in a matrix KK at right angles(Orthonormal). << B TRN OBJ-> DROP { 3. 1. } ->ARRY ŒQ3¹ STO { 3. 1. } -> ARRY ŒQ2¹ STO { 3. 1. } ->ARRY ŒQ1¹ STO Q1 Q1 ABS / ŒK1¹ STO Q2 Q2 Q1 DOT Q1 Q1 DOT / Q1 * - ŒK2¹ STO K2 K2 ABS / ŒK2¹ STO Q3 Q3 Q1 DOT Q1 Q1 DOT / Q1 * - Q3 K2 DOT K2 K2 DOT / K2 * - ŒK3¹ STO K3 K3 ABS / ŒK3¹ STO K1 K2 2. COL+ K3 3. COL+ ŒKK¹ STO KK >> Results | 0.6950 0.7137 -0.0869 | kk = | 0.4364 -0.3226 0.8399 | | 0.5714 -0.6217 -0.5357 | Transpose kk TRN v = | 0.6950 0.4364 0.5714 | | 0.7137 -0.3226 -0.6217 | | -0.0869 0.8399 -0.5357 | Compute u a v 1/x e 1/x ---- * * | -0.3845 -0.1410 -0.9128 | u = | -0.7820 -0.4755 0.4030 | | -0.4906 0 .8683 0.0725 | ===================== TI-89 Gram-Schmidt Vector does GS in TI language == There is much on www about applying SVD to math problems. http://en.wikipedia.org/wiki/Singular_value_decomposition http://www.uwlax.edu/faculty/will/svd/ http://planetmath.org/encyclopedia/SingularValueDecomposition.html http://web.mit.edu/be.400/www/SVD/Singular_Value_Decomposition.htm http://www.gnu.org/software/gsl/manual/html_node/Singular-Value-Decomposition.html http://www.kwon3d.com/theory/jkinem/svd.html http://mathworld.wolfram.com/SingularValueDecomposition.html http://public.lanl.gov/mewall/kluwer2002.html http://rkb.home.cern.ch/rkb/AN16pp/node265.html http://ingrid.ldeo.columbia.edu/dochelp/StatTutorial/SVD/ http://www.cse.unr.edu/~bebis/CS791E/Notes/SVD.pdf http://www.hpl.hp.com/techreports/97/HPL-97-96.pdf http://cnx.org/content/m10739/latest/ http://www2.imm.dtu.dk/~pch/Projekter/tsvd.html http://www.bmva.ac.uk/bmvc/1997/papers/081/node3.html#SECTION00030000000000000000 ===== Least squares using svd 3 equations, 2 unknowns a = | -11 2 | b= | 0 | | 2 3 | | 7 | | 2 -1 | | 5 | Apply svd to a u = | -0.9737 -0.0939 | | 0.1327 -0.9743 | | 0.1854 0.2046 | v= | 0.9885 -0.1511 | | -0.1511 -0.9885 | ee= [ 11.4783 3.3599 ] = [e1 e2 ] d= | 1/e1 0 | | 0 1/e2 | T is transpose xn= vT*d*uT *b xn= | 0.421 | x1 x2 solution | 1.684 |