Question: Determine the number of total flops as a function of the number of equations n for the tridiagonal algorithm (Fig. 9.6). function x = Tridiag

Determine the number of total flops as a function of the number of equations n for the tridiagonal algorithm (Fig. 9.6).

function x = Tridiag (e, f, g, r) Tridiag: Tridiagonal equation solver

function x = Tridiag (e, f, g, r) Tridiag: Tridiagonal equation solver banded system x = Tridiag(e, f, g, r): Tridiagonal system solver. % input: e = f = end % % output: subdiagonal vector diagonal vector g = superdiagonal vector r right hand side vector = n=length (f); % forward elimination for k = 2:n factor = e (k) /f (k-1); end X = solution vector f (k) = r (k) = f (k) - factor*g (k-1); r (k) factor*r (k-1); = back substitution x (n) = r (n)/ f (n); for k= n-1:-1:1 (r (k) -g (k) *x (k+1) ) / f (k); x (k) =

Step by Step Solution

3.35 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER The number of flops for the tridiagonal algorithm can be calculated as follows Forward elimin... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Applied Numerical Methods Questions!