diff --git "a/Chapitre 1 - Systemes equations lineaires/1.5-1.6. Matrices Echelonn\303\251es.ipynb" "b/Chapitre 1 - Systemes equations lineaires/1.5-1.6. Matrices Echelonn\303\251es.ipynb" index 00061e9..84180c6 100644 --- "a/Chapitre 1 - Systemes equations lineaires/1.5-1.6. Matrices Echelonn\303\251es.ipynb" +++ "b/Chapitre 1 - Systemes equations lineaires/1.5-1.6. Matrices Echelonn\303\251es.ipynb" @@ -1,147 +1,235 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Concept(s)-clé(s) et théorie\n", "\n", "TBA." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import Librairie.AL_Fct as al\n", "import numpy as np\n", "import ipywidgets as widgets\n", "import random\n", "\n", "from ipywidgets import interact, interactive, fixed, interact_manual" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### **Exercice 1**\n", "\n", "À l'aide des opérations élémentaires, échelonner et réduire les matrices ci-dessous.\n", "\n", "$$\n", "\\begin{pmatrix}\n", "2 & -1\\\\\n", "1 &2\n", "\\end{pmatrix}\\hskip2em\n", "\\begin{pmatrix}\n", "\\dfrac{1}{2} & 3 & 0\\\\\n", "2 & -4 & 6\\\\\n", "1 & 3 &-1\n", "\\end{pmatrix}\\hskip2em\n", "\\begin{pmatrix}\n", "1 & 0 &1\\\\\n", "0 & 1 & -1\\\\\n", "1 & 1 &-1\n", "\\end{pmatrix}\n", "$$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "A=[[2,-1], [1,2]]" + "A=[[1,0,1], [0,1,-1],[1,1,-1]]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print('Vous allez échelonner la matrice')\n", "al.printA(A)\n", "[i,j,r,alpha]= al.manualEch(A)\n", - "MatriceList=[A]\n", - "m=np.matrix(A)\n", - "print('executez la ligne suivante pour effectuer l\\'opération choisie')" + "MatriceList=[np.array(A)]\n", + "m=np.array(A)\n", + "print('\\033[1mExecutez la ligne suivante pour effectuer l\\'opération choisie \\033[0m')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "m=al.echelonnage(i,j,r,alpha,A,m,MatriceList)" + "m=al.echelonnage(i, j, r, alpha, A, m, MatriceList)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### **Exercice 2**\n", + "\n", + "À l'aide des opérations élémentaires, échelonner et réduire les matrices (augmentée) ci-dessous.\n", + "\n", + "$$A=\n", + "\\begin{pmatrix}\n", + "2 & -1\\\\\n", + "1 &2\n", + "\\end{pmatrix}\\hskip1em\n", + "b=\n", + "\\begin{pmatrix}\n", + "1\\\\\n", + "2\n", + "\\end{pmatrix}\\hskip4em\n", + "A=\n", + "\\begin{pmatrix}\n", + "\\dfrac{1}{2} & 3 & 0\\\\\n", + "2 & -4 & 6\\\\\n", + "1 & 3 &-1\n", + "\\end{pmatrix}\\hskip1em\n", + "b=\n", + "\\begin{pmatrix}\n", + "1\\\\\n", + "2\\\\\n", + "-1\n", + "\\end{pmatrix}\\hskip4em\n", + "A=\n", + "\\begin{pmatrix}\n", + "1 & 0 &1\\\\\n", + "0 & 1 & -1\\\\\n", + "1 & 1 &-1\n", + "\\end{pmatrix}\\hskip1em\n", + "b=\n", + "\\begin{pmatrix}\n", + "1\\\\\n", + "0\\\\\n", + "-1\n", + "\\end{pmatrix}\n", + "$$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "A=[[1,1,1], [1,1,1],[1,1,1]]\n", + "b =[[1], [1], [1]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "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": {}, + "outputs": [], + "source": [ + "m=al.echelonnage(i, j, r, alpha, A, m, MatriceList, RHSList)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### **VERIFICATION**\n", "À l'aide des cellules ci-dessous, vous pouvez entrer la matrice (des coefficients ou augmentée) de votre choix et obtenir une forme échelonnée et sa forme échelonnée réduite.\n", "\n", "Pour **les formes échelonnées** on utilise la syntaxe suivante\n", "\n", "1. Pour la matrice $A$ : al.echelonMat('E', A)\n", "2. Pour la matrice augmentée $(A | b)$ : al.echelonMat('E', A, b)\n", "\n", "Pour obenir **les formes échelonnées réduites** mettez 'ER' au lieu de 'E'" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "A=[[1,2,3,4], [5,6,7,8], [9,10,11,12]]\n", - "b=[[-1],[-2],[-3]]" + "A=[[1,1], [1,1]]\n", + "b=[[1], [1]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "M=al.echelonMat('E',A,b)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "M=al.echelonMat('ER',A,b)" + "M" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.6.8" + "version": "3.7.4" } }, "nbformat": 4, "nbformat_minor": 4 }