Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q3. (QR decomposition) Write a python code for solving a system of linear equations by QR decomposition. Written in matrix form, a system of linear

image text in transcribed

Q3. (QR decomposition) Write a python code for solving a system of linear equations by QR decomposition. Written in matrix form, a system of linear equations is expressed as Ax=b. The QR decomposition on A gives A QR. Then, the equations become QRx b. We can solve Rx = Q'b for x by the backward substitution 1. Define a function qr_decomposition(A) which takes in A, does QR decomposition by scipy.linalg.qr(), and returns the orthogonal matrix Q and the upper triangular matrix R 2. Define a function solve_by_gr_decomp (A, b) which takes in A and b, does QR decomposition by calling gr_decomposition(A) defined in Q3.1, print out the result of QR decomposition (i.e., Q and R), does backward_substitution by calling backward_subs() defined in Q1.2 on R and Q'b and returns the solution x. 3. Apply the function solve_by_9r_decomp(A, b) defined in Q3.2 to solve the following equations: 13 2 3 1 -44 -1 22 0.9 7 1 4. Solve the same equations in 23.3 by scipy.linalg. solve directly. (25 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago