Conjugate Gradient

jon371449
Project-2-ConjugateGradient.pdf

PROJECT-2 (20 Points) Due Sunday October 25

The purpose of this project is to use the Conjugate Gradient Method to solve a system of equations given by

Hx=b, where H is the 20x20 Hilbert Matrix. Choose the vector b as you did in project#1. This way the exact

solution to Hx=b is the vector with entries 1,1,1,…1.

Convert the following algorithm to a computer program in your favorite language:

H=Hilbert Matrix, b = Row sum of H

Starting vector = xo = initial guess = the vector whose first entry is 1 but all

remaining entries are zero.

residual = ro = Hxo - b

search direction v = r

t = − 𝒓𝑇𝒗

𝒗𝑇H𝑣

update x1 := xo+ tv

if ||residual for 𝐱𝟏||∞ < 10 -3 stop and call it a converged solution. Else keep going

for a maximum of 75 iterations.

Turn in the following:

(a) Your computer program (which should be about half a page)

(b) Your converged solution or the vector x75 (the 75 th iteration)

(c) How many iterations did your program take?