Sie sind auf Seite 1von 6

Roll Nos 143104011, 143104013

Assignment 3

Tridiagonal Matrix

Problem 1:
Enter the order of input matrix: 3

Choose either
1)User defined input or 2)Problem 4 input: 1

Enter the element a(1)(1)
9
Enter the element a(1)(2)
1
Enter the element a(1)(3)
1
Enter the element a(2)(1)
2
Enter the element a(2)(2)
10
Enter the element a(2)(3)
3
Enter the element a(3)(1)
3
Enter the element a(3)(2)
4
Enter the element a(3)(3)
11
The matrix a is:
9 1 1
2 10 3
3 4 11

Enter the element b(1)
1
Enter the element b(2)
1
Enter the element b(3)
1
The column vector b is:
1
1
1

"a" is not a Tridiagonal matrix>>

Problem 2

Enter the order of input matrix: 2

Choose either
1)User defined input or 2)Problem 4 input: 1
Enter the element a(1)(1)
1
Enter the element a(1)(2)
4
Enter the element a(2)(1)
4
Enter the element a(2)(2)
1
The matrix a is:
1 4
4 1

Enter the element b(1)
1
Enter the element b(2)
0
The column vector b is:
1
0

l is
1 0
4 1

u is
1 0
4 1

g is
1
-4

x is
-0.0667
0.2667

>>


Problem 3

Enter the order of input matrix: 4

Choose either
1)User defined input or 2)Problem 4 input: 1

Enter the element a(1)(1)
4
Enter the element a(1)(2)
-1
Enter the element a(1)(3)
-1
Enter the element a(1)(4)
0
Enter the element a(2)(1)
-1
Enter the element a(2)(2)
4
Enter the element a(2)(3)
0
Enter the element a(2)(4)
-1
Enter the element a(3)(1)
-1
Enter the element a(3)(2)
0
Enter the element a(3)(3)
4
Enter the element a(3)(4)
-1
Enter the element a(4)(1)
0
Enter the element a(4)(2)
-1
Enter the element a(4)(3)
-1
Enter the element a(4)(4)
4

The matrix a is:
4 -1 -1 0
-1 4 0 -1
-1 0 4 -1
0 -1 -1 4

Enter the element b(1)
5
Enter the element b(2)
-3
Enter the element b(3)
-7
Enter the element b(4)
9

The column vector b is:
5
-3
-7
9

"a" is not a Tridiagonal matrix>>






























Problem 4i

Enter the order of input matrix: 3

Choose either
1)User defined input or 2)Problem 4 input: 2

The matrix a is:
4 1 0
1 4 1
0 1 4

The column vector b is:
1
1
1

l is
1.0000 0 0
0.2500 1.0000 0
0 0.2667 1.0000

u is
1.0000 0 0
0.2500 1.0000 0
0 0.2667 1.0000

The solution is:
0.2143
0.1429
0.2143

>>













Problem 4ii

Enter the order of input matrix: 100

Choose either
1)User defined input or 2)Problem 4 input: 2

Very Large Matrix. Cant print "a", "l" or "u"

The solution is: 0.2113 0.1547 0.1699 0.1658 0.1669 0.1666 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667
0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.1666 0.1669 0.1658 0.1699
0.1547 0.2113>>

Das könnte Ihnen auch gefallen