SlideShare una empresa de Scribd logo
1 de 15
PAPER –
CAP643

 Submitted To: -

 Submitted By: Abhishek Kumar

Mrs. Kavisha
Mam

~1~

Roll No: - 1207B333
Reg No: - 11210885
Course: - MCA 3rd
Sem. Section: D1207
ACKNOWLEDGEMENT
The experience that we have gathered during this Design
Problem has been unique .For this we are pleased to express
our deepest sense of gratitude and regards to our respected
teacher Mrs. Kavisha Mam for their guidance, inspiration
and constructive suggestions that helps us in the preparation
of the design problem.
I am also thankful to my classmate
constant encouragement and support.

2
INDEX
SL. NO.
1
2
3
4
5
6
7

CONTENTS
Introduction
Abstract
Operation on Jacobi Method
Comparison with other linear equation
Implementation of Jacobi Method in C
Advantages
Disadvantages

3

PAGE NO.
4
4-6
6-9
9-12
13-14
15
15
INTRODUCTION
Gauss Jacobi method is the first iterative method used to solve linear
system of equations. This project explains you how to solve the linear
equation using Gauss Jacobi iterative method

Abstract:This paper is concerned with the application of preconditioning
techniques to the well-known Jacobi iterative method for solving the
finite difference equations derived from the discretization of self-ad
joint elliptic partial differential equations. The convergence
properties of this one parameter preconditioned method are
analyzed and the value of the optimum preconditioning parameter
and the performance of the method determined for a variety of
standard problems.
Jacobi method involves rewriting equation 1 as follow:
X=D-1(L+U)x+D-1b
If we express it as an iterative method, we see it takes the form:
X(k+1)=Gx(k)+f
As a motivational example, we assume start with a linear system like
this one:
1
5
9

2
6
1

3
7
2

x1
x2
x3

*

4

=

4
8
3
Let us solve the ith equation for xi :
X1 = (4- 2x2-3x3)/1
X2 = (8- 5x1-7x3)/6
X3 = (3- 9x1-x2)/2

We can express this as an iterative method and rewrite it in a matrix
format.
x1
x2
x3

(k+1)

=

(k)

1/1
0
0 1/6
0
0

0
0
1/2

1/1
0
0 1/6
0
0

0
0
1/2

0
-5
-9

*

*

-2
0
-1

4
8
3

5

-3
-7
0

x1
* x2
x3

+
x1
x2
x3

(k+1)

=

0
-5/6
-9/2

-1/2 -1/3
0 -7/6
-1/2
0

*

x1
x2 +
x3

1/4
8/6
3/2

As you see, this takes the form x(k+1)=Gx(k)+f.
Let's implement Jacobi's method for this problem.
There are some steps which are followed by Gauss Jacobi
method to perform certain operation:
Step 1
• Find the value of x1 from the first equation by substituting the initial
values of other unknowns.
• Find the value of x2 from the first equation by substituting the initial
values of other unknowns.
• Find the value of x3 from the first equation by substituting the initial
values of other unknowns.

And so on till the value of xn is computed from the nth equation using
the initial values of x1, x2,…. xn-1.
6
Step 2
•

Find out the value of x1 from the first equation by substituting

the values of other unknowns got in the 1st iteration.
•

Find out the value of x2 from the first equation by substituting

the values of other unknowns got in the 1st iteration.
•

Find out the value of x3 from the first equation by substituting

the values of other unknowns got in the 1st iteration.

Step 3
•

Find out the value of x1 from the first equation by substituting

the values of other unknowns got in the 2nd iteration.
•

Find out the value of x2 from the first equation by substituting

the values of other unknowns got in the 2nd iteration.
•

Find out the value of x3 from the first equation by substituting

the values of other unknowns got in the 2nd iteration.

7
Example
x1+2x2+3x3 = 4
5x1+ 6x2+7x3 = 8
9x1+x2+2x3 = 3
Sol: As you see the system is diagonal system, therefore the
convergence is assured. Since we want the solution correct up to 4
significant digits, therefore the iterative process will terminate as soon
as we find the successive iteration do not produce any change at first
four significant positions.
We rewrite the given system of equations as
X1 = (4- 2x2-3x3)/1
X2 = (8- 5x1-7x3)/6
X3 = (3- 9x1-x2)/2

8
We start with initial approximation as
X1 = X2 = X3 = 0
Iteration 1: Substituting the initial values in the above equation, we
obtain
X1 =4.0000 X2 = 1.3333

