Presentation is loading. Please wait.

Presentation is loading. Please wait.

Thomas algorithm to solve tridiagonal matrices

Similar presentations


Presentation on theme: "Thomas algorithm to solve tridiagonal matrices"— Presentation transcript:

1 Thomas algorithm to solve tridiagonal matrices

2 Basically sets up an LU decomposition
three parts 1) decomposition 2) forward substitution 3) backward substitution

3 1) decomposition loop from rows 2 to n ai = ai/bi-1 bi = bi-ai*ci-1 end loop 2) forward substitution loop from 2 to n ri = ri - ai*ri-1

4 3) back substitution xn = rn/bn loop from n-1 to 1 xi = (ri-ci*xi+1)/bi end loop

5 Example First decompose T

6 loop from rows 2 to 5 ai = ai/bi-1 bi = bi-ai*ci-1 end loop

7 forward substitution loop from 2 to n ri = ri - ai*ri-1 end loop

8 back substitution xn = rn/bn loop from n-1 to 1 xi = (ri-ci*xi+1)/bi end loop

9 Crout algorithm - alternate LU decomposition
Instead of 1’s on diagonal of L, get 1’s on diagonal of U Operate on rows and columns sequentially, narrowing down to single element

10 Algorithm for j=2 to n-1 For j=n

11 Cholesky decomposition
A decomposition for symmetric matrices Symmetric matrix e.g. a covariance matrix

12 For symmetric matrices, can write
Can develop relationships for l

13 Example: 1st row Skip this equation

14 Row 2

15 Row 3

16 Row 4

17

18 Iterative methods for solving matrix equations
1. Jacobi 2. Gauss-Seidel 3. Successive overrelaxation (SOR) Idea behind iterative methods: Convert Ax=b into Cx=d, which has sequence of approximations x(1), x(2), … with

19 What are C and d? Recall from fixed-point iteration

20 Rewrite matrix equation in same way
becomes

21 Then

22 Jacobi method is like fixed point iteration
Example: Shape of a stretched membrane

23 Shape can be described by potential function
Let us give some boundary conditions

24 Problem look likes this
Solve for u’s

25 Leads to this system of equations

26 Choose an initial u=[1 1 1 1 …1]’
Iterate using x=Cx+d

27 Matlab solution, 49 iterations

28 Gauss-Seidel method differs from Jacobi by sequential updating
- use new xi’s as they become available

29 Example: Jacobi Gauss-Seidel


Download ppt "Thomas algorithm to solve tridiagonal matrices"

Similar presentations


Ads by Google