Question: #forward substitution def forward _ subs ( G , b ) : rows,cols = G . shape x = np . zeros ( ( rows

#forward substitution
def forward_subs(G,b):
rows,cols = G.shape
x = np.zeros((rows,),dtype = float)
for i in range(rows):
Gx =0.0
for j in range(i):
Gx += G[i, j]* x[j]
x[i]=(b[i]- Gx)/ G[i, i]
return x
#forward substitution
def back_subs(G,b):
rows,cols = G.shape
x = np.zeros((rows,),dtype = float)
for i in range(rows -1,-1,-1):
Gx =0.0
for j in range(i +1, cols):
Gx += G[i, j]* x[j]
x[i]=(b[i]- Gx)/ G[i, i]
return(x)
use the forward substitution and backward substitution above to answer questions1 and 2
Question 1
define a function
name : cholesky factor
inputs : A (2D numpy array) that is positive definite
output : R (2d numpy array) the Cholesky factor of A
note 1 : the function should work for square matrices of any size
note 2 : use the bordered form of Cholesky decomposition
note 3 : call the forward substitution function to solve the triangular system in each step (except possibly the first 2)
Question 2
define a function
name : solve_system_cholesky
inputs : R (2D numpy array) that is a Cholesky factor, b (1d numpy array)
output : x (1d numpy array)
note 1 : the function should work for square matrices of any size
note 2 : the function should solve the equation Ax=b where the Cholesky factor R of A is provided
note 3 : call the forward subs and back subs functions to solve

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!