Difference between revisions of "ApCoCoA-1:Num.SVD"

From ApCoCoAWiki
(Updated example. Use Dec to display result.)
Line 14: Line 14:
  
 
<example>
 
<example>
D:=Mat([[1,2,7,18],[2,4,9,12],[23,8,9,10]]);
+
D:=[[1,2,7,18],[2,4,9,12],[23,8,9,10]];
Num.SVD(D);
+
Dec(Num.SVD(D),3);
 +
 
 +
-- CoCoAServer: computing Cpu Time = 0
 
-------------------------------
 
-------------------------------
 
[Mat([
 
[Mat([
   [-2608957845014309/4503599627370496, 3400715993947695/4503599627370496, -1196230415249177/4503599627370496, -5542055005031021/36028797018963968],
+
   [<quote>-0.473</quote>, <quote>-0.666</quote>, <quote>-0.575</quote>],
   [-4803191187447087/18014398509481984, 4289880920686871/36028797018963968, 3813211715037953/9007199254740992, 7724713654272699/9007199254740992],
+
   [<quote>-0.415</quote>, <quote>-0.407</quote>, <quote>0.813</quote>],
  [-7645273287337725/18014398509481984, -5741692259075309/36028797018963968, 3381220959856661/4503599627370496, -540919752203371/1125899906842624],
+
   [<quote>-0.776</quote>, <quote>0.624</quote>, <quote>-0.084</quote>]
   [-5789886178591733/9007199254740992, -2813340077166513/4503599627370496, -7780633724302695/18014398509481984, 3606131681355807/36028797018963968]
 
 
]), Mat([
 
]), Mat([
   [1164315100749939/35184372088832, 4798366071344577/281474976710656, 3788674137264815/1125899906842624]
+
   [<quote>33.091</quote>, <quote>17.047</quote>, <quote>3.365</quote>]
 
]), Mat([
 
]), Mat([
   [-8521591816535737/18014398509481984, -3744869794805223/9007199254740992, -6996513907843673/9007199254740992],
+
   [<quote>-0.579</quote>, <quote>-0.266</quote>, <quote>-0.424</quote>, <quote>-0.642</quote>],
   [-3002889242741505/4503599627370496, -7337996657000815/18014398509481984, 2810636692253967/4503599627370496],
+
   [<quote>0.755</quote>, <quote>0.119</quote>, <quote>-0.159</quote>, <quote>-0.624</quote>],
   [-5187087952406809/9007199254740992, 915526145687749/1125899906842624, -6091132379868651/72057594037927936]
+
  [<quote>-0.265</quote>, <quote>0.423</quote>, <quote>0.750</quote>, <quote>-0.431</quote>],
 +
   [<quote>-0.153</quote>, <quote>0.857</quote>, <quote>-0.480</quote>, <quote>0.100</quote>]
 
])]
 
])]
 
-------------------------------
 
-------------------------------

Revision as of 08:08, 7 July 2009

Num.SVD

Computes the singular value decomposition of a matrix.

Syntax

Num.SVD(A:MAT):[U:MAT,S:MAT,VT:MAT]

Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use it/them.

  • @param A The matrix we want to decompose.

  • @return This function returns a list of three matrices which form the singular value decomposition of the input matrix. The list produced is [U, S, VT].

Example

D:=[[1,2,7,18],[2,4,9,12],[23,8,9,10]];
Dec(Num.SVD(D),3);

-- CoCoAServer: computing Cpu Time = 0
-------------------------------
[Mat([
  [<quote>-0.473</quote>, <quote>-0.666</quote>, <quote>-0.575</quote>],
  [<quote>-0.415</quote>, <quote>-0.407</quote>, <quote>0.813</quote>],
  [<quote>-0.776</quote>, <quote>0.624</quote>, <quote>-0.084</quote>]
]), Mat([
  [<quote>33.091</quote>, <quote>17.047</quote>, <quote>3.365</quote>]
]), Mat([
  [<quote>-0.579</quote>, <quote>-0.266</quote>, <quote>-0.424</quote>, <quote>-0.642</quote>],
  [<quote>0.755</quote>, <quote>0.119</quote>, <quote>-0.159</quote>, <quote>-0.624</quote>],
  [<quote>-0.265</quote>, <quote>0.423</quote>, <quote>0.750</quote>, <quote>-0.431</quote>],
  [<quote>-0.153</quote>, <quote>0.857</quote>, <quote>-0.480</quote>, <quote>0.100</quote>]
])]
-------------------------------

See also

Introduction to CoCoAServer

Num.QR

Num.EigenValues

Num.EigenValuesAndVectors

Num.EigenValuesAndAllVectors