"Soit $A$ une matrice $n\\times n $ inversible. Alors pour tout vecteur $\\overrightarrow{b}\\in \\mathbb{R}^n$, l'équation $A\\overrightarrow{x}=\\overrightarrow{b}$ admet pour unique solution le vecteur $$\n",
"\u001b[1mExecutez la ligne suivante pour effectuer l'opération choisie \u001b[0m\n"
]
}
],
=======
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
>>>>>>> e05dd5c1c87dd88990947782050b038375e5cfae
"source": [
"print('Vous allez échelonner la matrice augmenteé')\n",
"al.printAAug(A,b)\n",
"[i,j,r,alpha]= al.manualEch(A)\n",
"MatriceList=[np.array(A)]\n",
"RHSList = [np.array(b)]\n",
"m=np.concatenate((A,b), axis=1)\n",
"print('\\033[1mExecutez la ligne suivante pour effectuer l\\'opération choisie \\033[0m')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"m=al.echelonnage(i, j, r, alpha, A, m, MatriceList, RHSList)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"print('Insérez ici la valeur de la solution calculée')\n",
"x1 = [[1], [1], [1]]\n",
"res1 = al.SolOfSyst(x1, A, b)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### TASK 2: calculer l'inverse de la matrice A ([voir le Notebook 2.3](./2.3%20Matrices%20carrées%2C%20inversibles.ipynb)) et dériver la solution du système linéaire en fonction du résultat obtenu"
]
},
{
"cell_type": "code",
<<<<<<< HEAD
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vous allez échelonner la matrice augmenteé avec la matrice identité\n"
"print('Insérez ici la valeur de la solution calculée')\n",
"A_inv = [[1,0,0], [0,1,0], [0,0,1]]\n",
"x2 = np.dot(np.array(A_inv), np.array(b))\n",
"res2 = al.SolOfSyst(x2, A, b)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"if res1 and res2:\n",
" print(f'Tu as raison! Et en plus, x1 = {x1} est la seule solution au système linéaire')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"Considérez le système d'équations suivant:\n",
"\\begin{equation}\n",
"\\begin{cases}\n",
"x_1 + 2x_2 - x_3 &=0\\\\\n",
"2x_1 - x_2 - x_3 &=1\\\\\n",
"x_1 - 2x_2 + x_3 &=2\n",
"\\end{cases}\n",
"\\end{equation}\n",
"Laquelle des affirmations suivantes est correcte?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"corrections.Ex1Chapitre2_4()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Vous pouvez exécuter les cellules suivantes pour vous aider à calculer (éventuellement) la solution du système linéaire et l'inverse de la matrice $A$, si elle existe"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"A = [[1,2,-1],[2,-1,-1],[1,-2,1]]\n",
"b = [[1], [-2], [1]]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"print('Vous allez échelonner la matrice augmenteé')\n",
"al.printAAug(A,b)\n",
"[i,j,r,alpha]= al.manualEch(A)\n",
"MatriceList=[np.array(A)]\n",
"RHSList = [np.array(b)]\n",
"m=np.concatenate((A,b), axis=1)\n",
"print('\\033[1mExecutez la ligne suivante pour effectuer l\\'opération choisie \\033[0m')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"m=al.echelonnage(i, j, r, alpha, A, m, MatriceList, RHSList)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"I=[[1,0,0],[0,1,0],[0,0,1]]\n",
"print('Vous allez échelonner la matrice augmenteé avec la matrice identité')\n",
"al.printA(A,I)\n",
"[i,j,r,alpha]= al.manualEch(A,I)\n",
"m=np.concatenate((A,I), axis=1)\n",
"MatriceList=[A]\n",
"RhSList=[I]\n",
"print('\\033[1mExecutez la ligne suivante pour effectuer l\\'opération choisie \\033[0m')"