X3 =1.5000

Iteration 2: Substituting the initial values in the above equation, we
obtain
X1 = -3.1667

X2 = -3.7500

X3 = -17.1667

Now compare Gauss Jacobi method from
other linear equation like Gauss Seidel
Method
Gauss Seidel Method
In Jacobi’s method, even though the new values of unknowns are
computed in each iteration, but the values of unknowns in previous
iterations are used in the subsequent iterations.
That is, although a new value of x1 is computed from the first
equation in a current iteration, but it is not used to compute the new
values of other unknowns in the current iteration.

9
Note that the new values of the unknown are better than the old
values, and should be used in preference to the poorer values

Step 1
• Find out the value of x1 from the first equation by substituting the
initial values of other unknowns.
• Find out the value of x2 from the second equation by substituting
current value of x1 and the initial values of other unknowns.
• Find out the value of x3 from the first equation by substituting the
current value of x1 and x2 initial values.

And so on till the value of xn is computed from the nth equation using
the initial values of x1, x2,…. xn-1.

10
Now we will solve same equation by Gauss Seidel method and
then we will find the basic difference between both the methods.
Our equation is:
x1+2x2+3x3 = 4
5x1+ 6x2+7x3 = 8
9x1+x2+2x3 = 3
Sol: As you see the system is diagonal system, therefore the
convergence is assured. Since we want the solution correct up to 4
significant digits, therefore the iterative process will terminate as soon
as we find the successive iteration do not produce any change at first
four significant positions.
We rewrite the given system of equations as:
X1 = (4- 2x2-3x3)/1
X2 = (8- 5x1-7x3)/6
X3 = (3- 9x1-x2)/2
We start with initial approximation as
X1 = X2 = X3 = 0
Iteration 1: Substituting X2 = X3 = 0 in the first equation, we Obtain
11
X1 =4.0000
Substituting X1 = 4.0000 X3 = 0 in the second equation, we Obtain
X2 = -2.0000
Substituting

X1 = 4.0000 X2 = -2.0000 in the third equation, we

Obtain
X3 =-15.5000
Thus, we obtain
X1 =4.0000

X2 = -2.0000

X3 =-15.5000

Iteration2: Now Substituting X2 =-2.0000 X3 = -15.5000 in the first
equation, we Obtain
X1 =54.5000
Substituting X1 = 54.5000 X3 = -15.5000 in the second equation, we
Obtain
X2 = -26.0000
Substituting X1 = 54.5000 X2 = -26.0000 in the third equation, we
Obtain
X3 =-230.7500
Thus, we obtain
X1 =54.5000

X2 = -26.0000

X3 =-230.7500

Note: - now you can easily compare with both the output. Then
you got different answer in both the iterative method.

12
Implementation of Gauss Jacobi method in C
Language:-

#include<stdio.h>
#include<conio.h>
#include<math.h>
float fx(float y,float z)
{
float x;
x=(4-2*y-3*z)/1;
return x;
}
float fy(float x,float z)
{
float y;
y=(8-5*x-7*z)/6;
return y;
}
float fz(float x,float y)
{
13
float z;
z=(3-9*x-y)/2;
return z;
}
void main()
{
float x=0,y=0,z=0,tx,ty,tz;
int i,n;
clrscr();
printf("Enter the number of iteration:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
tx=fx(y,z);
ty=fy(x,z);
tz=fz(x,y);
x=tx;
y=ty;
z=tz;
}
printf("X=%fn",x);
printf("Y=%fn",y);
printf("Z=%f",z);
getch();
}
14
Advantages and disadvantages
Advantages:
1. Iterative.
The Jacobi method first generates inexact results and subsequently
refines its results at each iteration, with the residuals converging at an
exponential rate. For many applications, this is highly desirable.

Disadvantages:
1. Inflexible.
The Jacobi method only works on matrices A for which ρ(A) < 1, or ||
A|| < 1holds. This makes it inapplicable to a large set of problems.
Furthermore, determining whether a matrix satisfies the previous
conditions is expensive to compute.
2. Large Set-Up Time.
The Jacobi method cannot immediately begin producing results.
Before it can begin its iteration, a matrix −D −1(L+U) must be
computed. For large input matrices, this may not be a trivial
operation, as it takes O(n2) time to perform this matrix multiplication.
The result is a significant lag before any results can be output.
15

Más contenido relacionado

La actualidad más candente

Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equations
ZunAib Ali
 

