Scientific Programming Lab Manual
Scientific Programming Lab Manual
Manual
Introduction:
Direct Method
Indirect method
There are two more methods are also including in indirect method.
Formula:
Where the Gauss-Jacobi method transforms the system into an iterative form:
Gauss Sidle Method:
The Gauss-Seidel method is a improvisation of the Jacobi method. This method is named after
mathematicians Carl Friedrich Gauss (1777–1855) and Philipp L. Seidel (1821–1896). This modification often results
in higher degree of accuracy within fewer iterations.
In Jacobi method the value of the variables is not modified until next iteration, whereas in Gauss-Seidel
method the value of the variables is modified as soon as new value is evaluated. For instance, in Jacobi method the
value of xi(k) is not modified until the (k + 1) iteration but in Gauss-Seidel method the value of xi(k) changes in in kth
iteration only.
Formula:
Where the Gauss-Jacobi method transforms the system into an iterative form:
********************Lab working********************
Coding for Gauss Jacobi Method:
Fig 14.1
Result:
Fig 14.2
Code for Gauss Sidle Method:
Result:
Lab No 15 Date:21-12-2023
LU Decomposition and Cholesky method
Objective:
To generate the code for LU decomposition method to solve the problem in MATLAB.
To generate the code for Cholesky method to solve the problem in MATLAB.
Introduction:
LU Decomposition:
In linear algebra, LU Decomposition, i.e., lower–upper (LU) decomposition or factorization of a matrix, can be
defined as the product of a lower and an upper triangular matrix. This product sometimes comprises a permutation
matrix as well. We can relate the LU decomposition method with the matrix form of the Gaussian elimination
method of solving a system of linear equations.
Formula:
We know that
AX=b
A=LU
1 0 0 𝑈11 𝑈12 𝑈13
Where L= 𝐿21 1 0 and U= 0 𝑈22 𝑈23
𝐿31 𝐿32 1 0 0 𝑈33
LUX=b
UX=y
LY=b
Cholesky method:
The Cholesky factorization, also known as Cholesky decomposition, is a process of breaking down of a Hermitian,
positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose, which is important
for quick numerical solutions in linear algebra. André-Louis Cholesky discovered it for real matrices, and it was later
published in 1924. For solving systems of linear equations, the Cholesky factorization is generally twice as efficient as
the LU decomposition when it is feasible.
Formula:
LL-1=I
UA-1=L-1
X=A-1b
*******************Lab working********************
Code for LU decomposition:
Fig 15.1
Result:
Fig 15.2
Code for Cholesky method:
Fig 15.3