diff --git "a/Chapitre 8 - Valeurs propres, vecteurs propres, diagonalisation/8.3 Polyn\303\264me caract\303\251ristique.ipynb" "b/Chapitre 8 - Valeurs propres, vecteurs propres, diagonalisation/8.3 Polyn\303\264me caract\303\251ristique.ipynb" index 7c8950d..ad75835 100644 --- "a/Chapitre 8 - Valeurs propres, vecteurs propres, diagonalisation/8.3 Polyn\303\264me caract\303\251ristique.ipynb" +++ "b/Chapitre 8 - Valeurs propres, vecteurs propres, diagonalisation/8.3 Polyn\303\264me caract\303\251ristique.ipynb" @@ -1,171 +1,314 @@ { "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "import numpy as np\n", "import sympy as sp\n", "from IPython.display import display, Latex\n", "from Ch8_lib import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Définition 1:\n", - "Soient $A\\in M_{n \\times n}(\\mathbb{R})$ et $t$ une indéterminée. Le polynôme caractéristique de $A$, noté $c_A(t)$, est le polynme défini par $$c_A(t)=\\det (A-tI)$$\n", + "Soient $A\\in M_{n \\times n}(\\mathbb{R})$ et $t$ un paramètre réel. Le polynôme caractéristique de $A$, noté $c_A(t)$, est le polynôme défini par $$c_A(t)=\\det (A-tI),$$ où $I$ est la matrice identité de taille $n\\times n$.\n", "\n", "### Proposition 2:\n", "Soient $A,P\\in M_{n\\times n}(\\mathbb{R})$ et supposons que soit inversible. Alors \n", "$$c_A(t)=c_{PAP^{-1}}(t).$$\n", "\n", "### Définition 3:\n", - "Soit $T:V \\to V$ une transformation linéaire d'un $\\mathbb{R}$-espace vectoriel de dimension finie $V$. On définit le polynôme caractéristique de $T$ par $c_T(t)=c_A(t),$ où $A=[T]_{\\mathscr{B}}$ pour une base ordonnée quelconque $\\mathscr{B}$ de $V$.\n", + "Soient $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie et $T:V \\to V$ une transformation linéaire. On définit le polynôme caractéristique de $T$ par $c_T(t)=c_A(t),$ où $A=[T]_{\\mathscr{B}}$ pour une base ordonnée quelconque $\\mathscr{B}$ de $V$.\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "$\\lambda \\in \\mathbb{R}$ est une valeur propre de $A\\in M_{n \\times n}(\\mathbb{R})$ si et seulement si: $$ c_A(\\lambda) = \\det (A-\\lambda I) = 0$$" + "Le nombre réel $\\lambda$ est une valeur propre de $A\\in M_{n \\times n}(\\mathbb{R})$ si et seulement si: $$ c_A(\\lambda) = \\det (A-\\lambda I) = 0$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exemple 1\n", - "Méthode pour calculer les valeurs propres d'une matrice $3 \\times 3$.\n" + "Nous allons voir la méthode pour calculer les valeurs propres d'une matrice $3 \\times 3$.\n", + "1. Calculer le déterminant $\\det (A-\\lambda I)$ avec $\\lambda$ comme paramètre;\n", + "2. Obtenir un polynôme;\n", + "3. Trouver les racine du polynôme.\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/latex": [ + "$\\left|\\begin{matrix}1 - \\lambda & 1 & 1\\\\1 & 1 - \\lambda & 1\\\\1 & 1 & 1 - \\lambda\\end{matrix}\\right| = (1 - \\lambda)\\left|\\begin{matrix}1 - \\lambda & 1\\\\1 & 1 - \\lambda\\end{matrix}\\right|-1\\left|\\begin{matrix}1 & 1\\\\1 & 1 - \\lambda\\end{matrix}\\right|+1\\left|\\begin{matrix}1 & 1 - \\lambda\\\\1 & 1\\end{matrix}\\right|$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\left|\\begin{matrix}1 - \\lambda & 1 & 1\\\\1 & 1 - \\lambda & 1\\\\1 & 1 & 1 - \\lambda\\end{matrix}\\right| = (1 - \\lambda)\\cdot (\\left(1 - \\lambda\\right)^{2} - 1)-1\\cdot (- \\lambda)+1\\cdot (\\lambda)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\left|\\begin{matrix}1 - \\lambda & 1 & 1\\\\1 & 1 - \\lambda & 1\\\\1 & 1 & 1 - \\lambda\\end{matrix}\\right| = \\lambda^{2} \\left(3 - \\lambda\\right)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Définition de la matrice (Par défaut, les coefficients sont fixés à 1)\n", "A = [[1,1,1],[1,1,1],[1,1,1]]\n", "\n", "# Calcul étape par étape du polynome caractéristique (degré 3 ici).\n", "poly_char_3x3(A)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "On a donc le polynome caractéristique de la matrice A, les valeurs propres sont les racines de ce polynôme.\n", "On résout $$\\det (A- \\lambda I) = 0$$" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/latex": [ + "Les racines du polynôme caractéristiques (les valeurs propres de A) sont: $\\left[ 0, \\ 3\\right]$." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "# Resoud l'équation ci-dessus\n", + "# La ligne suivante résout l'équation ci-dessus\n", "solve_poly_char(A)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercice 1\n", - "Trouver les valeurs propres des matrices données ci-dessous en trouvant les racines du polynôme caractéristique. \n", + "Trouver les valeurs propres des matrices données ci-dessous en trouvant les racines des polynômes caractéristiques. \n", "\n", "*Pour trouver les racines des polynômes caractéristiques de degré 3 ou 4, factorisez à l'aide de racines évidentes $\\in [-2, -1, 0, 1, 2]$*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "$$ \n", - "A_1 = \\left(\\begin{matrix}-2 & 4\\\\5 & -1\\end{matrix}\\right) \\hspace{20mm}\n", - "A_2 = \\left(\\begin{matrix}1 & 2\\\\3 & 1\\end{matrix}\\right) \\hspace{20mm} \n", - "A_3 = \\left(\\begin{matrix}1 & 0 & 4\\\\1 & 3 & 1\\\\2 & 4 & -1\\end{matrix}\\right)\n", - "$$\n", - "\n", - "$$ \n", - "A_4 = \\left(\\begin{matrix}4 & 0 & 1\\\\-2 & 1 & 0\\\\-2 & 0 & 1\\end{matrix}\\right) \\hspace{20mm}\n", - "A_5 = \\left(\\begin{matrix}1 & 2 & 0 & 0\\\\2 & 1 & 0 & 0\\\\-4 & 2 & 2 & -1\\\\-8 & 5 & 0 & 1\\end{matrix}\\right) \\hspace{20mm}\n", - " A_6 = \\left(\\begin{matrix}4 & 0 & 0 & 0\\\\7 & -11 & 0 & 0\\\\-0.5 & 2.3 & \\sqrt{2} & 0\\\\-8 & 5 & 2 & 11\\end{matrix}\\right)\n", - "$$\n" + "\\begin{align*}\n", + "& A_1 = \\left(\\begin{matrix}-2 & 4\\\\5 & -1\\end{matrix}\\right) &\n", + "&A_2 = \\left(\\begin{matrix}1 & 2\\\\3 & 1\\end{matrix}\\right) &\n", + "&A_3 = \\left(\\begin{matrix}1 & 0 & 4\\\\1 & 3 & 1\\\\2 & 4 & -1\\end{matrix}\\right)\n", + "\\\\[1em]\n", + "& A_4 = \\left(\\begin{matrix}4 & 0 & 1\\\\-2 & 1 & 0\\\\-2 & 0 & 1\\end{matrix}\\right) &\n", + "& A_5 = \\left(\\begin{matrix}1 & 2 & 0 & 0\\\\2 & 1 & 0 & 0\\\\-4 & 2 & 2 & -1\\\\-8 & 5 & 0 & 1\\end{matrix}\\right) & \n", + "& A_6 = \\left(\\begin{matrix}4 & 0 & 0 & 0\\\\7 & -11 & 0 & 0\\\\-0.5 & 2.3 & \\sqrt{2} & 0\\\\-8 & 5 & 2 & 11\\end{matrix}\\right)\n", + "\\end{align*}\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# Trouver les valeurs propres des matrices suivantes\n", "A1 = [[-2, 4], [5, -1]]\n", "A2 = [[1, 2], [3, 1]]\n", "A3 = [[1, 0, 4], [1, 3, 1], [2, 4, -1]]\n", "A4 = [[4, 0, 1], [-2, 1, 0], [-2, 0, 1]]\n", "A5 = [[1, 2, 0, 0], [2, 1, 0, 0], [-4, 2, 2, -1], [-8, 5, 0, 1]]\n", "A6 = [[4, 0, 0, 0], [7, -11, 0, 0], [-0.5, 2.3, sp.sqrt(2), 0], [-8, 5, 2, 11]]\n", "\n", - "# Vous pouvez egalement rentrer une matrice de votre choix et afficher son polynôme caractéristique \n", + "# Vous pouvez également rentrer une matrice de votre choix et afficher son polynôme caractéristique \n", "# et ses valeurs propres\n", "A_7 = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/latex": [ + "Quelles sont les valeurs propres de la matrice $A= \\left(\\begin{matrix}1 & 2\\\\3 & 1\\end{matrix}\\right)$ ? (Entrez les valeurs propres sous la forme d'une liste: [$\\lambda_1$, $\\lambda_2$, ...]" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c65d5c12b1564364a53b7a35d4aae10c", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Text(value='[0, 0]', description='Valeur(s) propre(s)')" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c9eea002e7424ab6a799019977870253", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "interactive(children=(Button(description='Run Interact', style=ButtonStyle()), Output()), _dom_classes=('widge…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "Si vous n'arrivez pas à trouver les valeurs propres, vous pouvez afficher la solution détaillée." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "76b1cad78d4947858112a26c4b66e93d", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "interactive(children=(Button(description='Run Interact', style=ButtonStyle()), Output()), _dom_classes=('widge…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Choisir matrice (A = A1 ou A = A2 ...)\n", - "A = A1\n", + "A = A2\n", "\n", "interactive_valeur_propres(A)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Choisir matrice (A = A1 ou A = A2 ...)\n", "A = A1\n", "\n", "# Affiche la solution étape par étape pour la matrice A\n", "valeurs_propres(A)" ] } ], "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.7.2" + "version": "3.6.9" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }