Q1 ANS Please answer Q2 and SHOW thepython code (working proof) with a picture as well Q2.
Fantastic news! We've Found the answer you've been seeking!
Question:
Q1 ANS
Please answer Q2 and SHOW thepython code (working proof) with a picture as well
Transcribed Image Text:
Q2. (LU decomposition) Write a python code for solving a system of linear equations by LU decomposition. Written in matrix form, a system of linear equations is expressed as Ax = b. The pivoted LU decomposition on A gives A = PLU. Then, the equations become PLUX = b. We can firstly solve Lz PTb for z by the forward substitution, and finally solve Uxz for x by the backward substitution. 1. Define a function plu_decomposition (A) which takes in A, does pivoted LU decomposition by scipy.linalg.lu(), and returns the permutation matrix P, the lower triangular matrix L and the upper triangular matrix U. 2. Define a function forward_subs (L, Pb) which takes in L and Pb, does forward substitution, and returns the result after forward substitution z. 3. Define a function solve_by_lu_decomp (A, b) which takes in A and b, does LU decomposition by calling plu_decomposition (A) defined in Q2.1, print out the result of LU decomposition (i.e., P. L and U), does forward substitution by calling forward_subs() defined in Q2.2 on L and PTb and returns z, does backward_substitution by calling backward_subs() defined in Q1.2 on U and z and returns the solution x. 4. Apply the function solve_by_lu_decomp (A, b) defined in Q2.3 to solve the following equations: 3 2 30-6 = 1-4 -1 1 31 5. Solve the same equations in Q2.4 by scipy.linalg.solve() directly. (25 marks) 9 -12 Q2. (LU decomposition) Write a python code for solving a system of linear equations by LU decomposition. Written in matrix form, a system of linear equations is expressed as Ax = b. The pivoted LU decomposition on A gives A = PLU. Then, the equations become PLUX = b. We can firstly solve Lz PTb for z by the forward substitution, and finally solve Uxz for x by the backward substitution. 1. Define a function plu_decomposition (A) which takes in A, does pivoted LU decomposition by scipy.linalg.lu(), and returns the permutation matrix P, the lower triangular matrix L and the upper triangular matrix U. 2. Define a function forward_subs (L, Pb) which takes in L and Pb, does forward substitution, and returns the result after forward substitution z. 3. Define a function solve_by_lu_decomp (A, b) which takes in A and b, does LU decomposition by calling plu_decomposition (A) defined in Q2.1, print out the result of LU decomposition (i.e., P. L and U), does forward substitution by calling forward_subs() defined in Q2.2 on L and PTb and returns z, does backward_substitution by calling backward_subs() defined in Q1.2 on U and z and returns the solution x. 4. Apply the function solve_by_lu_decomp (A, b) defined in Q2.3 to solve the following equations: 3 2 30-6 = 1-4 -1 1 31 5. Solve the same equations in Q2.4 by scipy.linalg.solve() directly. (25 marks) 9 -12
Expert Answer:
Answer rating: 100% (QA)
The code in the image provided does not correspond to the LU decomposition task described Instead th... View the full answer
Related Book For
College Mathematics for Business Economics Life Sciences and Social Sciences
ISBN: 978-0321614001
12th edition
Authors: Raymond A. Barnett, Michael R. Ziegler, Karl E. Byleen
Posted Date:
Students also viewed these programming questions
-
please show me er diagram as well as explain it between room and customer there will be many to many cardinality ratio please convert it into one to many .also show the entity hotel have staff and...
-
Please refer to the following short case as you answer these questions: After earning both her accounting degree and her CPA license, Barb opened her own public accounting practice. One of her...
-
If Jody's records show $2,000 in investment by owner, $10,000 in net income, $5,000 in assets and $1,000 in owner's drawings. What is Jody's ending owner's equity on a statement of changes in owner's...
-
Bond index mutual funds and exchange-traded funds (ETFs) using bonds have become increasingly popular in recent years. a. Would it be more or less difficult to construct a bond index mutual fund than...
-
How many exchanges are usually made in a one-year OIS swap?
-
On January 2, 2018, The Register, a science and technology news site based in Britain, published an article revealing the existence of two major bugs leaving virtually all computers and smartphones...
-
Depreciation for Partial PeriodSL, SYD, and DDB Alladin Company purchased Machine #201 on May 1, 2010. The following information relating to Machine #201 was gathered at the end of May....
-
Introduction : provide the reader a bulleted list of all the points your will discuss in the presentation. Database Management Systems: identify some basic concepts associated with database...
-
Capstone Case: Sunrise Bakery Expansion The Sunrise Bakery Corporation was originally founded in Houston, TX in 1991 by Griffin Harris, who currently serves as the company's Chief Executive Officer....
-
Company is Walmart How has the stock price performed from January 15, 2023 - present? Why did it perform in this manner? What is your company's value proposition? Why should someone invest in...
-
Enel was one of the largest power utilities companies in the world, with 80 billion in revenues for 2019. Its gross operating margin of 17.7 billion was generated from renewables (43 per cent),...
-
Under which conditions does being a first mover give sustainable competitive advantage?
-
According to the quantity theory of money, which variable in the quantity equation is most stable over long periods of time? a. money b. velocity c. price level d. output
-
What are the most frequent sources of failure in M&As?
-
What are the tools used by governments to promote foreign investments?
-
Explain Basic Concepts of Indexing and Hashing Query Processing.
-
Find the reduced echelon form of each of the matrices given in Problems 120. c 1 26 + 4
-
A small company manufactures picnic tables. The weekly fixed cost is $1,200 and the variable cost is $45 per table. Find the total weekly cost of producing x picnic tables. How many picnic tables can...
-
A pink-flowering plant is of genotype RW. If two such plants are crossed, we obtain a red plant (RR) with probability .25, a pink plant (RW or WR) with probability .50, and a white plant (WW) with...
-
Find the slope of the graph of equation. -x + 8y = 4
-
Martin Galloway, the sole proprietor of a consulting business, has gross receipts of $45,000 in 2017. His address is: 1223 Fairfield Street, Westfield, New Jersey and his SSN is 158-68-7799. Expenses...
-
Probest Corporation (a calendar-year corporation) purchased and placed the following assets in service during the year All assets are used 100 percent for business. $100,000 of the cost of the...
-
In May 2016, Jose purchased a used automobile for $12,000 and used it 75 percent for business. No Section 179 election was made for this asset. In 2017, Joses business use of the automobile decreased...
Study smarter with the SolutionInn App