Question

In: Computer Science

Find L and U Using python3 programming language( using Doolittle's Decomposition method) 3X3 Matrices [4,-1,0],[-1,4,-1],[0,-1,4]

Find L and U Using python3 programming language( using Doolittle's Decomposition method)

3X3 Matrices

[4,-1,0],[-1,4,-1],[0,-1,4]

Solutions

Expert Solution

The L and U of given matrix can be calculated as:-

Maximum = 100;
#lud as lower and upper triangular matrix decomposition.
def lud(matrix, n):
  
lower = [[0 for x in range(n)]
for y in range(n)];
upper = [[0 for x in range(n)]
for y in range(n)];
  
# decomposing the matrix into Upper and lower triangular matix
  
for i in range(n):
  
# Upper Triangular
for k in range(i, n):
  
# Sum of Lower(i, j) * Upper(j, k)
sum = 0;
for j in range(i):
sum += (lower[i][j] * upper[j][k]);
  
# Evaluating Upper(i, k)
upper[i][k] = mat[i][k] - sum;
  
# Lower Triangular
for k in range(i, n):
if (i == k):
lower[i][i] = 1; # for Diagonal as 1
else:
  
# Summation of Lower(k, j) * Upper(j, i)
sum = 0;
for j in range(i):
sum += (lower[k][j] * upper[j][i]);
  
# Evaluating Lower(k, i)
lower[k][i] = int((mat[k][i] - sum) /
upper[i][i]);
  
# setw is used for displaying
print("Lower Triangular\t\tUpper Triangular");
  
#result :
for i in range(n):
  
# for Lower
for j in range(n):
print(lower[i][j], end = "\t");
print("", end = "\t");
  
# for Upper
for j in range(n):
print(upper[i][j], end = "\t");
print("");
  
# given data
matrix = [[4, -1, 0],
[-1, 4, -1],
[0, -1, 4]];
#for main function
lud(mat, 3);


  


Related Solutions

Using dynamic programming, find an optimal parenthesization of a matrix-chain product of 4 matrices whose dimensions...
Using dynamic programming, find an optimal parenthesization of a matrix-chain product of 4 matrices whose dimensions are p = { 1, 10, 5, 20, 2}. Show your work.
Find the solution to the heat equation on 0 < x < l, with u(0, t)...
Find the solution to the heat equation on 0 < x < l, with u(0, t) = 0, ux(l, t) = 0, and u(x, 0) = phi(x). This is sometimes called a "mixed" boundary condition.
A:=<<0,-1,1>|<4,0,-2>|<2,-1,0>|<2,1,1>>; Matrix(3, 4, [[0, 4, 2, 2], [-1, 0, -1, 1], [1, -2, 0, 1]]) (a)...
A:=<<0,-1,1>|<4,0,-2>|<2,-1,0>|<2,1,1>>; Matrix(3, 4, [[0, 4, 2, 2], [-1, 0, -1, 1], [1, -2, 0, 1]]) (a) Use the concept of matrix Rank to argue, without performing ANY calculation, why the columns of this matrix canNOT be linerly independent. (b) Use Gauss-Jordan elimination method (you can use ReducedRowEchelonForm command) to identify a set B of linearly independent column vectors of A that span the column space of A. Express the column vectors of A that are not included in the set...
Using the standard addition method, find Cu: Cspike = 5.00 mg/L, YS+U = 0.491, YUonly =...
Using the standard addition method, find Cu: Cspike = 5.00 mg/L, YS+U = 0.491, YUonly = 0.203 Assume the final volumes are the same. Please show all work.
Find a singular value decomposition for the matrix A = [ 1 0 -1, -1 1...
Find a singular value decomposition for the matrix A = [ 1 0 -1, -1 1 0] (that means 1 0 -1 is the first row and -1 1 0 is the second) If you could provide a step-by-step tutorial on how to complete this I'd greatly appreciate it.
1. Consider the following game: L R L 2,1 0,0 R 1,0 3,2 a)Find all Nash...
1. Consider the following game: L R L 2,1 0,0 R 1,0 3,2 a)Find all Nash equilibria and derive the players’ expected payoffs in each of the Nash equilibria. b)Now change the payoffs slightly so that L R L 2,1 2,0 R 1,0 3,2 i.Derive all Nash equilibria for this modified game. ii.Have any of the Nash equilibria changed? If so, for each player explain why the player has or has not changed her strategy. c) Do the players in...
Programming Language Concept assignment: 1. Design abstract data type for matrices with integer elements in C++...
Programming Language Concept assignment: 1. Design abstract data type for matrices with integer elements in C++ language, including operations for matrix addition, subtraction, and multiplication! 2. Design abstract queue data types for float elements in C++ language, including operations for enqueue, dequeue, and empty. The dequeue operation removes the element and returns its value! 3. Set semaphores in Ada and use them to provide co-operation and synchronization of competitions in shared buffer instances!
Please find a solution to the following: Δu=0, 1<r<4, 0≤θ<2π u(1,θ)=cos5*θ, 0<θ<2π u(4,θ)=sin4*θ, 0<θ<2π
Please find a solution to the following: Δu=0, 1<r<4, 0≤θ<2π u(1,θ)=cos5*θ, 0<θ<2π u(4,θ)=sin4*θ, 0<θ<2π
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.
Question 4 Prove that the following language is not regular. ? = { 0 ?1 ?...
Question 4 Prove that the following language is not regular. ? = { 0 ?1 ? | ?, ? ≥ 0, ? ≠ 2? + 1 } Question 5 Prove that the following language is not regular. ? = { ? ∈ { 0, 1, 2} ∗ | #0 (?) + #1 (?) = #2 (?) } where #? (?) denotes the number of occurrences of symbol a in string w.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT