Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Numpy and Python. a) Implement back substitution in Python, using Numpy. Use simple numpy function, f.ex. numpy.dot. Solve for Rx = b, where R =

Numpy and Python.

a) Implement back substitution in Python, using Numpy. Use simple numpy function, f.ex. numpy.dot. Solve for Rx = b, where R = numpy.array([[1,4,1], [0,6,4], [0,0,2]]) is the upper triangle matrix and b = numpy.array([3,2,1]) is the lower triangle matrix.

image text in transcribed

Use the following code:

def backsub(R,b): """ back substitution input: n x n upper triangle matrix R (treated as a normal matrix) n-vector b output: The solution x for Rx=b """ n=R.shape[0] x=np.zeros(n) # enter code here # ... return x

b) Implement an algorithm that solves the linear square simultaneous equation Ax = b with QR decomposition and back substitution. Use the following code and the qr and backsub functions from a), as well as Numpy. Solve the simulataneous equation Ax = b, with A = numpy.array([1,2,-1],[-1,1,1],[1,-4,1]]) and b = numpy.array([1,2,3]) with your code.

image text in transcribed

Begin with this code:

def linsolve(A,b): """ Solves Ax=b""" # enter code here # ... return x

Algorithm 11.1 BACK SUBSTITUTION given an n x n upper triangular matrix R with nonzero diagonal entries, and an n-vector b. Fori,1

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

8-6 Who poses the biggest security threat: insiders or outsiders?

Answered: 1 week ago