LU Decomposition Method Algorithm Decomposition phase The LU Decomposition (Doolittle) method has the following properties: The U matrix is ​​identical to the upper triangular matrix resulting from the Gaussian Elimination; The elements at the bottom below the main diagonal of the matrix L are the multipliers used ​​during the Gaussian Elimination, that is, Li*j is the multiplier that eliminated Ai*j. It is common practice to store the multipliers at the bottom of the coefficient matrix, replacing the coefficients as they are eliminated (Li*j replacing Ai*j) The diagonal elements of L do not need to be stored, as their values ​​are understood to be unitary. The final form of the coefficient matrix would be the mixture of L and U: The initial part of the LU Decomposition Method algorithm is identified with Gaussian Elimination, except that each λ multiplier is now stored in the lower triangular portion of matrix A: 1)solve the system of linear equations followed by the Lu decomposition algorithm a) show what the solution vector is answer import numpy as np def LUdecomp(a): n = len(a) for k in range(0,n-1): for i in range(k+1,n): if a[i,k] != 0.0: lam = a [i,k]/a[k,k] a[i,k+1:n] = a[i,k+1:n] - lam*a[k,k+1:n] a[i,k] = lam return a def LUsolve(a,b): n = len(a) for k in range(1,n): b[k] = b[k] - np.dot(a[k,0:k],b[0:k]) b[n-1] = b[n-1]/a[n-1,n-1] for k in range(n-2,-1,-1): b[k] = (b[k] - np.dot(a[k,k+1:n],b[k+1:n]))/a[k,k] return b z = np.array([[3.50, 2.77, -0.76, 1.80], [-1.80, 2.68, 3.44, -0.09], [0.27, 5.07, 6.90, 1.61], [1.71, 5.45, 2.68, 1.71]]) k = np.array([[7.31, 5.45, 2.68, 1.71]]) z=LUdecomp(z)x=LUsolve(z,k[0]) In [ ]: print('x = \n', x)   b)Through code modifications (counters?) compute how many multiplications are performed to find the solution vector

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

python

Linear Equation System
LU Decomposition Method Algorithm
Decomposition phase The LU Decomposition (Doolittle) method has the following properties:

The U matrix is ​​identical to the upper triangular matrix resulting from the Gaussian Elimination;
The elements at the bottom below the main diagonal of the matrix L are the multipliers used ​​during the Gaussian Elimination, that is, Li*j is the multiplier that eliminated Ai*j.
It is common practice to store the multipliers at the bottom of the coefficient matrix, replacing the coefficients as they are eliminated (Li*j replacing Ai*j) The diagonal elements of L do not need to be stored, as their values ​​are understood to be unitary. The final form of the coefficient matrix would be the mixture of L and U:

The initial part of the LU Decomposition Method algorithm is identified with Gaussian Elimination, except that each λ multiplier is now stored in the lower triangular portion of matrix A:

1)solve the system of linear equations followed by the Lu decomposition algorithm

a) show what the solution vector is
answer

import numpy as np

def LUdecomp(a):
n = len(a)
for k in range(0,n-1):
for i in range(k+1,n):
if a[i,k] != 0.0:
lam = a [i,k]/a[k,k]
a[i,k+1:n] = a[i,k+1:n] - lam*a[k,k+1:n]
a[i,k] = lam
return a

def LUsolve(a,b):
n = len(a)
for k in range(1,n):
b[k] = b[k] - np.dot(a[k,0:k],b[0:k])
b[n-1] = b[n-1]/a[n-1,n-1]
for k in range(n-2,-1,-1):
b[k] = (b[k] - np.dot(a[k,k+1:n],b[k+1:n]))/a[k,k]
return b

z = np.array([[3.50, 2.77, -0.76, 1.80],
[-1.80, 2.68, 3.44, -0.09],
[0.27, 5.07, 6.90, 1.61],
[1.71, 5.45, 2.68, 1.71]])

k = np.array([[7.31, 5.45, 2.68, 1.71]])

z=LUdecomp(z)x=LUsolve(z,k[0])
In [ ]:
print('x = \n', x)
 
b)Through code modifications (counters?) compute how many multiplications are performed to find the solution vector
 
3.50 2.77 -0.76
1.80
7.31
-1.80 2.68
3.44
-0.09
4.23
A =
b =
0.27 5.07
6.90
1.61
13.85
1.71
5.45
2.68
1.71
11.55
Transcribed Image Text:3.50 2.77 -0.76 1.80 7.31 -1.80 2.68 3.44 -0.09 4.23 A = b = 0.27 5.07 6.90 1.61 13.85 1.71 5.45 2.68 1.71 11.55
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY