Graphics Programs Reference
In-Depth Information
-2.5000
-2.0000
-1.5000
-1.0000
-0.5000
0.0000
0.5000
1.0000
1.5000
2.0000
2.5000
3.0000
3.5000
4.0000
4.5000
5.0000
numIter =
259
omega =
1.7055
The convergence is very slow, because the coefficient matrix lacks diagonal
dominance—substituting the elements of A in Eq. (2.30) produces an equalityrather
than the desiredinequality. If we weretochangeeach diagonalterm of the coefficient
matrix from2to 4, A wouldbe diagonallydominant and the solutionwould converge
in only22iterations.
EXAMPLE 2.18
Solve Example 2.17 with the conjugate gradient method, also using n
=
20.
Solution For the given A , the components of the vector Av are
( Av ) 1 =
2 v 1
v 2 +
v n
( Av ) i
=−
v i 1
+
2 v i
v i + 1 ,
i
=
2
,
3
,...,
n
1
( Av ) n =−
v n 1 +
2 v n +
v 1
which areevaluatedbythe following function:
function Av = fex2
18(v)
% Computes the product A*v in Example 2.18
_
Search WWH ::




Custom Search