La actualidad más candente (20)

Jacobi and gauss-seidel
Jacobi and gauss-seidelJacobi and gauss-seidel
Jacobi and gauss-seidel
 
Homogeneous Linear Differential Equations
 Homogeneous Linear Differential Equations Homogeneous Linear Differential Equations
Homogeneous Linear Differential Equations
 
Gaussian Elimination Method
Gaussian Elimination MethodGaussian Elimination Method
Gaussian Elimination Method
 
lagrange interpolation
lagrange interpolationlagrange interpolation
lagrange interpolation
 
Interpolation
InterpolationInterpolation
Interpolation
 
Gauss jordan method.pptx
Gauss jordan method.pptxGauss jordan method.pptx
Gauss jordan method.pptx
 
Romberg
RombergRomberg
Romberg
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
 
Gauss jordan
Gauss jordanGauss jordan
Gauss jordan
 
presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve
 
Implementation of Gauss Elimination Method in c++
Implementation of Gauss Elimination Method in c++Implementation of Gauss Elimination Method in c++
Implementation of Gauss Elimination Method in c++
 
Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equations
 
Error analysis in numerical integration
Error analysis in numerical integrationError analysis in numerical integration
Error analysis in numerical integration
 
Jacobi iterative method
Jacobi iterative methodJacobi iterative method
Jacobi iterative method
 
Gauss Elimination & Gauss Jordan Methods in Numerical & Statistical Methods
Gauss Elimination & Gauss Jordan Methods in Numerical & Statistical MethodsGauss Elimination & Gauss Jordan Methods in Numerical & Statistical Methods
Gauss Elimination & Gauss Jordan Methods in Numerical & Statistical Methods
 
Gauss elimination & Gauss Jordan method
Gauss elimination & Gauss Jordan methodGauss elimination & Gauss Jordan method
Gauss elimination & Gauss Jordan method
 
Simpson’s one third and weddle's rule
Simpson’s one third and weddle's ruleSimpson’s one third and weddle's rule
Simpson’s one third and weddle's rule
 
Linear and non linear equation
Linear and non linear equationLinear and non linear equation
Linear and non linear equation
 
Group Theory
Group TheoryGroup Theory
Group Theory
 
Gauss jordan and Guass elimination method
Gauss jordan and Guass elimination methodGauss jordan and Guass elimination method
Gauss jordan and Guass elimination method
 

Destacado

Solution of equations for methods iterativos
Solution of equations for methods iterativosSolution of equations for methods iterativos
Solution of equations for methods iterativos
DUBAN CASTRO
 
Metodos interactivos
Metodos interactivosMetodos interactivos
Metodos interactivos
Robinson
 
Metodos jacobi y gauss seidel
Metodos jacobi y gauss seidelMetodos jacobi y gauss seidel
Metodos jacobi y gauss seidel
Cesar Mendoza
 
Iterative methods for the solution of systems of linear equations
Iterative methods for the solution of systems of linear equationsIterative methods for the solution of systems of linear equations
Iterative methods for the solution of systems of linear equations
NORAIMA
 
DB Devlop- PostgreSQL 9.2.4 IQ 15.4
DB Devlop- PostgreSQL 9.2.4  IQ 15.4DB Devlop- PostgreSQL 9.2.4  IQ 15.4
DB Devlop- PostgreSQL 9.2.4 IQ 15.4
Sunny U Okoro
 

Destacado (20)

Solution of equations for methods iterativos
Solution of equations for methods iterativosSolution of equations for methods iterativos
Solution of equations for methods iterativos
 
Chapter v
Chapter vChapter v
Chapter v
 
Iterative methods
Iterative methodsIterative methods
Iterative methods
 
Metodos interactivos
Metodos interactivosMetodos interactivos
Metodos interactivos
 
Metodos jacobi y gauss seidel
Metodos jacobi y gauss seidelMetodos jacobi y gauss seidel
Metodos jacobi y gauss seidel
 
metode iterasi Gauss seidel
metode iterasi Gauss seidelmetode iterasi Gauss seidel
metode iterasi Gauss seidel
 
Iterative methods for the solution of systems of linear equations
Iterative methods for the solution of systems of linear equationsIterative methods for the solution of systems of linear equations
Iterative methods for the solution of systems of linear equations
 
greek flag
greek flaggreek flag
greek flag
 
The prospect of palm oil tree
The prospect of palm oil treeThe prospect of palm oil tree
The prospect of palm oil tree
 
