Student[LinearAlgebra]
LeastSquares
compute a least squares solution to a set of equations
Calling Sequence
Parameters
Description
Examples
LeastSquares(A, B, options)
A
-
Matrix or set
B
column Vector or set of variables
options
(optional) parameters; for a complete list, see LinearAlgebra[LeastSquares]
For Matrix A and Vector B, the LeastSquares(A, B) command returns a Vector that best satisfies the condition A·x is approximately equal to B, in the least squares sense. The result that is returned is the Vector x which minimizes Norm(A . x - B, 2).
Parameter A can also be a set of equations that describe the linear least squares problem. In this case, B is the set of variables in which the equations in A occur.
with⁡StudentLinearAlgebra:
A≔3,0,4|−2,3,4:
b≔1,2,4:
X≔LeastSquares⁡A,b
X≔35162562125
Norm⁡A·X−b
1625
E≔2⁢x−y+2=0,m⁢x+n⁢y−3=0:
V≔x,y:
LeastSquares⁡E,V
x=−2⁢n−3m+2⁢n,y=2⁢m+3m+2⁢n
See Also
LinearAlgebra[LeastSquares]
Student[LinearAlgebra][LinearSolve]
Student[LinearAlgebra][Norm]
Download Help Document