Question

1) Let A be a symmetric pentadiagonal positive definite matrix of the form Cal 1 0 0 0 a, 0 bo 0 a 0 ba 0 0 2 0 b 0 bn 0 an n-4 m-2 0 b am-1 an n-2 Write an algorithm that generates a lower-triangular L such that A -LL. That is, construct the vectors LO, LI, L2 so that LO L1 LO 0 L2 L1 LO 0 0 L2 LO L1 n-2 Use the given single subscripting and fully exploit the sparsity pattern. Assume that n 23. Hint: The number of special cases can be reduced by working one row at a time.

I cannot use double subscripts, 2d arrays, or nested for loops for this problem. Here is the algorithm I have come up with so far:

L0[1] = sqrt(a[1]);
L1[1] = 1 / L0[1];
L2[1] = b[1] / L0[1];
L0[2] = sqrt(a[2] - (L1[1] / L0[1]) * (L1[1] / L0[1]));
L1[2] = (0 - (L2[1]) * (L1[1])) / L0[2];
L0[3] = sqrt(a[3] - (L2[1]) * (L2[1]) - (L1[2]) * (L1[2]));

for(i = 3; i <= n; i++)

{
     L2[i-2] = (b[i-2] - b[i-3] * b[i-4]) / b[i-2];
     L1[i-1] = (L0[i] - (L2[i]) * (L1[i])) / L0[i];
     L0[i] = sqrt(L0[i] - (L1[i]) * (L1[i]) - (L2[i]) * (L2[i]));
}

I'm not sure if I should add or change anything in this solution.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

L0[1] = sqrt(a[1]);
L1[1] = 1 / L0[1];
L2[1] = b[1] / L0[1];
L0[2] = sqrt(a[2] - (L1[1] / L0[1]) * (L1[1] / L0[1]));
L1[2] = (0 - (L2[1]) * (L1[1])) / L0[2];
L0[3] = sqrt(a[3] - (L2[1]) * (L2[1]) - (L1[2]) * (L1[2]));

for(i = 3; i <= n; i++)

{
     L2[i-2] = (b[i-2] - b[i-3] * b[i-4]) / b[i-2];
     L1[i-1] = (L0[i] - (L2[i]) * (L1[i])) / L0[i];
     L0[i] = sqrt(L0[i] - (L1[i]) * (L1[i]) - (L2[i]) * (L2[i]));
}

