Conjugate Gradient
Using java or matlab
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 20×20 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?