S.O.S. Mathematics CyberBoard

Your Resource for mathematics help on the web!
It is currently Mon, 20 May 2013 10:35:39 UTC

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Gauss Seidel
PostPosted: Thu, 30 Sep 2010 06:02:42 UTC 
Offline
Member of the 'S.O.S. Math' Hall of Fame
User avatar

Joined: Fri, 8 Apr 2005 16:12:09 UTC
Posts: 333
Hi, I'm trying to do the matrix method for Gauss Seidel and the iterations are coming out different than the equation method so i wanted to know if anyone could explain to me how to go about doing the gauss seidel method with matrices i have

-2x_1+x_2=-200
x_1-2x_2+x_3 = 0
x_2-2x_3 = -100

so I created the strictly upper matrix and the lower matrix and got

Lower:
-2\ \ 0\ \ 0
1\ \ -2\ \ 0
0\ \ 1\ \ -2

Strictly Upper
0\ \ 1\ \ \ 0
0\ \ 0\ \ 1
0\ \ 0\ \ 0

then I found the inverse of the Lower matrix
-1/2\ \ \ \ \ 0\ \ \ \ \ \ \ \ 0
-1/4\ \ -1/2\ \ \ \ 0
-1/8\ \ -1/4\ \ -1/2

then i found Linverse*U and Linverse*b

then used the iterative method of

x^{k+1}=-L^{-1}Ux^k+L^{-1}b

and for my first iteration i got

x_1=-25
x_2=25/2
x_3 = -75/4

with an initial guess of

x_1=x_2=x_3=50

and the solution vector is
x_1=125
x_2=100
x_3 = 75

_________________
“It is impossible for any number which is a power greater than the second to be written as a sum of two like powers. I have a truly marvelous demonstration of this proposition which this margin is too narrow to contain.â€


Top
 Profile  
 
 Post subject: Re: Gauss Seidel
PostPosted: Thu, 30 Sep 2010 07:06:24 UTC 
Offline
Moderator
User avatar

Joined: Mon, 29 Dec 2008 17:49:32 UTC
Posts: 6005
Location: 127.0.0.1, ::1 (avatar courtesy of UDN)
David the Mathlete wrote:
Hi, I'm trying to do the matrix method for Gauss Seidel and the iterations are coming out different than the equation method so i wanted to know if anyone could explain to me how to go about doing the gauss seidel method with matrices i have

-2x_1+x_2=-200
x_1-2x_2+x_3 = 0
x_2-2x_3 = -100

so I created the strictly upper matrix and the lower matrix and got

Lower:
-2\ \ 0\ \ 0
1\ \ -2\ \ 0
0\ \ 1\ \ -2

Strictly Upper
0\ \ 1\ \ \ 0
0\ \ 0\ \ 1
0\ \ 0\ \ 0

then I found the inverse of the Lower matrix
-1/2\ \ \ \ \ 0\ \ \ \ \ \ \ \ 0
-1/4\ \ -1/2\ \ \ \ 0
-1/8\ \ -1/4\ \ -1/2

then i found Linverse*U and Linverse*b

then used the iterative method of

x^{k+1}=-L^{-1}Ux^k+L^{-1}b

and for my first iteration i got

x_1=-25
x_2=25/2
x_3 = -75/4

with an initial guess of

x_1=x_2=x_3=50

and the solution vector is
x_1=125
x_2=100
x_3 = 75


Gauss-Seidel is an iterative method, and there are no reason to expect you arrive at the exact solution with just one iteraton.

In your example, the matrices are
\begin{aligned}
A&=\begin{pmatrix}-2&1&0\\1&-2&1\\0&1&-2\end{pmatrix}\\
L_*&=\begin{pmatrix}-2&0&0\\1&-2&0\\0&1&-2\end{pmatrix}\\
U_*&=\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix}\\
\mathbf{b}&=\begin{pmatrix}-200\\0\\-100\end{pmatrix}
\end{aligned}
and the iterative scheme is
\mathbf{x}^{(k+1)}=L_*^{-1}(\mathbf{b}-U_*\mathbf{x}^{(k)})
i.e.
\begin{aligned}
x^{(k+1)}_1&=-\frac{1}{2}\left(-200-x^{(k)}_2\right)&&=\frac{1}{2}\left(200+x^{(k)}_2\right)\\
x^{(k+1)}_2&=-\frac{1}{2}\left(-x^{(k)}_3-x^{(k+1)}_1\right)&&=\frac{1}{2}\left(x^{(k)}_3+x^{(k+1)}_1\right)\\
x^{(k+1)}_3&=-\frac{1}{2}\left(-100-x^{(k+1)}_2\right)&&=\frac{1}{2}\left(100+x^{(k+1)}_2\right)
\end{aligned}
So the iterative scheme yields
\begin{tabular}{c||c|c|c}
$k$&$x^{(k)}_1$&$x^{(k)}_2$&$x^{(k)}_3$\\\hline
0&50&50&50\\
1&125&87.5&93.75\\
2&143.75&118.75&109.375\\
3&159.375&134.375&117.1875\\
4&167.1875&142.1875&121.09375\\
5&171.09375&146.09375&123.046875\\
6&173.046875&148.046875&124.0234375\\
\vdots&\vdots&\vdots&\vdots
\end{tabular}

Compare this with the exact solution
\mathbf{x}=\begin{pmatrix}175\\150\\125\end{pmatrix}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Contact Us | S.O.S. Mathematics Homepage
Privacy Statement | Search the "old" CyberBoard

users online during the last hour
Powered by phpBB © 2001, 2005-2011 phpBB Group.
Copyright © 1999-2013 MathMedics, LLC. All rights reserved.
Math Medics, LLC. - P.O. Box 12395 - El Paso TX 79913 - USA