LU Decomposition

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Practical 5:-LU Decomposition

QL Solve the system of equation by LU decomposition


x + 4 y + 3 z = -4
2 x1 + 7 x2 + 9 x3 = -10
5 x1 + 8 x2 - 2 x3 = 9
Mathematica command : -

a = 881, 4, 3<, 82, 7, 9<, 85, 8, - 2<<


b = 8- 4, - 10, 9<
MatrixForm@aD
8lu, p, c< = LUDecomposition@aD
l = lu SparseArray@8i_, j_< ; j < i ® 1, 83, 3<D + IdentityMatrix@3D;
MatrixForm@1D
u = lu SparseArray@8i_, j_< ; j >= i ® 1, 83, 3<D
MatrixForm@uD
d = MatrixForm@l, uD
luf = LinearSolve@aD
x = luf@bD
x.a
881, 4, 3<, 82, 7, 9<, 85, 8, - 2<<

8- 4, - 10, 9<

1 4 3
2 7 9
5 8 -2

8881, 4, 3<, 82, - 1, 3<, 85, 12, - 53<<, 81, 2, 3<, 1<

881, 4, 3<, 80, - 1, 3<, 80, 0, - 53<<

1 4 3
0 -1 3
0 0 - 53
1 0 0
2 1 0
5 12 1

LinearSolveFunction@83, 3<, <>D

83, - 1, - 1<

8- 4, - 3, 2<

You might also like