0% found this document useful (0 votes)
10 views2 pages

Experiment 6

Uploaded by

amoghakantak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Experiment 6

Uploaded by

amoghakantak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab Session #6

Cholesky Decomposition in Python


Aim:
To explore various functions available in SciPy and Math modules in python and implement
Cholesky Decomposition using SciPy, Math and PPrint Library modules.

Problem Definition:
Develop Python Programs using Math module for following:
1. Declare a 2X2 Matrix and find Cholesky Decomposition for same.
2. Declare a 4X4 Matrix and find Cholesky Decomposition for same.
3. Take a 4X4 Matrix as input from user and find Cholesky Decomposition for same.
Develop Python Programs using SciPy and PPrint module for following:
1. Take a 4X4 Matrix as input from user and find Cholesky Decomposition for same, use
pprint for display.

Theory:

In linear algebra, a matrix decomposition or matrix factorization is a factorization of a


matrix into a product of matrices. There are many different matrix decompositions. One of
them is Cholesky Decomposition.
The Cholesky decomposition or Cholesky factorization is a decomposition of a Hermitian,
positive-definite matrix into the product of a lower triangular matrix and its conjugate
transpose. The Cholesky decomposition is roughly twice as efficient as the LU
decomposition for solving systems of linear equations.
The Cholesky decomposition of a Hermitian positive-definite matrix A is a decomposition of
the form A = [L] [L] T, where L is a lower triangular matrix with real and positive diagonal
entries, and LT denotes the conjugate transpose of L. Every Hermitian positive-definite
matrix (and thus also every real-valued symmetric positive-definite matrix) has a unique
Cholesky decomposition.

Every symmetric, positive definite matrix A can be decomposed into a product of a unique
lower triangular matrix L and its transpose: A = L LT
The following formulas are obtained by solving above lower triangular matrix and its
transpose. These are the basis of Cholesky Decomposition Algorithm:
Input:

Output:

Applications:
The Cholesky decomposition is mainly used for the numerical solution of linear equations
Ax = b. If A is symmetric and positive definite, then we can solve A x = b by first computing
the Cholesky decomposition A = L L ∗, then solving L y = b for y by forward substitution,
and finally solving L ∗ x = y for x by back substitution.
For linear systems that can be put into symmetric form, the Cholesky decomposition (or its
LDL variant) is the method of choice, for superior efficiency and numerical stability.
Compared to the LU decomposition, it is roughly twice as efficient.
● Linear least squares
● Non-linear optimization
● Monte Carlo simulation
● Kalman filters
● Matrix inversion
SciPy
SciPy provides algorithms for optimization, integration, interpolation, eigenvalue problems,
algebraic equations, differential equations, statistics and many other classes of problems.
The algorithms and data structures provided by SciPy are broadly applicable across
domains. SciPy extends NumPy providing additional tools for array computing and
provides specialized data structures, such as sparse matrices and k-dimensional trees.
SciPy wraps highly-optimized implementations written in low-level languages like
FORTRAN, C, and C++. We can enjoy the flexibility of Python with the speed of compiled
code. SciPy’s high level syntax makes it accessible and productive for programmers from
any background or experience level.
PPRINT
The pprint module provides a capability to “pretty-print” arbitrary Python data structures
in a well-formatted and more readable way

You might also like