Answered step by step
Verified Expert Solution
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 Calculate the number of arithmetic operations that are required to solve a tridiagonal system
of size 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 Rewrite the Thomas algorithm in terms of the arrays and introduced to store the matrix
efficiently.
TASK Implement the Thomas algorithm from TASK as a Python function. The input parameters to
the function should be the coefficient matrix stored as three arrays and and the righthand
side vector The output should be the solution vector The coefficient matrix and the righthand
side should be defined in the main script and passed to the function that solves the system.
TASK Test your code by solving the linear system of size with the values and
Set the righthand side to 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 Solve five linear systems with and varying the problem size
between and 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 What are your conclusions about the cost of the Thomas
algorithm?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started