LinearSolve - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Student[NumericalAnalysis]

  

LinearSolve

  

numerically approximate the solution to a linear system

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

LinearSolve(A, b, opts)

LinearSolve(A, opts)

Parameters

A

-

Matrix; a square nxn matrix or an augmented (A|b) nxm matrix where m=n+1

b

-

(optional) Vector or Matrix; a vector of length n or a matrix of column length n

opts

-

(optional) equation(s) of the form keyword = value, where keyword is one of initialapprox, maxiterations, method, stoppingcriterion, tolerance; options for numerically approximating the solution to a linear system

Options

• 

initialapprox = Vector or Matrix

  

The initial approximation. To obtain a float solution instead of an exact solution, the initialapprox should contain floats instead of integers. By default, a zero vector is used.

• 

maxiterations = posint

  

The maximum number of iterations to perform while approximating the solution to A·x=b.  If the maximum number of iterations is reached and the solution is not within the specified tolerance, a plot of distances can still be returned. By default, maxiterations = 20.

• 

method = jacobi, gaussseidel, SOR(numeric), LU, LU[tridiagonal], PLU, or PLU[scaled]

  

The method to use when solving the linear system A·x=b. Please see the Notes section for sufficient conditions for convergence. This option is required. Each method is described below:

– 

jacobi : The Jacobi method. Optionally, the stoppingcriterion, maxiterations, initialapprox and tolerance options may be specified as well.

– 

gaussseidel : The Gauss-Seidel method. Optionally, the stoppingcriterion, maxiterations, initialapprox and tolerance options may be specified as well.

– 

SOR(w) : The Successive Overrelaxation method with w as its extrapolation factor. Optionally, the stoppingcriterion, maxiterations, initialapprox and tolerance options may be specified as well.

– 

LU and LU[tridiagonal] : LU Decomposition. This method performs LU factorization on A and then solves the subsequent systems. None of the remaining options are used with this method. An error will be raised if the LU[tridiagonal] method is specified and A is not tridiagonal.

– 

PLU and PLU[scaled] :  PLU Decomposition. This method performs PLU factorization on A and then solves the subsequent systems. None of the remaining options are used with this method.

• 

stoppingcriterion = distance(norm)

  

The stopping criterion for an iterative technique; it is of the form stoppingcriterion=distance(norm), where distance is either relative or absolute and norm is a nonnegative integer, infinity, or Euclidean. By default, stoppingcriterion=relative(infinity).

• 

tolerance = positive

  

The tolerance of the approximation. By default, a tolerance of 110000 is used.

Description

• 

The LinearSolve command numerically approximates the solution to the linear system A·x=b, using the specified method.

• 

The IterativeApproximate command and the MatrixDecomposition command are both used by the LinearSolve command.

• 

If b is a matrix, then the systems A·x=bi will be solved for each column bi of b, and hence there will be multiple solutions returned.

• 

Different options are required to be specified in opts, depending on the method.  These dependencies are outlined in the Options section.

• 

The Notes section in the Student[NumericalAnalysis][IterativeApproximate] help page lists conditions under which the Jacobi, Gauss-Seidel, and successive over-relaxation iterative methods produce a solution.

Examples

withStudentNumericalAnalysis:

AMatrix10.,1.,2.,0.,1.,11.,1.,3.,2.,1.,10.,1.,0.,3.,1.,8.

A10.−1.2.0.−1.11.−1.3.2.−1.10.−1.0.3.−1.8.

(1)

bVector6.,25.,11.,15.

b6.25.−11.15.

(2)

LinearSolveA,b,method=SOR1.25,initialapprox=Vector0.,0.,0.,0.,maxiterations=100,tolerance=104

0.99997764402.000001578−0.99999423340.9999867498

(3)

LinearSolveA,b,method=LU

1.0000000002.000000000−1.0000000000.9999999999

(4)

Try solving multiple systems (but with the same coefficient Matrix)

BMatrix6.,25.,11.,15.,7.,8.,16.,4.,4.,2.,9.,5.,17.,6.,3.,22.

B6.25.−11.15.7.8.16.4.4.2.9.5.17.6.3.22.

(5)

LinearSolveA,B,method=PLU

0.50953346860.14820824860.52643678162.135226505,2.6235294120.8352941177−0.20000000000.4117647058,−1.2109533471.4651791751.287356321−0.01352265042,1.376064909−0.26004056810.48965517242.908722110

(6)

See Also

Student[LinearAlgebra]

Student[NumericalAnalysis]

Student[NumericalAnalysis][BackSubstitution]

Student[NumericalAnalysis][ComputationOverview]

Student[NumericalAnalysis][ForwardSubstitution]

Student[NumericalAnalysis][IterativeApproximate]

Student[NumericalAnalysis][MatrixDecomposition]