PERGUNTAS E RESPOSTAS SOBRE OS NOVOS PROCEDIMENTOS NOS AEROPORTOS
PERGUNTAS E RESPOSTAS SOBRE OS NOVOS PROCEDIMENTOS NOS AEROPORTOSPERGUNTAS E RESPOSTAS SOBRE OS NOVOS PROCEDIMENTOS NOS AEROPORTOS
PERGUNTAS E RESPOSTAS SOBRE OS NOVOS PROCEDIMENTOS NOS AEROPORTOS
 
Study material
Study materialStudy material
Study material
 
Religious teaching thought
Religious teaching thoughtReligious teaching thought
Religious teaching thought
 
ignite_mgame_intro 1
ignite_mgame_intro 1ignite_mgame_intro 1
ignite_mgame_intro 1
 
DB Devlop- PostgreSQL 9.2.4 IQ 15.4
DB Devlop- PostgreSQL 9.2.4  IQ 15.4DB Devlop- PostgreSQL 9.2.4  IQ 15.4
DB Devlop- PostgreSQL 9.2.4 IQ 15.4
 
Understanding Your Consumers Through Video: Video Ethnography for Brand Resea...
Understanding Your Consumers Through Video: Video Ethnography for Brand Resea...Understanding Your Consumers Through Video: Video Ethnography for Brand Resea...
Understanding Your Consumers Through Video: Video Ethnography for Brand Resea...
 
Final Paper (Thesis)
Final Paper (Thesis)Final Paper (Thesis)
Final Paper (Thesis)
 
Ex.le gérondif + corrige
Ex.le gérondif + corrigeEx.le gérondif + corrige
Ex.le gérondif + corrige
 
Risk Assessment
Risk AssessmentRisk Assessment
Risk Assessment
 
Soal soal
Soal soalSoal soal
Soal soal
 
