diff --git a/Week 3/7 Linear Equation Systems.ipynb b/Week 3/7 Linear Equation Systems.ipynb index 7245b4d..a318112 100644 --- a/Week 3/7 Linear Equation Systems.ipynb +++ b/Week 3/7 Linear Equation Systems.ipynb @@ -70,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "metadata": { "deletable": false, "nbgrader": { @@ -85,29 +85,7 @@ "task": false } }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[ 1.75781401, 1.51265934, -2.74738978, -1.07039898, 0.8011521 ,\n", - " 1.4647544 ],\n", - " [-2.71620167, -0.86457733, 0.10081129, -0.73161518, -2.78224414,\n", - " 0.41565052],\n", - " [-0.67163289, 1.56932333, 2.48595706, -2.40628501, 0.71051658,\n", - " -0.69975624],\n", - " [ 1.58537064, 1.68053005, 2.06468208, 2.35512153, -0.66624755,\n", - " 2.62150694],\n", - " [-3.14413521, -2.23161046, 1.14029891, -1.55518494, 2.72967878,\n", - " -2.42673772],\n", - " [-2.97430088, -2.15350692, -2.82033592, 2.92079141, 2.94935414,\n", - " -0.35649436]])" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "import numpy as np" ] @@ -210,7 +188,32 @@ } }, "source": [ - "YOUR ANSWER HERE" + "We start from our linear equations:\n", + "\n", + "$$Ax = b$$\n", + "\n", + "We seperate A into different components (diagonal, strictly lower triangular and strictly upper triangular):\n", + "\n", + "$$A = D - L - U$$\n", + "\n", + "\n", + "We write $D - L$ as $L'$ to get:\n", + "\n", + "\n", + "$$(L' - U)x = b$$\n", + "\n", + "\n", + "We take the iterative process of the Gauss-Seidel method to write:\n", + "\n", + "\n", + "$$\n", + "L'x^k = b + Ux^{k-1}\\\\\n", + "x^k = L'^{-1}(b + Ux^{k-1})\\\\\n", + "$$\n", + "If we write every component of the matrix $A$ as $a_{ij}$, we can rewrite our previous equation to:\n", + "\n", + "\n", + "$$x^k _i = \\frac{1}{a_{ii}}\\left[-\\sum_{j=0}^{i-1}a_{ij}x_{j}^{k} -\\sum_{j=i+1}^{n-1}a_{ij}x_{j}^{k-1} + b_i\\right].$$" ] }, { @@ -677,7 +680,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" },