Add a comment
Know the answer?
Add Answer to:
I cannot use double subscripts, 2d arrays, or nested for loops for this problem. Here is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Plz use nested loops , read the question carefully, i need help step by step solution...

    Plz use nested loops , read the question carefully, i need help step by step solution using ( spyder).. Exercise 2 Write a Python program (Lab7-ex2.py) that reads from the user an integer n, displays the triangular number sequence up to the n term (ie. 1,3, 6, 10,. n"term). The triangular of a number n is calculated as "n(n+1)/2" where n is a nonzero positive number. Note that your program should display a suitable error message if n is entered...

  • just part 4,5,6 Problem 3: The purpose of this problem is use the Nested Interval Property...

    just part 4,5,6 Problem 3: The purpose of this problem is use the Nested Interval Property to show the existence of the square root of a positive number A. Thinking of A as an area, start with a rectangle with sides ao bo such that aoboA. Define b( bo)/2 and aA/b1, so that abi-A. Repeating this process, one creates sequence {an^ni and sbn^n1 defining nested intervals In such that I -VA. The different parts of this problem will guide you...

  • Mountain Paths (Part 1) Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e...

    Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e. parallel arrays … called multiple arrays in the zyBook) Transform data Read from files Write to files structs Code Requirements Start with this code: mtnpathstart.zip Do not modify the function signatures provided. Do not #include or #include Program Flow Read the data into a 2D array Find min and max elevation to correspond to darkest and brightest color, respectively Compute the shade of...

  • Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures...

    Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e. parallel arrays … called multiple arrays in the zyBook) Transform data Read from files Write to files structs Code Requirements Start with this code: mtnpathstart.zip Do not modify the function signatures provided. Do not #include or #include Program Flow Read the data into a 2D array Find min and max elevation to correspond to darkest and brightest color, respectively Compute the shade of...

  • 1. (All students!) For matrices with special properties, it is possible to create special version...

    1. (All students!) For matrices with special properties, it is possible to create special versions of Gauss elimination. Suppose matrix A (nxn) is symmetric (which means that A-A). Suppose also that A is positive definite; this means that the scalar = xTAx is always 20 for every vector x , and J-0 only if x = 0 In this case it can be shown that the usual Gauss elimination process, which effectively creates the factorization A LU, can be simplified...

  • HERE IS THE CODE I FIXED BUT STILL DOESN'T WORK NOTE: THE VARIABLE x = zeros(size(b))...

    HERE IS THE CODE I FIXED BUT STILL DOESN'T WORK NOTE: THE VARIABLE x = zeros(size(b)) CAN'T BE CHANGED CAUSE HAS BEEN SET BY ASSESSOR HI EXPERTS I NEED HELP TO SOLVE THIS HOMEWORK PROBLEM FOR MATLAB CODE A COUPLE OF TIMES I TRIED LAST TIME TO ASK BUT ALL OF THE ANSWERS WERE WRONG PLEASE KINDLY HELP ME FIND THE RIGHT SOLUTION, ANY HELP WILL BE VERY APPRECIATE Engineering Computations and Modelling > Week 6 Homework > Backward Substitution...

  • 2. Here is a sorting algorithm that I like to use. Given an unsorted list of...

    2. Here is a sorting algorithm that I like to use. Given an unsorted list of size n, let Xx represent the data in location k of the unsorted list. Compare xi to X2 and switch if necessary so that they are in sorted order, smallest first. Compare Xn-1 and Xn and switch if necessary so that they are in sorted order, smallest first. • Compare x3 with its left neighbors, switching if necessary so that the 3 first entries...

  • I cannot get i) or j) 3. (20 marks) Consider the parallel lines L, : x=...

    I cannot get i) or j) 3. (20 marks) Consider the parallel lines L, : x= -3 +8 2 [1] and L2: x = 0 + [2] 4. and 11 [3 -21 the planes P1 : 3x + 2y + 2z = -7 and P2 : 2.x – 2y - 2 = 11. (a) Find the equation of a plane in standard form containing both L, and L. (b) Find an equation of the line of intersection of P, and...

  • Fix this C++ below so does not use any loops at all. Use recursion instead. here...

    Fix this C++ below so does not use any loops at all. Use recursion instead. here is some guides given. Create a directory to hold assignment 3. Copy files hailstone.cpp, Makefile and dotestassignment 2 to the assignment 3 directory. Edit the comments at the top of hailstone.cppto say that this is assignment 3. You should be able to keep the same contracts, 'next' function and 'main' function from assignment 2, unless they contained errors that needed to be fixed. If...

  • MATLAB code starts here --------- clear T0=2; w0=2*pi/T0; f0=1/T0; Tmax=4; Nmax=15; %--- i=1; for t=-Tmax: .01:Tmax...

    MATLAB code starts here --------- clear T0=2; w0=2*pi/T0; f0=1/T0; Tmax=4; Nmax=15; %--- i=1; for t=-Tmax: .01:Tmax T(i)=t; if t>=(T0/2) while (t>T0/2) t=t-T0; end elseif t<=-(T0/2) while (t<=-T0/2) t=t+T0; end end if abs(t)<=(T0/4) y(i)=1; else y(i)=0; end i=i+1; end plot(T,y),grid, xlabel('Time (sec)'); title('y(t) square wave'); shg disp('Hit return..'); pause %--- a0=1/2; F(1)=0; %dc freq C(1)=a0; for n=1:Nmax a(n)=(2/(n*pi))*sin((n*pi)/2); b(n)=0; C(n+1)=sqrt(a(n)^2+b(n)^2); F(n+1)=n*f0; end stem(F,abs,(C)), grid, title(['Line Spectrum: Harmonics = ' num2str(Nmax)]); xlabel('Freq(Hz)'), ylabel('Cn'), shg disp('Hit return...'); pause %--- yest=a0*ones(1,length(T)); for n=1:Nmax yest=yest+a(n)*cos(2*n*pi*T/T0)+b(n)*sin(2*n*pi*T/T0);...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT