Question

In: Advanced Math

Q: (LU decomposition) Find the LU decomposition of A = [-3 2 5 1; 12 -4...

Q: (LU decomposition) Find the LU decomposition of A = [-3 2 5 1; 12 -4 -20 -2; -6 0 15 1; -9 6 35 4]. You can use the compact method which works within a single matrix or you can build L and U separately. State L and U explicitly, and verify (in Matlab) that A = L*U. Hint: Matlab's built-in lu function isn't useful, since it pivots.

Solutions

Expert Solution


%Matlab code for solving linear equation without pivoting
clear all
close all

%The A matrix and corresponding solution matrix
A=[-3 2 5 1; 12 -4 -20 -2; -6 0 15 1; -9 6 35 4];

%Displaying the matrix
fprintf(' The A matrix is\n')
disp(vpa(A,3))

%LU factorization using function lu_nopivot
[L, U] = lu_nopivot(A);
fprintf('The L matrix is\n')
disp(vpa(L,3))

fprintf('The U matrix is\n')
disp(vpa(U,3))

fprintf('L*U=\n')
disp(vpa(L*U,3))

%Matlab function for lu factorization
function [L, U] = lu_nopivot(A)

    n = size(A, 1); % Obtain number of rows (should equal number of columns)
    L = eye(n); % Start L off as identity and populate the lower triangular half slowly
    for k = 1 : n
        % For each row k, access columns from k+1 to the end and divide by
        % the diagonal coefficient at A(k ,k)
        L(k + 1 : n, k) = A(k + 1 : n, k) / A(k, k);

        % For each row k+1 to the end, perform Gaussian elimination
        % In the end, A will contain U
        for l = k + 1 : n
            A(l, :) = A(l, :) - L(l, k) * A(k, :);
        end
    end
    U = A;

end


%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%


Related Solutions

a) Let σ = (1 2 3 4 5 6) ∈ S6, find the cycle decomposition...
a) Let σ = (1 2 3 4 5 6) ∈ S6, find the cycle decomposition of σ i for i = 1, 2, . . . , 6. (b) Let σ1, . . . , σm ∈ Sn be disjoint cycles. For 1 ≤ i ≤ m, let ki be the length of σi . Determine o(σ1σ2 · · · σm)
LU Decomposition (i). Prove that for n equal to 2 or 3 there is a non-singular...
LU Decomposition (i). Prove that for n equal to 2 or 3 there is a non-singular square (n by n) matrix which has no LU decomposition with L unit lower triangular and U upper triangular. (In fact, this is true for any integer ≥ 2.) (ii). We will see that all non-singular square matrices do have an LUP decomposition (some time soon in class). Here P is a permutation matrix, also defined in Appendix D and used in Chapter 28....
4. (Applying LU and LUP decompositions) In this problem, we'll use the LU/LUP decomposition to solve...
4. (Applying LU and LUP decompositions) In this problem, we'll use the LU/LUP decomposition to solve a linear system of equations. a) For A = [12 -8 13 -1 13;14 11 -5 -5 -7;1 -8 -9 10 8;-11 10 -8 3 8;-11 -8 4 2 -4] find matrices P, L, and U so that PA = LU using Matlab's lu function. Based on your results: did Matlab use pivoting during the lu-computation? b) For b = [4;-4;-5;3;7] solve Ax =...
Find [A]^-1 for the following equation using LU Decomposition and {x}. 3x1 - 2x2 + x3...
Find [A]^-1 for the following equation using LU Decomposition and {x}. 3x1 - 2x2 + x3 = -10 2x1 + 6x2 - 4x3 = 44 -x1 - 2x2 + 5x3 = -26
Find the distances: A) Between ?1=〈2+2?,−1+?,−3?〉and ?2=〈4,−5−3?,1+4?〉 . B) Between the planes 2?−?+5?=0 and 2?−?+5?=5 ....
Find the distances: A) Between ?1=〈2+2?,−1+?,−3?〉and ?2=〈4,−5−3?,1+4?〉 . B) Between the planes 2?−?+5?=0 and 2?−?+5?=5 . C) From the point (1,2,3) to the line ?=〈−?,4−?,1+4?〉 .
Three point charges of q 1 =-5 uC , q 2 =3uC , q 3 =4...
Three point charges of q 1 =-5 uC , q 2 =3uC , q 3 =4 uC are located at (0, 0) , (4, 0) , and (0, 3) respectively . What is the electric force on charge , by other two charges . (Draw a q 2 diagram first and then find the force. Here 1 mu C=10^ -6 C)
first matrix A [ 2 -1 3 ] [-4 0 -2 ] [2 -5 12 ]...
first matrix A [ 2 -1 3 ] [-4 0 -2 ] [2 -5 12 ] [4 0 4 ] amd b [2] [-2] [5] [0] solve for Ax=b using tan LU factorization of A
Find the singular value decomposition of A = [ (3 2 2), (2 3 2) ]...
Find the singular value decomposition of A = [ (3 2 2), (2 3 2) ] and determine the angle of rotation induced by U and V . Also, write the rank 1 decomposition of A in terms of the columns of U and rows of V . Can we do dimensionality reduction in this case?
4. [22 pts] For the function ?(?) = 2?5 − 9?4 + 12?3 − 12?2 +...
4. [22 pts] For the function ?(?) = 2?5 − 9?4 + 12?3 − 12?2 + 10? − 3 answer the following: a. [2 pts] Determine whether the function represents a polynomial. Justify your answer. b. [4 pts] Determine whether the function satisfies the Intermediate Value Theorem on the interval [0, 5]. Justify your answer. c. [2 pts] Determine the number (quantity) of complex zeros that the function has, provided the each zero is counted by its multiplicity. d. [4...
Find the inverse for [A] for the following equation using LU Decomposition 8x1 + 4x2 -x3...
Find the inverse for [A] for the following equation using LU Decomposition 8x1 + 4x2 -x3 = 11 -2x1 + 5x2 + x3 = 4 2x1 - x2 + 6x3 = 7
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT