ApCoCoA-1:Num.LeastSquaresQR: Difference between revisions

From ApCoCoAWiki
Jan (talk | contribs)
No edit summary
m replaced <quotes> tag by real quotes
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
   <command>
   {{Version|1}}
     <title>Numerical.LeastSquaresQR</title>
<command>
     <short_description>Calculates the least squares solution to the general problem Ax=b</short_description>
     <title>Num.LeastSquaresQR</title>
     <short_description>Computes the least squares solution of the linear system of equations <tt>Ax=b</tt>.</short_description>
<syntax>
<syntax>
Num.LeastSquaresQR(Mat:Matrix, Vec:Matrix):Matrix;
Num.LeastSquaresQR(Mat:MAT, Vec:MAT):LIST
</syntax>
</syntax>
     <description>
     <description>
{{ApCoCoAServer}} Please also note that you will have to use an ApCoCoAServer with enabled BLAS/LAPACK support.
<em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them.
<par/>
This command computes the least squares solution of the linear system of equations <tt>Ax=b</tt>, if there is no exact solution. The matrix <tt>Mat</tt> must have the same number of rows as <tt>Vec</tt>.
The QR decomposition of <tt>Mat</tt> is used to find the solution.  


Calculates the least squares solution to the general problem Ax=b, when there is no exact solution. The matrix Mat must have the same number of rows as Vec.
<itemize>
The QR decompostion of Mat is used to find the solution.
<item>@param <em>Mat</em> Matrix <tt>A</tt> of the linear system of equations.</item>
<item>@param <em>Vec</em> Vector <tt>B</tt> as a matrix.</item>
<item>@return The least squares solution to <tt>Ax=b</tt>.</item>
</itemize>


<example>
<example>
Line 15: Line 22:
-- CoCoAServer: computing Cpu Time = 0
-- CoCoAServer: computing Cpu Time = 0
-------------------------------
-------------------------------
Mat([
["-0.99", "1"]
  ["-0.99"],
  ["1"]
])
-------------------------------
-------------------------------
</example>
</example>
     </description>
     </description>
     <seealso>
     <seealso>
       <see>Introduction to CoCoAServer</see>
       <see>ApCoCoA-1:Introduction to CoCoAServer|Introduction to CoCoAServer</see>
     </seealso>
     </seealso>
     <types>
     <types>
       <type>cocoaserver</type>
       <type>apcocoaserver</type>
      <type>matrix</type>
     </types>
     </types>
    <key>numerical.LeastSquaresQR</key>
     <key>Num.LeastSquaresQR</key>
     <key>Num.LeastSquaresQR</key>
     <key>LeastSquaresQR</key>
     <key>LeastSquaresQR</key>
     <wiki-category>Package_numerical</wiki-category>
    <key>numerical.leastsquaresqr</key>
     <wiki-category>ApCoCoA-1:Package_numerical</wiki-category>
   </command>
   </command>

Latest revision as of 13:47, 29 October 2020

This article is about a function from ApCoCoA-1.

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
-------------------------------
["-0.99", "1"]
-------------------------------

See also

Introduction to CoCoAServer