Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TASK 1 . Calculate the number of arithmetic operations that are required to solve a tridiagonal system T x = f of size n using

TASK 1. Calculate the number of arithmetic operations that are required to solve a tridiagonal system
Tx=f of size n using the Thomas algorithm. Based on this result, determine the asymptotic
complexity of the Thomas algorithm, and compare it to the asymptotic complexity of the standard
Gaussian elimination.
TASK 2. Rewrite the Thomas algorithm in terms of the arrays A,B, and C introduced to store the matrix
T efficiently.
TASK 3. Implement the Thomas algorithm from TASK 2 as a Python function. The input parameters to
the function should be the coefficient matrix T(stored as three arrays A,B, and C) and the right-hand
side vector f. The output should be the solution vector x. The coefficient matrix and the right-hand
side should be defined in the main script and passed to the function that solves the system.
TASK 4. Test your code by solving the linear system of size n=10 with the values A=2, and B=C=
-1. Set the right-hand side to f=1. To verify the correctness of your code, compare the solution
vector obtained from the Thomas algorithm to that obtained by applying the direct solver
numpy.linalg. solve (). For the latter, the coefficient matrix should be assembled.
TASK 5. Solve five linear systems Tx=f with A=2,B=C=-1 and f=1 varying the problem size
n between 106 and 108. Record the execution times in seconds for each case. To accomplish this task,
explore the Python function timer () from the package timeit (refer to the code for matrix
multiplication covered in lectures). Plot a graph where the obtained execution times are represented
as the function of the problem size n. What are your conclusions about the cost of the Thomas
algorithm?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions