Conjugate gradient method http://www.webpages.uidaho.edu/~barannyk/Teaching/hw7_Math432.pdf
Can someone help with #2? This is NOT homework. This was a website for Fall 2011, but it is a very interesting question and I would greatly appreciate help
Thanks
 A: We can use the CG algorithm, presented e.g. here at Wikipedia.
function [x] = conjgrad(A,b,x)
    r=b-A*x;
    p=r;
    rsold=r'*r;

    for i=1:10000000
        Ap=A*p;
        alpha=rsold/(p'*Ap);
        x=x+alpha*p;
        r=r-alpha*Ap;
        rsnew=r'*r;
        if sqrt(rsnew)<0.05 
            disp(i)          % Note: I added this to see the number of Iteration
            break;
        end
        p=r+rsnew/rsold*p;
        rsold=rsnew;
    end
end

We then have to set up our matrices as described in the pdf, lets also call it $A$.
We have $b$ as our right hande side and need a startvector $x$. For $x$ I simply took $x=rand(size(b))$, so just a random vector of the same size as $b$.
Running the code, we can see that it takes 7 Iteration.
For b) you should take a look at this. You have to modify the code above. Then c) is just playing with your code. It would be nice if you provide Information on what you tried. Also instead of calling CG "a bunch of formulas" you could simply understand and apply these formulas.
