linalg(deprecated)/leastsqrs - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : linalg(deprecated)/leastsqrs

linalg(deprecated)

  

leastsqrs

  

least-squares solution of equations

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

leastsqrs(A, b)

leastsqrs(S, v)

Parameters

A

-

matrix

b

-

vector

S

-

set of equations or expressions

v

-

set of names

Description

• 

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[LeastSquares], instead.

  

- For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.

• 

The call leastsqrs(A, b) returns the vector that best satisfies Ax=b in the least-squares sense. The result returned is the vector x which minimizes normAxb,2.

• 

The call leastsqrs(S, v) finds the values for the variables in v which minimize the equations or expressions in S in the least-squares sense. The result returned is a set of equations whose left-hand sides are from v.

• 

For the linear case, if the third optional argument is 'optimize', the routine will find the optimal least square solution (i.e. the vector x with normx,2 being the smallest). At present, the matrix entries must be rationals.

• 

The command with(linalg,leastsqrs) allows the use of the abbreviated form of this command.

Examples

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[LeastSquares], instead.

withlinalg:

Aarray1,1,1,1,2,4,1,0,0,1,1,1

A1111241001−11

(1)

barray3,10,3,910

b3103910

(2)

leastsqrsA,b

3272003012004940

(3)

Sc0910,c0+c1+c23,c0+2c1+4c210,c0c1+c23

Sc0910,c0c1+c23,c0+c1+c23,c0+2c1+4c210

(4)

leastsqrsS,c0,c1,c2

c0=159200,c1=7200,c2=9140

(5)

Aarray1,1,1,1,1,2,2,0,1:

bvector1,2,4:

leastsqrsA,b

_t15+3_t12_t1113

(6)

leastsqrsA,b,optimize

67423141021

(7)

See Also

linalg(deprecated)[linsolve]

LinearAlgebra