Task 04

Task 04

deadline: 21/03/2021 23:59 CET

[0.25 points]: Edit the conjugate gradient method so that it returns a list of all iterations x(k) (including the initial guess).

[0.25 points]: Solve the following system of linear equations

4x1+x2=1,
x1+3x2=2

using the edited conjugate gradient method withe the error tolerance of 1015. Print the list of all iterations x(k).

[0.5 points]: Plot the iterations x(k) and the contours of the function

f(x)=1/2xTAxxTb, x[1,1]×[1,1],

where A is the coefficient matrix and b is the right-hand side vector, using the matplotlib.pyplot.scatter and the matplotlib.pyplot.contour functions, respectively.

# add your code here