{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Task 04\n", "\n", "**deadline: 21/03/2021 23:59 CET**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**[0.25 points]:** Edit the conjugate gradient method so that it returns a list of all iterations $ x^{(k)} $ (including the initial guess).\n", "\n", "**[0.25 points]:** Solve the following system of linear equations \n", "\n", "$$ \n", "4 x_1 + x_2 = 1,\n", "$$ \n", "\n", "$$\n", "x_1 + 3x_2 = 2\n", "$$\n", "\n", "using the edited conjugate gradient method withe the error tolerance of $ 10^{-15} $. Print the list of all iterations $ x^{(k)} $.\n", "\n", "**[0.5 points]:** Plot the iterations $ x^{(k)} $ and the contours of the function \n", "\n", "$$ \n", "f(x) = 1 \\, / \\, 2 \\, x^T \\mathbb{A} x - x^T b, \\ x \\in [-1, 1] \\times [-1, 1],\n", "$$\n", "\n", "where $ \\mathbb{A} $ is the coefficient matrix and $ b $ is the right-hand side vector, using the [`matplotlib.pyplot.scatter`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html) and the [`matplotlib.pyplot.contour`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contour.html) functions, respectively." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "# add your code here\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }