Question: please use the provided code in Matlab to solve and explain the questions. (a) ( 20 points) The function takes as input n1 vectors (a),b,c,
please use the provided code in Matlab to solve and explain the questions.



(a) ( 20 points) The function takes as input n1 vectors (a),b,c, and d. Modify the algorithm to make a new function, Thomas_2, which takes as input the tridiagonal matrix A and vector d instead. Include in your function errors if A is not a square tridiagonal matrix. (Hint: Use the command isbanded.) Validate your code by creating a sparse 10001000 tridiagonal matrix made up of random numbers from 0 to 50 and a similarly formed vector for d. Compare your solution to the solution found by using Matlab backslash, and report the relative difference between the two solutions, with respect to the max norm. (b) (30 BONUS points) Modify the algorithm to solve problems of the form b1a20c1b2c2ana1cn1bnx1xn=d1dn where all terms not on the tridiagonal or in the upper right corner are zeros. Show any work you did or explain how you made your modification. (You may want to explore the original algorithm a little first.) Validate your code by solving the system 120000222000033300001220000141100012x1x6=979223417. The exact solution is 123456. Report your relative error, with respect to the 1-norm, 2-norm, and max norm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