Филатова О.Г. PR-агентства на региональном рынке коммуникационных услуг (опыт...
Филатова О.Г. PR-агентства на региональном рынке коммуникационных услуг (опыт...Филатова О.Г. PR-агентства на региональном рынке коммуникационных услуг (опыт...
Филатова О.Г. PR-агентства на региональном рынке коммуникационных услуг (опыт...
 

Similar a Term paper

Similar a Term paper (20)

Maths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayMaths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K Mukhopadhyay
 
Lecture 11 systems of nonlinear equations
Lecture 11 systems of nonlinear equationsLecture 11 systems of nonlinear equations
Lecture 11 systems of nonlinear equations
 
Math lecture 6 (System of Linear Equations)
Math lecture 6 (System of Linear Equations)Math lecture 6 (System of Linear Equations)
Math lecture 6 (System of Linear Equations)
 
Analytic Geometry Period 1
Analytic Geometry Period 1Analytic Geometry Period 1
Analytic Geometry Period 1
 
Lecture6
Lecture6Lecture6
Lecture6
 
Ca 1.6
Ca 1.6Ca 1.6
Ca 1.6
 
Quadratic equations
Quadratic equationsQuadratic equations
Quadratic equations
 
Act_Fin_RMT
Act_Fin_RMTAct_Fin_RMT
Act_Fin_RMT
 
CALCULUS 2.pptx
CALCULUS 2.pptxCALCULUS 2.pptx
CALCULUS 2.pptx
 
n7-LP-simplex.ppt
n7-LP-simplex.pptn7-LP-simplex.ppt
n7-LP-simplex.ppt
 
Lecture3
Lecture3Lecture3
Lecture3
 
Mc ty-cubicequations-2009-1
Mc ty-cubicequations-2009-1Mc ty-cubicequations-2009-1
Mc ty-cubicequations-2009-1
 
Mc ty-cubicequations-2009-1
Mc ty-cubicequations-2009-1Mc ty-cubicequations-2009-1
Mc ty-cubicequations-2009-1
 
February 13, 2015
February 13, 2015February 13, 2015
February 13, 2015
 
Developing Expert Voices
Developing Expert VoicesDeveloping Expert Voices
Developing Expert Voices
 
Chapter 2
Chapter  2Chapter  2
Chapter 2
 
Paso 2 contextualizar y profundizar el conocimiento sobre expresiones algebr...
Paso 2  contextualizar y profundizar el conocimiento sobre expresiones algebr...Paso 2  contextualizar y profundizar el conocimiento sobre expresiones algebr...
Paso 2 contextualizar y profundizar el conocimiento sobre expresiones algebr...
 
lecture-3 laplce and poisson.pptx .
lecture-3 laplce and poisson.pptx                .lecture-3 laplce and poisson.pptx                .
lecture-3 laplce and poisson.pptx .
 
Algebra
AlgebraAlgebra
Algebra
 
Algebra part 2
Algebra part 2Algebra part 2
Algebra part 2
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Term paper

  • 1. PAPER – CAP643  Submitted To: -  Submitted By: Abhishek Kumar Mrs. Kavisha Mam ~1~ Roll No: - 1207B333 Reg No: - 11210885 Course: - MCA 3rd Sem. Section: D1207
  • 2. ACKNOWLEDGEMENT The experience that we have gathered during this Design Problem has been unique .For this we are pleased to express our deepest sense of gratitude and regards to our respected teacher Mrs. Kavisha Mam for their guidance, inspiration and constructive suggestions that helps us in the preparation of the design problem. I am also thankful to my classmate constant encouragement and support. 2
  • 3. INDEX SL. NO. 1 2 3 4 5 6 7 CONTENTS Introduction Abstract Operation on Jacobi Method Comparison with other linear equation Implementation of Jacobi Method in C Advantages Disadvantages 3 PAGE NO. 4 4-6 6-9 9-12 13-14 15 15
  • 4. INTRODUCTION Gauss Jacobi method is the first iterative method used to solve linear system of equations. This project explains you how to solve the linear equation using Gauss Jacobi iterative method Abstract:This paper is concerned with the application of preconditioning techniques to the well-known Jacobi iterative method for solving the finite difference equations derived from the discretization of self-ad joint elliptic partial differential equations. The convergence properties of this one parameter preconditioned method are analyzed and the value of the optimum preconditioning parameter and the performance of the method determined for a variety of standard problems. Jacobi method involves rewriting equation 1 as follow: X=D-1(L+U)x+D-1b If we express it as an iterative method, we see it takes the form: X(k+1)=Gx(k)+f As a motivational example, we assume start with a linear system like this one: 1 5 9 2 6 1 3 7 2 x1 x2 x3 * 4 = 4 8 3
  • 5. Let us solve the ith equation for xi : X1 = (4- 2x2-3x3)/1 X2 = (8- 5x1-7x3)/6 X3 = (3- 9x1-x2)/2 We can express this as an iterative method and rewrite it in a matrix format. x1 x2 x3 (k+1) = (k) 1/1 0 0 1/6 0 0 0 0 1/2 1/1 0 0 1/6 0 0 0 0 1/2 0 -5 -9 * * -2 0 -1 4 8 3 5 -3 -7 0 x1 * x2 x3 +
  • 6. x1 x2 x3 (k+1) = 0 -5/6 -9/2 -1/2 -1/3 0 -7/6 -1/2 0 * x1 x2 + x3 1/4 8/6 3/2 As you see, this takes the form x(k+1)=Gx(k)+f. Let's implement Jacobi's method for this problem. There are some steps which are followed by Gauss Jacobi method to perform certain operation: Step 1 • Find the value of x1 from the first equation by substituting the initial values of other unknowns. • Find the value of x2 from the first equation by substituting the initial values of other unknowns. • Find the value of x3 from the first equation by substituting the initial values of other unknowns. And so on till the value of xn is computed from the nth equation using the initial values of x1, x2,…. xn-1. 6
  • 7. Step 2 • Find out the value of x1 from the first equation by substituting the values of other unknowns got in the 1st iteration. • Find out the value of x2 from the first equation by substituting the values of other unknowns got in the 1st iteration. • Find out the value of x3 from the first equation by substituting the values of other unknowns got in the 1st iteration. Step 3 • Find out the value of x1 from the first equation by substituting the values of other unknowns got in the 2nd iteration. • Find out the value of x2 from the first equation by substituting the values of other unknowns got in the 2nd iteration. • Find out the value of x3 from the first equation by substituting the values of other unknowns got in the 2nd iteration. 7
  • 8. Example x1+2x2+3x3 = 4 5x1+ 6x2+7x3 = 8 9x1+x2+2x3 = 3 Sol: As you see the system is diagonal system, therefore the convergence is assured. Since we want the solution correct up to 4 significant digits, therefore the iterative process will terminate as soon as we find the successive iteration do not produce any change at first four significant positions. We rewrite the given system of equations as X1 = (4- 2x2-3x3)/1 X2 = (8- 5x1-7x3)/6 X3 = (3- 9x1-x2)/2 8
  • 9. We start with initial approximation as X1 = X2 = X3 = 0 Iteration 1: Substituting the initial values in the above equation, we obtain X1 =4.0000 X2 = 1.3333 X3 =1.5000 Iteration 2: Substituting the initial values in the above equation, we obtain X1 = -3.1667 X2 = -3.7500 X3 = -17.1667 Now compare Gauss Jacobi method from other linear equation like Gauss Seidel Method Gauss Seidel Method In Jacobi’s method, even though the new values of unknowns are computed in each iteration, but the values of unknowns in previous iterations are used in the subsequent iterations. That is, although a new value of x1 is computed from the first equation in a current iteration, but it is not used to compute the new values of other unknowns in the current iteration. 9
  • 10. Note that the new values of the unknown are better than the old values, and should be used in preference to the poorer values Step 1 • Find out the value of x1 from the first equation by substituting the initial values of other unknowns. • Find out the value of x2 from the second equation by substituting current value of x1 and the initial values of other unknowns. • Find out the value of x3 from the first equation by substituting the current value of x1 and x2 initial values. And so on till the value of xn is computed from the nth equation using the initial values of x1, x2,…. xn-1. 10
  • 11. Now we will solve same equation by Gauss Seidel method and then we will find the basic difference between both the methods. Our equation is: x1+2x2+3x3 = 4 5x1+ 6x2+7x3 = 8 9x1+x2+2x3 = 3 Sol: As you see the system is diagonal system, therefore the convergence is assured. Since we want the solution correct up to 4 significant digits, therefore the iterative process will terminate as soon as we find the successive iteration do not produce any change at first four significant positions. We rewrite the given system of equations as: X1 = (4- 2x2-3x3)/1 X2 = (8- 5x1-7x3)/6 X3 = (3- 9x1-x2)/2 We start with initial approximation as X1 = X2 = X3 = 0 Iteration 1: Substituting X2 = X3 = 0 in the first equation, we Obtain 11
  • 12. X1 =4.0000 Substituting X1 = 4.0000 X3 = 0 in the second equation, we Obtain X2 = -2.0000 Substituting X1 = 4.0000 X2 = -2.0000 in the third equation, we Obtain X3 =-15.5000 Thus, we obtain X1 =4.0000 X2 = -2.0000 X3 =-15.5000 Iteration2: Now Substituting X2 =-2.0000 X3 = -15.5000 in the first equation, we Obtain X1 =54.5000 Substituting X1 = 54.5000 X3 = -15.5000 in the second equation, we Obtain X2 = -26.0000 Substituting X1 = 54.5000 X2 = -26.0000 in the third equation, we Obtain X3 =-230.7500 Thus, we obtain X1 =54.5000 X2 = -26.0000 X3 =-230.7500 Note: - now you can easily compare with both the output. Then you got different answer in both the iterative method. 12
  • 13. Implementation of Gauss Jacobi method in C Language:- #include<stdio.h> #include<conio.h> #include<math.h> float fx(float y,float z) { float x; x=(4-2*y-3*z)/1; return x; } float fy(float x,float z) { float y; y=(8-5*x-7*z)/6; return y; } float fz(float x,float y) { 13
  • 14. float z; z=(3-9*x-y)/2; return z; } void main() { float x=0,y=0,z=0,tx,ty,tz; int i,n; clrscr(); printf("Enter the number of iteration:"); scanf("%d",&n); for(i=0;i<n;i++) { tx=fx(y,z); ty=fy(x,z); tz=fz(x,y); x=tx; y=ty; z=tz; } printf("X=%fn",x); printf("Y=%fn",y); printf("Z=%f",z); getch(); } 14
  • 15. Advantages and disadvantages Advantages: 1. Iterative. The Jacobi method first generates inexact results and subsequently refines its results at each iteration, with the residuals converging at an exponential rate. For many applications, this is highly desirable. Disadvantages: 1. Inflexible. The Jacobi method only works on matrices A for which ρ(A) < 1, or || A|| < 1holds. This makes it inapplicable to a large set of problems. Furthermore, determining whether a matrix satisfies the previous conditions is expensive to compute. 2. Large Set-Up Time. The Jacobi method cannot immediately begin producing results. Before it can begin its iteration, a matrix −D −1(L+U) must be computed. For large input matrices, this may not be a trivial operation, as it takes O(n2) time to perform this matrix multiplication. The result is a significant lag before any results can be output. 15