Student[NumericalAnalysis]
IterativeFormula
compute an iterative formula to approximate the solution to a linear system numerically
Calling Sequence
Parameters
Options
Description
Notes
Examples
IterativeFormula(A, b, opts)
IterativeFormula(A, opts)
A
-
Matrix; a square (n-by-n) matrix or an augmented n-by-n+1 matrix of the form (A|b)
b
(optional) Vector; a vector of length n
opts
(optional) equation(s) of the form keyword=value where keyword is one of digits, initialapprox, iterations, method, output, showsteps; the options for computing the iterative formula
digits = posint
Set the environment variable Digits to this value. By default, digits is set to the current value of Digits.
initialapprox = Vector
An initial approximate vector x0; this vector is used to generate a sequence of approximate solution vectors xk using the iterative formula xk+1=T·xk+c. If the iterations option is specified, then the initialapprox option must be specified as well, or an exception will be raised. In order to obtain a sequence of floating-point vectors (instead of exact rationals), the initialapprox vector should contain entries of type float rather than exact integers or rationals.
iterations = posint
The maximum number of iterations to calculate. By default, this is set to 10.
method = gaussseidel, jacobi, SOR(numeric)
One of these three iterative methods for which to compute the matrix T and vector c in the iterative formula xk+1=T·xk+c. By default, the Gauss-Seidel method is used.
Gauss-Seidel method : T=D−L-1·U, c=D−L-1·b
Jacobi method : T=D-1·L+U, c=D-1·b
Successive Overrelaxation method : T=−w⁢L+D-1·1−w⁢D+w⁢U, c=w⁢−w⁢L+D-1·b
In the above expressions, U is the negated upper-triangular part of A, L is the negated lower-triangular part of A, D is the diagonal part of A, and w is extrapolation factor. We always have A=D−L−U.
output = one of L, U, D, T, c, spectralradius, iterates, or a list containing one of more of those
The return value of the command. For more than one output, specify a list of outputs in the order desired. By default, output = [L, U,D, T, c].
The outputs L, U, D, T, and c are as described in the above sections.
If the iterates option is specified, the list of approximate solution vectors xk is output. The total number of vectors returned is determined by the iterations option.
If the spectralradius option is specified, the spectral radius of the iteration matrix T is output.
showsteps = truefalse
Whether to print helpful messages in the interface as the IterativeFormula command executes. By default, this option is set to false.
Given a system A·x=b, the IterativeFormula command computes an equivalent fixed-point system of the form x=T·x+c.
The IterativeFormula command can compute the iteration matrix T and vector c for the following methods: the Gauss-Seidel iterative, Jacobi iterative, and successive over-relaxation methods.
An initial vector is specified using the initialapprox option and then a sequence of approximate solution vectors is generated using the iterative formula xk+1=T·xk+c.
Note that this iterative formula need not produce a converging sequence of vectors xk. It can be shown that such an iterative scheme converges if and only if the spectral radius of the matrix T is strictly less than 1. This spectral radius can be returned as an output via the output option. See below for more details.
This procedure operates symbolically; that is, the inputs are not automatically evaluated to floating-point quantities, and computations proceed symbolically and exactly whenever possible. To obtain floating-point results, it is necessary to supply floating-point inputs.
with⁡StudentNumericalAnalysis:
A≔Matrix⁡1.0,−0.1,2.,0.,−0.1,1.1,−0.1,3.,0.2,−0.1,1.0,−0.1,0.,0.3,−0.1,0.8
A≔1.0−0.12.0.−0.11.1−0.13.0.2−0.11.0−0.10.0.3−0.10.8
b≔Vector⁡0.6,2.5,−1.1,1.5
b≔0.62.5−1.11.5
IterativeFormula⁡A,b,method=jacobi,digits=3,output=T,c
0.0.100−2.000.0.09090.0.0909−2.73−0.2000.1000.0.1000.−0.3750.1250.,0.6002.27−1.101.88
IterativeFormula⁡A,b,method=SOR⁡1.25,iterations=5,initialapprox=Vector⁡0.,0.,0.,0.,digits=4,output=iterates
0.0.0.0.,0.75002.926−1.1970.7850,3.920−0.257−1.9901.958,4.713−3.461−2.2443.127,4.749−6.669−2.4444.309,4.839−9.914−2.6735.498
See Also
Student[LinearAlgebra]
Student[NumericalAnalysis][ComputationOverview]
Student[NumericalAnalysis][IsConvergent]
Student[NumericalAnalysis][IterativeApproximate]
Student[NumericalAnalysis][LinearSolve]
Download Help Document