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

From ApCoCoAWiki
m (Updated data types)
m (Bot: Category moved)
Line 35: Line 35:
 
     <key>LeastSquaresQR</key>
 
     <key>LeastSquaresQR</key>
 
     <key>numerical.leastsquaresqr</key>
 
     <key>numerical.leastsquaresqr</key>
     <wiki-category>Package_numerical</wiki-category>
+
     <wiki-category>ApCoCoA-1:Package_numerical</wiki-category>
 
   </command>
 
   </command>

Revision as of 16:35, 2 October 2020

Num.LeastSquaresQR

Computes the least squares solution of the linear system of equations Ax=b.

Syntax

Num.LeastSquaresQR(Mat:MAT, Vec:MAT):LIST

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.

This command computes the least squares solution of the linear system of equations Ax=b, if there is no exact solution. The matrix Mat must have the same number of rows as Vec.

The QR decomposition of Mat is used to find the solution.

  • @param Mat Matrix A of the linear system of equations.

  • @param Vec Vector B as a matrix.

  • @return The least squares solution to Ax=b.

Example

Dec(Num.LeastSquaresQR([[1,1],[0,1],[1,1]],[[0],[1],[0]]),2);
-- CoCoAServer: computing Cpu Time = 0
-------------------------------
[<quotes>-0.99</quotes>, <quotes>1</quotes>]
-------------------------------

See also

Introduction to CoCoAServer