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: solve the system of linear equations followed by the Lu decomposition algorithm 1) 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:

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

1) 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
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education