Question: Python Code 4. (25 points) (30 points for UG) Conjugate Gradient (CG): Let Abe nxn positive definite matrix. Implement the CG method for solving the
Python Code

4. (25 points) (30 points for UG) Conjugate Gradient (CG): Let Abe nxn positive definite matrix. Implement the CG method for solving the linear system Ar-b as outlined below Initialize xo; Set ro - Azo -b; while rk / 0 do k+1 TK Tk end Apply your algorithm to solve a linear system in which Aij -1/(i+j-1) and b- (1,1,... ,1)7. Set the initial point zo 0 and try dimensions 5,8. Report the number of iterations required to reduce the residual below 10-6. Verify your solutions by comparing your results with the builtin scipy solveir. 4. (25 points) (30 points for UG) Conjugate Gradient (CG): Let Abe nxn positive definite matrix. Implement the CG method for solving the linear system Ar-b as outlined below Initialize xo; Set ro - Azo -b; while rk / 0 do k+1 TK Tk end Apply your algorithm to solve a linear system in which Aij -1/(i+j-1) and b- (1,1,... ,1)7. Set the initial point zo 0 and try dimensions 5,8. Report the number of iterations required to reduce the residual below 10-6. Verify your solutions by comparing your results with the builtin scipy solveir
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
