diff --git "a/Chapitre 4 - Bases et dimension/4.1-2. D\303\251pendance et ind\303\251pendance lin\303\251aire.ipynb" "b/Chapitre 4 - Bases et dimension/4.1-2. D\303\251pendance et ind\303\251pendance lin\303\251aire.ipynb"
index 2075e75..e4e0cd7 100644
--- "a/Chapitre 4 - Bases et dimension/4.1-2. D\303\251pendance et ind\303\251pendance lin\303\251aire.ipynb"
+++ "b/Chapitre 4 - Bases et dimension/4.1-2. D\303\251pendance et ind\303\251pendance lin\303\251aire.ipynb"
@@ -1,316 +1,186 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(s) et théorie\n",
"\n",
"### DÉFINITION 1\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel et $S\\subset V$ une collection de vecteurs dans $V.$ On dit que $S$ est linéairement dépendante (ou liée) s'il existe des vecteurs distincts $v_1,\\ldots,v_r\\in S$ et des scalaires $\\lambda_1,\\ldots,\\lambda_r\\in \\mathbb{R}$ non tous nuls tels que $\\lambda_1v_1+\\cdots+\\lambda_rv_r=0.$ (Autrement dit, s'il existe une combinaison linéaire (non triviale) de vecteurs de $S$ qui se réduit au vecteur nul.) S'il n'existe pas de tels vecteurs dans $S,$ alors on dit que $S$ est linéairement indépendante (ou libre).\n",
"\n",
"### PROPOSITION 1\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel et $v_1,\\ldots,v_r\\in V$ des vecteurs de $V.$ Alors ces derniers sont linéairement dépendants si et seulement s'il existe $1\\leq i\\leq r$ tels que $v_i\\in \\mbox{Vect}(\\{v_1,\\ldots,v_{i-1},v_{i+1},\\ldots,v_r\\}),$ c'est-à-dire si et seulement si l'on peut exprimer un des vecteurs de la liste comme une combinaison linéaire des autres.\n",
"\n",
"### PROPOSITION 2\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel et $S\\subset V$ une famille libre de vecteurs dans $V.$ Alors tout sous-ensemble $T\\subset S$ est aussi libre.\n",
"\n",
"### PROPOSITION 3\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel et $S\\subset V$ une famille liée de vecteurs dans $V.$ Alors toute collection de vecteurs $T$ contenant $S$ est également liée."
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
"outputs": [],
"source": [
- "%cd ..\n",
- "import Librairie.AL_Fct as al\n",
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"\n",
"Soient:\n",
"\n",
"$$v_1 = \\begin{pmatrix} 1 \\\\ 0 \\\\ 2 \\end{pmatrix} \\ \\ v_2 = \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} \\ \\ v_3 = \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix}$$\n",
"\n",
"Trouver une combinaison linéaire telle que:\n",
"\n",
"$$\\lambda_1 v_1 + \\lambda_2 v_2 + \\lambda_3 v_3 = \\begin{pmatrix} 3 \\\\ 5 \\\\ 4 \\end{pmatrix}$$\n",
"\n",
"Entrez les coefficients $\\lambda_i$ dans le vecteur ci-dessous puis exécutez les deux cellules pour vérifier votre réponse."
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def verification_1():\n",
- " v = np.array([[1, 0, 2], [0, 1, 0], [1, 1, 1]]).transpose()\n",
- " e = np.array([3, 5, 4])\n",
- " s = np.array(solution)\n",
- " r = v @ s\n",
- " if np.allclose(e, r):\n",
- " display(Markdown(\"**Correction:** C'est correct!\"))\n",
- " else:\n",
- " display(Markdown(\"**Correction:** C'est incorrect car: $\\lambda_1 v_1 + \\lambda_2 v_2 + \\lambda_3 v_3 = \\\\begin{pmatrix} %s \\\\\\\\ %s \\\\\\\\ %s \\end{pmatrix} \\\\neq \\\\begin{pmatrix} %s \\\\\\\\ %s \\\\\\\\ %s \\end{pmatrix}$\" % (r[0], r[1], r[2], e[0], e[1], e[2])))\n",
- " \n",
- " #plotly.offline.init_notebook_mode(connected=True)\n",
- " \n",
- " w = s * v\n",
- " \n",
- " x = np.cumsum(np.insert(w[0], 0, 0))\n",
- " y = np.cumsum(np.insert(w[1], 0, 0))\n",
- " z = np.cumsum(np.insert(w[2], 0, 0))\n",
- "\n",
- " pairs = [(0,1), (1,2), (2, 3)]\n",
- "\n",
- " x_lines = list()\n",
- " y_lines = list()\n",
- " z_lines = list()\n",
- "\n",
- " for p in pairs:\n",
- " for i in range(2):\n",
- " x_lines.append(x[p[i]])\n",
- " y_lines.append(y[p[i]])\n",
- " z_lines.append(z[p[i]])\n",
- " x_lines.append(None)\n",
- " y_lines.append(None)\n",
- " z_lines.append(None)\n",
- "\n",
- " trace1 = go.Scatter3d(\n",
- " x=x_lines,\n",
- " y=y_lines,\n",
- " z=z_lines,\n",
- " mode='lines+markers',\n",
- " name='Combinaison linéaire entrée',\n",
- " marker_symbol='cross'\n",
- " )\n",
- "\n",
- " trace2 = go.Scatter3d(\n",
- " x=[0, e[0]],\n",
- " y=[0, e[1]],\n",
- " z=[0, e[2]],\n",
- " mode='lines+markers',\n",
- " name='Résultat attendu',\n",
- " )\n",
- "\n",
- " fig = go.Figure(data=[trace1, trace2])\n",
- "\n",
- " fig.show()"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"solution = [1, 0, 2] # Réponse à compléter\n",
"\n",
- "verification_1()"
+ "Ex1Chapitre4_1(solution)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 2\n",
"\n",
"D'après les mêmes données que l'exercice 1, la collection des vecteurs $v_1$, $v_2$, $v_3$ et $\\begin{pmatrix} 3 \\\\ 0 \\\\ 4 \\end{pmatrix}$ est-elle liée ?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "radio = widgets.RadioButtons(\n",
- " options=['Oui, les vecteurs sont dépendants', 'Non, les vecteurs sont indépendants'],\n",
- " layout={'width': 'max-content'},\n",
- " value=None,\n",
- " description='Réponse:',\n",
- ")\n",
- "\n",
- "button = widgets.Button(description='Vérifier')\n",
- "\n",
- "out = widgets.Output()\n",
- "\n",
- "display(radio)\n",
- "display(button)\n",
- "display(out)\n",
- "\n",
- "def verification_2(e):\n",
- " if radio.value is not None:\n",
- " out.clear_output()\n",
- " with out:\n",
- " if radio.value.startswith('Oui'):\n",
- " display(Markdown(\"C'est incorrect, il existe $\\lambda_1$, $\\lambda_2$ et $\\lambda_3$ tels que $\\lambda_1 v_1 + \\lambda_2 v_2 + \\lambda_3 v_3 - \\\\begin{pmatrix} 3 \\\\\\\\ 0 \\\\\\\\ 4 \\end{pmatrix} = 0$.\"))\n",
- " else:\n",
- " display(Markdown(\"C'est correct!\"))\n",
- "\n",
- "button.on_click(verification_2)"
+ "Ex2Chapitre4_1()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 3\n",
"\n",
"Les collections de vecteurs suivantes sont-elles liées ?"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_3(answer):\n",
- " radio = widgets.RadioButtons(\n",
- " options=['Oui, les vecteurs sont dépendants', 'Non, les vecteurs sont indépendants'],\n",
- " layout={'width': 'max-content'},\n",
- " value=None,\n",
- " description='Réponse:',\n",
- " )\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
- "\n",
- " out = widgets.Output()\n",
- "\n",
- " display(radio)\n",
- " display(button)\n",
- " display(out)\n",
- "\n",
- " def verification_3(e):\n",
- " if radio.value is not None:\n",
- " out.clear_output()\n",
- " with out:\n",
- " if radio.value.startswith('Oui') == answer:\n",
- " display(Markdown(\"C'est correct!\"))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect!\"))\n",
- "\n",
- " button.on_click(verification_3)"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### (a)\n",
"\n",
"$$v_1 = \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix} \\ \\ v_2 = \\begin{pmatrix} 1 \\\\ 2 \\\\ 1 \\end{pmatrix} \\ \\ v_3 = \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(True)"
+ "Ex3Chapitre4_1(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### (b)\n",
"\n",
"$$v_1 = \\begin{pmatrix} 1 \\\\ 0 \\\\ 4 \\end{pmatrix} \\ \\ v_2 = \\begin{pmatrix} 6 \\\\ 12 \\\\ 7 \\end{pmatrix} \\ \\ v_3 = \\begin{pmatrix} 0 \\\\ 9 \\\\ 7 \\end{pmatrix} \\ \\ v_4 = \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(True)"
+ "Ex3Chapitre4_1(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### (c)\n",
"\n",
"$$v_1 = \\begin{pmatrix} 1 \\\\ 0 \\\\ -1 \\end{pmatrix} \\ \\ v_2 = \\begin{pmatrix} 1 \\\\ 1 \\\\ 0 \\end{pmatrix} \\ \\ v_3 = \\begin{pmatrix} 0 \\\\ 1 \\\\ -1 \\end{pmatrix}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(True)"
+ "Ex3Chapitre4_1(True)"
]
}
],
"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
}
diff --git a/Chapitre 4 - Bases et dimension/4.3. Bases et dimension.ipynb b/Chapitre 4 - Bases et dimension/4.3. Bases et dimension.ipynb
index d356ef2..80fe4ab 100644
--- a/Chapitre 4 - Bases et dimension/4.3. Bases et dimension.ipynb
+++ b/Chapitre 4 - Bases et dimension/4.3. Bases et dimension.ipynb
@@ -1,337 +1,210 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
"outputs": [],
"source": [
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
- "import matplotlib\n",
- "import plotly.express as px"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"# Concepts-clés et théorie\n",
"\n",
"### DÉFINITION 1 :\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel et $\\mathscr{B}\\subset V$ un ensemble de vecteurs de $V.$ On dit que $\\mathscr{B}$ est une *base* $V$ si les deux conditions suivantes sont vérifiées.\n",
"\n",
"1. Tout $v\\in V$ est une combinaison linaire de vecteurs de $\\mathscr{B},$ i.e. $\\mbox{Vect}\\mathscr{B}=V$ \n",
"\n",
"2. Le sous-ensemble $\\mathscr{B}$ est linéairement indépendant.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"\n",
"Cochez la bonne réponse puis cliquez sur \"Vérifier\"."
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_1(answer, reason, callback, options=['Oui, les vecteurs forment une base', 'Non, les vecteurs ne forment pas une base']):\n",
- " radio = widgets.RadioButtons(\n",
- " options=options,\n",
- " layout={'width': 'max-content'},\n",
- " value=None,\n",
- " description='Réponse:',\n",
- " )\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
- "\n",
- " out = widgets.Output()\n",
- "\n",
- " display(radio)\n",
- " display(button)\n",
- " display(out)\n",
- "\n",
- " def verification(e):\n",
- " if radio.value is not None:\n",
- " out.clear_output()\n",
- " with out:\n",
- " if options.index(radio.value) == answer:\n",
- " display(Markdown(\"C'est correct!
%s\" % reason))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect!
%s\" % reason))\n",
- " callback()\n",
- "\n",
- " button.on_click(verification)"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1. L'ensemble $\\begin{Bmatrix}\\begin{pmatrix} 1 \\\\ 0 \\\\ 1 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 2 \\\\ 0 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 0 \\\\ 3 \\end{pmatrix}, \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix}\\end{Bmatrix}$ est une base de $\\mathbb{R}^3$ :"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def plot_1(vectors, selected, solution):\n",
- " v = np.array(vectors).transpose()\n",
- " e = np.array(selected)\n",
- " s = np.array(solution)\n",
- " r = v @ s\n",
- " w = s * v\n",
- " \n",
- " cumsum = np.cumsum(np.insert(w, 0, 0, axis=1), axis=1).transpose()\n",
- " \n",
- " colors = px.colors.qualitative.Plotly\n",
- " global color_index\n",
- " color_index = 0\n",
- " \n",
- " data = []\n",
- " def addVector(start, v):\n",
- " global color_index\n",
- " \n",
- " color = colors[color_index]\n",
- " color_index = (color_index + 1) % len(colors)\n",
- " \n",
- " end = start + v\n",
- " trace = go.Scatter3d(\n",
- " x=[start[0], end[0], None],\n",
- " y=[start[1], end[1], None],\n",
- " z=[start[2], end[2], None],\n",
- " mode='lines',\n",
- " name=str(v),\n",
- " line=dict(color=color, width=4)\n",
- " )\n",
- " norm = np.sqrt(np.sum(v * v))\n",
- " n = v if norm == 0 else v / norm\n",
- " n = 0.5 * n\n",
- " cone = go.Cone(x=[end[0]], y=[end[1]], z=[end[2]], u=[n[0]], v=[n[1]], w=[n[2]], name=str(v), colorscale=[[0, color], [1, color]], hoverinfo=\"none\", showscale=False)\n",
- " \n",
- " data.append(trace)\n",
- " data.append(cone)\n",
- " \n",
- " addVector(np.zeros(3), e)\n",
- "\n",
- " for i in range(len(cumsum) - 1):\n",
- " start = cumsum[i]\n",
- " v = cumsum[i + 1] - start\n",
- " addVector(start, v)\n",
- "\n",
- " fig = go.Figure(data=data)\n",
- "\n",
- " fig.show()\n",
- " \n",
- "exercice_1(1, \"\"\"\n",
+ "Ex1Chapitre4_3(1, \"\"\"\n",
"\n",
"En effet, les quatres vecteurs ne sont pas linéairement indépendants (Déf. 1-2) car il est possible d'exprimer l'un en fonction d'une combinaison des autres. Par exemple :\n",
"$$\\\\begin{pmatrix} 1 \\\\\\\\ 1 \\\\\\\\ 1 \\end{pmatrix} = \\\\begin{pmatrix} 1 \\\\\\\\ 0 \\\\\\\\ 1 \\end{pmatrix} + \\\\frac{1}{2} \\\\begin{pmatrix} 0 \\\\\\\\ 2 \\\\\\\\ 0 \\end{pmatrix} + 0 \\\\begin{pmatrix} 0 \\\\\\\\ 0 \\\\\\\\ 3 \\end{pmatrix}$$\n",
"Comme tous les vecteurs sont issus de $\\mathbb{R}^3$ on peut facilement représenter la combinaison dans l'espace :\n",
"\"\"\", lambda: plot_1([[1, 0, 1], [0, 2, 0], [0, 0, 3]], [1, 1, 1], [1, 0.5, 0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2. L'ensemble $\\begin{Bmatrix}\\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix}\\end{Bmatrix}$ est une base de $\\mathbb{R}^3$ :"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_1(1, \"\"\"On ne peut pas générer $\\mathbb{R}^3$ à partir de cet ensemble. En effet, on ne peut par exemple pas représenter le vecteur $\\\\begin{pmatrix} 0 \\\\\\\\ 0 \\\\\\\\ 1 \\end{pmatrix} \\\\in \\mathbb{R}^3$ comme combinaison linéaire de $\\\\begin{pmatrix} 1 \\\\\\\\ 0 \\\\\\\\ 0 \\end{pmatrix}$ et $\\\\begin{pmatrix} 0 \\\\\\\\ 1 \\\\\\\\ 0 \\end{pmatrix}$.\n",
+ "Ex1Chapitre4_3(1, \"\"\"On ne peut pas générer $\\mathbb{R}^3$ à partir de cet ensemble. En effet, on ne peut par exemple pas représenter le vecteur $\\\\begin{pmatrix} 0 \\\\\\\\ 0 \\\\\\\\ 1 \\end{pmatrix} \\\\in \\mathbb{R}^3$ comme combinaison linéaire de $\\\\begin{pmatrix} 1 \\\\\\\\ 0 \\\\\\\\ 0 \\end{pmatrix}$ et $\\\\begin{pmatrix} 0 \\\\\\\\ 1 \\\\\\\\ 0 \\end{pmatrix}$.\n",
"\n",
"Graphiquement les deux vecteurs ne peuvent engendrer qu'un plan - et non un espace :\n",
"\"\"\", lambda: plot_1([[1, 0, 0]], [0, 1, 0], [1]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### DÉFINITION 2 :\n",
"\n",
"On dit d'un $\\mathbb{R}$-espace vectoriel $V$ qu'il est *de dimension finie* s'il possède une base finie. Sinon, on dit que $V$ est *de dimension infinie*.\n",
"\n",
"\n",
"### THÉORÈME 3 :\n",
"Soit $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie. Alors toutes les bases de $V$ sont finies et possèdent le mème nombre d'éléments."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 2\n",
"\n",
"Sélectionnez un ensemble de vecteurs parmi la liste suivante tel que cet ensemble forme une base de $\\mathbb{R}^3$ :\n",
"\n",
"$$v_1 = \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix},\\ v_2 = \\begin{pmatrix} 0 \\\\ 1 \\\\ 2 \\end{pmatrix},\\ v_3 = \\begin{pmatrix} 2 \\\\ 1 \\\\ 4 \\end{pmatrix},\\ v_4 = \\begin{pmatrix} 2 \\\\ 1 \\\\ 0 \\end{pmatrix},\\ v_5 = \\begin{pmatrix} 1 \\\\ 0 \\\\ -1 \\end{pmatrix}$$\n",
"\n",
"(maintenez CTRL pour sélectionner plusieurs cellules à la fois)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercise_2():\n",
- " vecs = np.array([[1, 1, 1], [0, 1, 2], [2, 1, 4], [2, 1, 0], [1, 0, -1]])\n",
- " \n",
- " select = widgets.SelectMultiple(\n",
- " options=['v1', 'v2', 'v3', 'v4', 'v5'],\n",
- " description='Sélection :',\n",
- " disabled=False\n",
- " )\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
- "\n",
- " out = widgets.Output()\n",
- "\n",
- " def callback(e):\n",
- " answer = [int(v[1:])-1 for v in select.value]\n",
- " out.clear_output()\n",
- " with out:\n",
- " if len(answer) == 0: # Empty\n",
- " pass\n",
- " elif len(answer) < 3:\n",
- " display(Markdown(\"C'est incorrect!
La solution entrée ne permet pas d'engendrer R^3.\"))\n",
- " elif len(answer) > 3:\n",
- " display(Markdown(\"C'est incorrect!
La solution entrée contient des vecteurs qui sont dépendants.\"))\n",
- " else:\n",
- " mat = np.array([vecs[answer[0]], vecs[answer[1]], vecs[answer[2]]]).transpose()\n",
- " det = np.linalg.det(mat)\n",
- " if det == 0:\n",
- " display(Markdown(\"C'est incorrect!
La solution entrée contient des vecteurs qui sont dépendants.\"))\n",
- " else: # Correct\n",
- " display(Markdown(\"C'est correct!
Il s'agit d'_une_ base.\"))\n",
- "\n",
- " button.on_click(callback)\n",
- "\n",
- " display(select)\n",
- " display(button)\n",
- " display(out)\n",
- " \n",
- "exercise_2()"
+ "Ex2Chapitre4_3()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 3\n",
"\n",
"Soit $\\mathbb{P}(\\mathbb{R})$ l'ensemble des polynômes à coefficients réels.\n",
"\n",
"- L'ensemble $\\{1, x, x^2\\}$ est-il une base de $\\mathbb{P}(\\mathbb{R})$ ?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_1(1, \"\"\"\n",
+ "Ex1Chapitre4_3(1, \"\"\"\n",
"\n",
"$\\mathbb{P}(\\mathbb{R})$ est un espace infini, il ne peut être généré que par des bases infinies (par exemple, $\\{1, x, x^2, x^3, ...\\}$).\n",
"\n",
"Cet ensemble ne forme donc pas une base pour $\\mathbb{P}(\\mathbb{R})$.\n",
"\"\"\", lambda: None)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 4\n",
"\n",
"Quelle est la dimension de l'espace engendré par l'ensemble de vecteurs suivant :\n",
"\n",
"$$\\begin{Bmatrix}\\begin{pmatrix} 1 & 1 \\\\ 0 & 0 \\end{pmatrix},\\ \\begin{pmatrix} 1 & 0 \\\\ 1 & 0 \\end{pmatrix},\\ \\begin{pmatrix} 0 & 0 \\\\ 1 & 1 \\end{pmatrix},\\ \\begin{pmatrix} 0 & 1 \\\\ 0 & 1 \\end{pmatrix},\\ \\begin{pmatrix} 1 & 0 \\\\ 0 & 1 \\end{pmatrix}\\end{Bmatrix}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_1(2, \"\"\"\n",
+ "Ex1Chapitre4_3(2, \"\"\"\n",
"\n",
"L'espace engendré par cet ensemble est $\\mathbb{R}^{2 \\\\times 2}$ et donc sa dimension est $4$.\n",
"\n",
"Attention cet ensemble n'est pas une base de $\\mathbb{R}^{2 \\\\times 2}$ car ses éléments sont linéairement dépendants !\n",
"\n",
"\"\"\", lambda: None, ['2', '3', '4', '5'])"
]
}
],
"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.9"
+ "version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 4 - Bases et dimension/4.4-5. Dimension et base dans un espace de dimension connue.ipynb b/Chapitre 4 - Bases et dimension/4.4-5. Dimension et base dans un espace de dimension connue.ipynb
index 7d3b0c3..d1170de 100644
--- a/Chapitre 4 - Bases et dimension/4.4-5. Dimension et base dans un espace de dimension connue.ipynb
+++ b/Chapitre 4 - Bases et dimension/4.4-5. Dimension et base dans un espace de dimension connue.ipynb
@@ -1,170 +1,108 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
"outputs": [],
"source": [
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
- "import matplotlib\n",
- "import plotly.express as px"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(S)\n",
"\n",
"\n",
"\n",
"### DÉFINITION 1 :\n",
"\n",
"Soit $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie. Le nombre d'éléments dans une base s'appelle la *dimension* de $V$ et on le désigne par $\\mbox{dim} V.$\n",
"\n",
"### PROPOSITION 2 :\n",
"\n",
"Soit $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie. Alors les deux affirmations suivantes sont vérifiées.\n",
"\n",
"\n",
"\n",
"1. Si $\\{v_1,\\ldots,v_r\\}$ est un ensemble générateur de $V,$ alors il existe une base $\\mathscr{B}$ de $V$ telle que $\\mathscr{B}\\subset \\{v_1,\\ldots,v_r\\}.$ On parle d'*extraction de base*.\n",
"\n",
"2. Si $\\{v_1,\\ldots,v_r\\}$ est une partie libre de $V,$ alors il existe une base $\\mathscr{B}$ de $V$ telle que $\\{v_1,\\ldots,v_r\\}\\subset \\mathscr{B}.$ On parle de *complétion en une base*."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"\n",
"Extraire une base $\\mathscr{B}$ de $\\mathbb{R}^3$ à partir des vecteurs suivants :\n",
"\n",
"$$v_1 = \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix},\\ v_2 = \\begin{pmatrix} 2 \\\\ 0 \\\\ 3 \\end{pmatrix},\\ v_3 = \\begin{pmatrix} 4 \\\\ 0 \\\\ 0 \\end{pmatrix},\\ v_4 = \\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice_1():\n",
- " vs = np.array([[1, 1, 1], [2, 0, 3], [4, 0, 0], [1, 0, 0]])\n",
- " \n",
- " select = widgets.SelectMultiple(\n",
- " options=['v1', 'v2', 'v3', 'v4'],\n",
- " description='Sélection :',\n",
- " disabled=False\n",
- " )\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " answer = [int(v[1:])-1 for v in select.value]\n",
- " out.clear_output()\n",
- " with out:\n",
- " if len(answer) == 0: # Empty\n",
- " pass\n",
- " elif len(answer) < 3:\n",
- " display(Markdown(\"C'est incorrect!
La solution entrée ne permet pas d'engendrer $\\\\mathbb{R}^3$, et n'est donc pas une base.\"))\n",
- " elif len(answer) > 3:\n",
- " display(Markdown(\"C'est incorrect!
La solution entrée engendre $\\\\mathbb{R}^3$ mais n'est pas une base.\"))\n",
- " else:\n",
- " mat = np.array([vs[answer[0]], vs[answer[1]], vs[answer[2]]]).transpose()\n",
- " if np.linalg.matrix_rank(mat) != len(mat):\n",
- " display(Markdown(\"C'est incorrect!
La solution entrée ne permet pas d'engendrer $\\\\mathbb{R}^3$, et n'est donc pas une base.\"))\n",
- " else: # Correct\n",
- " display(Markdown(\"C'est correct!
Il s'agit d'_une_ base de $\\\\mathbb{R}^3$.\"))\n",
- "\n",
- " button.on_click(callback)\n",
- "\n",
- " display(select)\n",
- " display(button)\n",
- " display(out)\n",
- "\n",
- "exercice_1()"
+ "Ex1Chapitre4_4()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 2\n",
"\n",
"Ajouter un vecteur à la liste suivante afin de former une base $\\mathscr{B}$ de $M^{2 \\times 2}$ :\n",
"\n",
"$$\\begin{Bmatrix}\\begin{pmatrix} 1 & 4 \\\\ 3 & 0 \\end{pmatrix}, \\begin{pmatrix} 1 & 0 \\\\ 0 & 1 \\end{pmatrix}, \\begin{pmatrix} 0 & 1 \\\\ 1 & 0 \\end{pmatrix}\\end{Bmatrix}$$"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_2(v):\n",
- " v = np.array(v)\n",
- " vs = np.array([[1, 4, 3, 0], [1, 0, 0, 1], [0, 1, 1, 0], v.flatten()])\n",
- " is_base = np.linalg.matrix_rank(vs) == len(vs)\n",
- " \n",
- " out = widgets.Output()\n",
- " display(out)\n",
- " \n",
- " with out:\n",
- " if is_base:\n",
- " display(Markdown(\"C'est correct!\"))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect, ce vecteur ne permet pas de former une base.\"))"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Complétez les valeurs puis exécutez la cellule\n",
"v = [[0, 0], [0, 0]]\n",
"\n",
- "exercice_2(v)"
+ "Ex2Chapitre4_4(v)"
]
}
],
"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.9"
+ "version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git "a/Chapitre 4 - Bases et dimension/4.6. Syst\303\250mes homog\303\250nes et base de l'espace des solutions.ipynb" "b/Chapitre 4 - Bases et dimension/4.6. Syst\303\250mes homog\303\250nes et base de l'espace des solutions.ipynb"
index e00de32..157cc10 100644
--- "a/Chapitre 4 - Bases et dimension/4.6. Syst\303\250mes homog\303\250nes et base de l'espace des solutions.ipynb"
+++ "b/Chapitre 4 - Bases et dimension/4.6. Syst\303\250mes homog\303\250nes et base de l'espace des solutions.ipynb"
@@ -1,247 +1,137 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
"outputs": [],
"source": [
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
- "import matplotlib\n",
- "import plotly.express as px\n",
- "import sympy as sp"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(S)\n",
"\n",
"\n",
"\n",
"### RAPPEL 1 :\n",
"\n",
"Soient $A\\in M_{m\times n}(\\mathbb{R})$ et $X = \\begin{pmatrix} x_1 \\; x_2 \\;\\cdots \\; x_n\\end{pmatrix}^T,$ où $x_1,\\ldots,x_n$ sont des inconnues. Alors l'ensemble des solutions du système linéaire $AX=0$ est un sous-espace vectoriel de $\\mathbb{R}^n.$\n",
"\n",
"### PROPOSITION 1 :\n",
"\n",
"Soient $A$ et $X$ comme ci-dessus. Alors la dimension de l'espace des solutions du système $AX=0$ est égale au nombre de variable(s) libre(s) dans une forme échelonnée de $A.$\n",
"\n",
"\n",
"\n",
"### PROPOSITION 2 :\n",
"\n",
"Soient $A$ et $X$ comme ci-dessus. Pour trouver une base de l'espace des solutions du système $AX=b,$ on pose successivement une des variables libre égale à $1$ et toutes les autres égales à $0.$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"\n",
"_Dimension maximale de l'espace des solutions_\n",
"\n",
"Soit une matrice $A$ à $4$ lignes et $6$ colonnes non nulles. Quelle est la dimension maximale de l'espace des solutions du système $AX = 0$ ?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice_1():\n",
- " text = widgets.IntText(\n",
- " description='Réponse :',\n",
- " disabled=False\n",
- " )\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " feedback = \"\"\n",
- " is_correct = False\n",
- " if r == 6:\n",
- " feeback = \"Comme la matrice n'est pas nulle, au moins une variable n'est pas libre.\"\n",
- " elif r >= 7:\n",
- " feedback = \"La dimension de l'espace des solutions ne peut excéder la dimension de l'espace des variables.\"\n",
- " elif r == 5:\n",
- " is_correct = True\n",
- " feedback = \"Le nombre maximal de variables libres dans ce système est $5$. Par la proposition 1 on en déduit la dimension maximale de l'espace des solutions du système homogène $AX = 0$.\"\n",
- " elif r >= 2 and r <= 4:\n",
- " feedback = \"Ce n'est pas le nombre maximal de variables libres dans ce système.\"\n",
- " elif r <= 1:\n",
- " feedback = \"Le nombre maximal de variables libres dans ce système ne peut être inférieur à $2$ ($\\\\text{nb. colonnes} - \\\\text{nb. lignes}$).\"\n",
- " \n",
- " correct_text = \"C'est correct!
\"\n",
- " incorrect_text = \"C'est incorrect.
\"\n",
- " \n",
- " with out:\n",
- " display(Markdown((correct_text if is_correct else incorrect_text) + feedback))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_1()"
+ "Ex1Chapitre4_6()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 2\n",
"\n",
"Soit la matrice $A$ avec les coefficients suivants :\n",
"\n",
"$$A = \\begin{pmatrix} 1 & 3 & 5 & 1 & 1 \\\\ -3 & -8 & -13 & 1 & 0 \\\\ 0 & -1 & -1 & -1 & -1 \\\\ 2 & 6 & 12 & 8 & 6 \\end{pmatrix}$$\n",
"\n",
"A l'aide de sa forme échelonnée (donnée ci-dessous), indiquer la dimension de l'espace des solutions du système homogène $AX = 0$.\n",
"\n",
"$$A' = \\begin{pmatrix} 1 & 3 & 5 & 1 & 1 \\\\ 0 & 1 & 2 & 4 & 3 \\\\ 0 & 0 & 1 & 3 & 2 \\\\ 0 & 0 & 0 & 0 & 0 \\end{pmatrix}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice_2():\n",
- " text = widgets.IntText(\n",
- " description='Réponse :',\n",
- " disabled=False\n",
- " )\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " \n",
- " with out:\n",
- " if r == 2:\n",
- " display(Markdown(\"C'est correct!
Le nombre de variables libres est $3$, par la proposition 1 on trouve la dimension de l'espace des solutions.\"))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect.\"))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_2()"
+ "Ex2Chapitre4_6()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 3\n",
"\n",
"_Base de l'espace des solutions_\n",
"\n",
"A l'aide de la forme échelonnée et de la réponse obtenues dans l'exercice 2 et de la proposition 2, donner une base de l'espace des solutions du système homogène $AX = 0$."
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_3(base):\n",
- " base = np.array(base)\n",
- " \n",
- " out = widgets.Output()\n",
- " display(out)\n",
- "\n",
- " with out:\n",
- " out.clear_output()\n",
- "\n",
- " feedback = \"\"\n",
- " is_correct = False\n",
- " \n",
- " s = base.shape\n",
- "\n",
- " if len(base) == 0:\n",
- " feedback = \"L'ensemble ne peut pas être vide.\"\n",
- " elif len(s) != 2 or s[1] != 5:\n",
- " feedback = \"Le format des vecteurs n'est pas bon.\"\n",
- " elif s[0] < 2:\n",
- " feedback = \"L'ensemble entré ne contient pas assez de vecteurs pour engendrer toutes les solutions du système.\"\n",
- " elif s[0] > 2:\n",
- " feedback = \"L'ensemble entré n'est pas une base.\"\n",
- " else:\n",
- " expected = np.array(sp.Matrix([[6, 1, -2, 0, 1], [8, 2, -3, 1, 0]]).rref()[0])\n",
- " actual = np.array(sp.Matrix(base).rref()[0])\n",
- " \n",
- " if not np.array_equal(actual, expected):\n",
- " feedback = \"L'ensemble entré n'engendre pas l'espace solution du système.\"\n",
- " else:\n",
- " is_correct = True\n",
- " \n",
- " correct_text = \"C'est correct!
\"\n",
- " incorrect_text = \"C'est incorrect.
\"\n",
- " \n",
- " display(Markdown((correct_text if is_correct else incorrect_text) + feedback))"
- ]
- },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Entrez les vecteurs qui formeront une base de la solution\n",
"# Par exemple : [[1, 2], [3, 4]]\n",
"base = []\n",
"\n",
- "exercice_3(base)"
+ "Ex3Chapitre4_6(base)"
]
}
],
"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.9"
+ "version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 4 - Bases et dimension/4.7-8. Dimension d'un sous-espace et d'une somme de sous-espaces.ipynb b/Chapitre 4 - Bases et dimension/4.7-8. Dimension d'un sous-espace et d'une somme de sous-espaces.ipynb
index 9955be7..2c4bcf3 100644
--- a/Chapitre 4 - Bases et dimension/4.7-8. Dimension d'un sous-espace et d'une somme de sous-espaces.ipynb
+++ b/Chapitre 4 - Bases et dimension/4.7-8. Dimension d'un sous-espace et d'une somme de sous-espaces.ipynb
@@ -1,333 +1,244 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
- "import matplotlib\n",
- "import plotly.express as px\n",
- "import sympy as sp"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(S)\n",
"\n",
"\n",
"\n",
"### THÉORÈME 1 :\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie et $W$ un sous-espace vectoriel de $V.$ Alors les affirmations suivantes sont vérifiées.\n",
"\n",
"\n",
"\n",
"1. Le sous-espace vectoriel $W$ est de dimension finie.\n",
"\n",
"2. La dimension de $W$ satisfait $\\dim W\\leq \\dim V$.\n",
"\n",
"3. Si $\\dim W=\\dim V,$ alors $W=V$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"\n",
"Soit un système de $3$ équations à $5$ inconnues.\n",
"\n",
"Quelle est la dimension de l'espace des solutions ? Cochez toutes les réponses valides (maintenez CTRL pour en sélectionner plusieurs)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice_1():\n",
- " select = widgets.SelectMultiple(\n",
- " options=['0', '1', '2', '3', '4', '5'],\n",
- " description='Réponse :',\n",
- " disabled=False\n",
- " )\n",
- " \n",
- " button = widgets.Button(description='Vérifier')\n",
- "\n",
- " out = widgets.Output()\n",
- "\n",
- " display(select)\n",
- " display(button)\n",
- " display(out)\n",
- "\n",
- " def verification(e):\n",
- " if len(select.value) > 0:\n",
- " out.clear_output()\n",
- " with out:\n",
- " other = \"
La dimension de l'espace des solutions dépend du nombre de variables libres : dans ce système celle-ci peut être au plus $5-3=2$.\"\n",
- " if select.value != ('0', '1', '2'):\n",
- " display(Markdown(\"C'est incorrect!\" + other))\n",
- " else:\n",
- " display(Markdown(\"C'est correct.\" + other))\n",
- "\n",
- " button.on_click(verification)\n",
- " \n",
- "exercice_1()"
+ "Ex1Chapitre4_7()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 2\n",
"\n",
"Soit $S_1$ un système de $2$ équations à $3$ inconnues et dont l'espace de solution forme un plan.\n",
"\n",
"On définit $S_2$ comme étant le système $S_1$ privé d'une équation.\n",
"\n",
"Quelle est la dimension de l'espace des solutions de $S_2$ ?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice_2():\n",
- " text = widgets.IntText(description='Réponse :')\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " \n",
- " with out:\n",
- " other = \"
En effet, comme la solution de $S_1$ est un plan les deux équations sont dépendantes. La solution de $S_2$ est donc aussi un plan, donc sa dimension est $2$.\"\n",
- " if r == 2:\n",
- " display(Markdown(\"C'est correct!\" + other))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect.\" + other))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_2()"
+ "Ex2Chapitre4_7()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 3\n",
"\n"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_3(answer, explanation):\n",
- " text = widgets.IntText(description='Réponse :')\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " \n",
- " with out:\n",
- " other = \"
\" + explanation\n",
- " if r == answer:\n",
- " display(Markdown(\"C'est correct!\" + other))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect.\" + other))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Donner dans chaque cas la dimension de la somme des deux espaces vectoriels :"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(a) $\\dim (W + V)$ avec $W$ un plan et $V$ une droite coplanaire à ce plan ; les deux passant par l'origine."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(2, \"$V$ est un sous-ensemble de $W$, donc $\\dim (W + V) = \\dim W = 2$.\")"
+ "Ex3Chapitre4_7(2, \"$V$ est un sous-ensemble de $W$, donc $\\dim (W + V) = \\dim W = 2$.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(b) $\\dim (W + V)$ avec $W$ un plan et $V$ une droite non coplanaire à ce plan ; les deux passant par l'origine."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(3, \"$W$ et $V$ sont deux espaces indépendants, donc $\\dim (W + V) = \\dim W + \\dim V = 2 + 1 = 3$.\")"
+ "Ex3Chapitre4_7(3, \"$W$ et $V$ sont deux espaces indépendants, donc $\\dim (W + V) = \\dim W + \\dim V = 2 + 1 = 3$.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(c) $\\dim (V + V)$ avec $V$ une droite passant par l'origine."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(1, \"La somme d'un même espace n'a pas d'effet : $\\dim (V + V) = \\dim V = 1$.\")"
+ "Ex3Chapitre4_7(1, \"La somme d'un même espace n'a pas d'effet : $\\dim (V + V) = \\dim V = 1$.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(d) $\\dim (V_1 + V_2)$ avec $V_1$ et $V_2$ deux droites distinctes passant par l'origine."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(2, \"$V_1$ et $V_2$ sont deux espaces indépendants, donc $\\dim (V_1 + V_2) = \\dim V_1 + \\dim V_2 = 1 + 1 = 2$.\")"
+ "Ex3Chapitre4_7(2, \"$V_1$ et $V_2$ sont deux espaces indépendants, donc $\\dim (V_1 + V_2) = \\dim V_1 + \\dim V_2 = 1 + 1 = 2$.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(e) $\\dim (W_1 + W_2)$ avec $W_1$ et $W_2$ deux plans distincts passant par l'origine."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(3, \"$\\dim (W_1 + W_2) = 2 + 2 - 1 = 3$.\")"
+ "Ex3Chapitre4_7(3, \"$\\dim (W_1 + W_2) = 2 + 2 - 1 = 3$.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(f) $\\dim (U + X)$ avec $U$ l'origine et $X$ l'espace tridimensionel."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "exercice_3(3, \"$\\dim (U + X) = 0 + 3 - 0 = 3$.\")"
+ "Ex3Chapitre4_7(3, \"$\\dim (U + X) = 0 + 3 - 0 = 3$.\")"
]
}
],
"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.9"
+ "version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 4 - Bases et dimension/Fonctions/chapitre4.py b/Chapitre 4 - Bases et dimension/Fonctions/chapitre4.py
new file mode 100644
index 0000000..1773558
--- /dev/null
+++ b/Chapitre 4 - Bases et dimension/Fonctions/chapitre4.py
@@ -0,0 +1,945 @@
+import sys
+sys.path.insert(0, './../')
+import Librairie.AL_Fct as al
+
+import numpy as np
+from IPython.display import display, Markdown, Latex
+import plotly.graph_objs as go
+import plotly
+import ipywidgets as widgets
+from ipywidgets import interact, interactive, fixed, interact_manual, Layout, HBox, VBox, Label
+import matplotlib
+import plotly.express as px
+import sympy as sp
+
+# Chapitres 4.1 - 4.2
+def Ex1Chapitre4_1(solution):
+ v = np.array([[1, 0, 2], [0, 1, 0], [1, 1, 1]]).transpose()
+ e = np.array([3, 5, 4])
+ s = np.array(solution)
+ r = v @ s
+ if np.allclose(e, r):
+ display(Markdown("**Correction:** C'est correct!"))
+ else:
+ display(Markdown("**Correction:** C'est incorrect car: $\lambda_1 v_1 + \lambda_2 v_2 + \lambda_3 v_3 = \\begin{pmatrix} %s \\\\ %s \\\\ %s \end{pmatrix} \\neq \\begin{pmatrix} %s \\\\ %s \\\\ %s \end{pmatrix}$" % (r[0], r[1], r[2], e[0], e[1], e[2])))
+
+ #plotly.offline.init_notebook_mode(connected=True)
+
+ w = s * v
+
+ x = np.cumsum(np.insert(w[0], 0, 0))
+ y = np.cumsum(np.insert(w[1], 0, 0))
+ z = np.cumsum(np.insert(w[2], 0, 0))
+
+ pairs = [(0,1), (1,2), (2, 3)]
+
+ x_lines = list()
+ y_lines = list()
+ z_lines = list()
+
+ for p in pairs:
+ for i in range(2):
+ x_lines.append(x[p[i]])
+ y_lines.append(y[p[i]])
+ z_lines.append(z[p[i]])
+ x_lines.append(None)
+ y_lines.append(None)
+ z_lines.append(None)
+
+ trace1 = go.Scatter3d(
+ x=x_lines,
+ y=y_lines,
+ z=z_lines,
+ mode='lines+markers',
+ name='Combinaison linéaire entrée',
+ marker_symbol='cross'
+ )
+
+ trace2 = go.Scatter3d(
+ x=[0, e[0]],
+ y=[0, e[1]],
+ z=[0, e[2]],
+ mode='lines+markers',
+ name='Résultat attendu',
+ )
+
+ fig = go.Figure(data=[trace1, trace2])
+
+ fig.show()
+
+
+def Ex2Chapitre4_1():
+ radio = widgets.RadioButtons(
+ options=['Oui, les vecteurs sont dépendants', 'Non, les vecteurs sont indépendants'],
+ layout={'width': 'max-content'},
+ value=None,
+ description='Réponse:',
+ )
+
+ button = widgets.Button(description='Vérifier')
+
+ out = widgets.Output()
+
+ display(radio)
+ display(button)
+ display(out)
+
+ def verification_2(e):
+ if radio.value is not None:
+ out.clear_output()
+ with out:
+ if radio.value.startswith('Oui'):
+ display(Markdown("C'est incorrect, il existe $\lambda_1$, $\lambda_2$ et $\lambda_3$ tels que $\lambda_1 v_1 + \lambda_2 v_2 + \lambda_3 v_3 - \\begin{pmatrix} 3 \\\\ 0 \\\\ 4 \end{pmatrix} = 0$."))
+ else:
+ display(Markdown("C'est correct!"))
+
+ button.on_click(verification_2)
+
+
+def Ex3Chapitre4_1(answer):
+ radio = widgets.RadioButtons(
+ options=['Oui, les vecteurs sont dépendants', 'Non, les vecteurs sont indépendants'],
+ layout={'width': 'max-content'},
+ value=None,
+ description='Réponse:',
+ )
+
+ button = widgets.Button(description='Vérifier')
+
+ out = widgets.Output()
+
+ display(radio)
+ display(button)
+ display(out)
+
+ def verification_3(e):
+ if radio.value is not None:
+ out.clear_output()
+ with out:
+ if radio.value.startswith('Oui') == answer:
+ display(Markdown("C'est correct!"))
+ else:
+ display(Markdown("C'est incorrect!"))
+
+ button.on_click(verification_3)
+
+
+# Chapitre 4.3
+def Ex1Chapitre4_3(answer, reason, callback, options=['Oui, les vecteurs forment une base', 'Non, les vecteurs ne forment pas une base']):
+ radio = widgets.RadioButtons(
+ options=options,
+ layout={'width': 'max-content'},
+ value=None,
+ description='Réponse:',
+ )
+
+ button = widgets.Button(description='Vérifier')
+
+ out = widgets.Output()
+
+ display(radio)
+ display(button)
+ display(out)
+
+ def verification(e):
+ if radio.value is not None:
+ out.clear_output()
+ with out:
+ if options.index(radio.value) == answer:
+ display(Markdown("C'est correct!
%s" % reason))
+ else:
+ display(Markdown("C'est incorrect!
%s" % reason))
+ callback()
+
+ button.on_click(verification)
+
+
+def plot_1(vectors, selected, solution):
+ v = np.array(vectors).transpose()
+ e = np.array(selected)
+ s = np.array(solution)
+ r = v @ s
+ w = s * v
+
+ cumsum = np.cumsum(np.insert(w, 0, 0, axis=1), axis=1).transpose()
+
+ colors = px.colors.qualitative.Plotly
+ global color_index
+ color_index = 0
+
+ data = []
+ def addVector(start, v):
+ global color_index
+
+ color = colors[color_index]
+ color_index = (color_index + 1) % len(colors)
+
+ end = start + v
+ trace = go.Scatter3d(
+ x=[start[0], end[0], None],
+ y=[start[1], end[1], None],
+ z=[start[2], end[2], None],
+ mode='lines',
+ name=str(v),
+ line=dict(color=color, width=4)
+ )
+ norm = np.sqrt(np.sum(v * v))
+ n = v if norm == 0 else v / norm
+ n = 0.5 * n
+ cone = go.Cone(x=[end[0]], y=[end[1]], z=[end[2]], u=[n[0]], v=[n[1]], w=[n[2]], name=str(v), colorscale=[[0, color], [1, color]], hoverinfo="none", showscale=False)
+
+ data.append(trace)
+ data.append(cone)
+
+ addVector(np.zeros(3), e)
+
+ for i in range(len(cumsum) - 1):
+ start = cumsum[i]
+ v = cumsum[i + 1] - start
+ addVector(start, v)
+
+ fig = go.Figure(data=data)
+
+ fig.show()
+
+
+def Ex2Chapitre4_3():
+ vecs = np.array([[1, 1, 1], [0, 1, 2], [2, 1, 4], [2, 1, 0], [1, 0, -1]])
+
+ select = widgets.SelectMultiple(
+ options=['v1', 'v2', 'v3', 'v4', 'v5'],
+ description='Sélection :',
+ disabled=False
+ )
+
+ button = widgets.Button(description='Vérifier')
+
+ out = widgets.Output()
+
+ def callback(e):
+ answer = [int(v[1:])-1 for v in select.value]
+ out.clear_output()
+ with out:
+ if len(answer) == 0: # Empty
+ pass
+ elif len(answer) < 3:
+ display(Markdown("C'est incorrect!
La solution entrée ne permet pas d'engendrer R^3."))
+ elif len(answer) > 3:
+ display(Markdown("C'est incorrect!
La solution entrée contient des vecteurs qui sont dépendants."))
+ else:
+ mat = np.array([vecs[answer[0]], vecs[answer[1]], vecs[answer[2]]]).transpose()
+ det = np.linalg.det(mat)
+ if det == 0:
+ display(Markdown("C'est incorrect!
La solution entrée contient des vecteurs qui sont dépendants."))
+ else: # Correct
+ display(Markdown("C'est correct!
Il s'agit d'_une_ base."))
+
+ button.on_click(callback)
+
+ display(select)
+ display(button)
+ display(out)
+
+
+# Chapitres 4.4 - 4.5
+def Ex1Chapitre4_4():
+ vs = np.array([[1, 1, 1], [2, 0, 3], [4, 0, 0], [1, 0, 0]])
+
+ select = widgets.SelectMultiple(
+ options=['v1', 'v2', 'v3', 'v4'],
+ description='Sélection :',
+ disabled=False
+ )
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ answer = [int(v[1:])-1 for v in select.value]
+ out.clear_output()
+ with out:
+ if len(answer) == 0: # Empty
+ pass
+ elif len(answer) < 3:
+ display(Markdown("C'est incorrect!
La solution entrée ne permet pas d'engendrer $\\mathbb{R}^3$, et n'est donc pas une base."))
+ elif len(answer) > 3:
+ display(Markdown("C'est incorrect!
La solution entrée engendre $\\mathbb{R}^3$ mais n'est pas une base."))
+ else:
+ mat = np.array([vs[answer[0]], vs[answer[1]], vs[answer[2]]]).transpose()
+ if np.linalg.matrix_rank(mat) != len(mat):
+ display(Markdown("C'est incorrect!
La solution entrée ne permet pas d'engendrer $\\mathbb{R}^3$, et n'est donc pas une base."))
+ else: # Correct
+ display(Markdown("C'est correct!
Il s'agit d'_une_ base de $\\mathbb{R}^3$."))
+
+ button.on_click(callback)
+
+ display(select)
+ display(button)
+ display(out)
+
+
+def Ex2Chapitre4_4(v):
+ v = np.array(v)
+ vs = np.array([[1, 4, 3, 0], [1, 0, 0, 1], [0, 1, 1, 0], v.flatten()])
+ is_base = np.linalg.matrix_rank(vs) == len(vs)
+
+ out = widgets.Output()
+ display(out)
+
+ with out:
+ if is_base:
+ display(Markdown("C'est correct!"))
+ else:
+ display(Markdown("C'est incorrect, ce vecteur ne permet pas de former une base."))
+
+
+# Chapitre 4.6
+def Ex1Chapitre4_6():
+ text = widgets.IntText(
+ description='Réponse :',
+ disabled=False
+ )
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+ feedback = ""
+ is_correct = False
+ if r == 6:
+ feeback = "Comme la matrice n'est pas nulle, au moins une variable n'est pas libre."
+ elif r >= 7:
+ feedback = "La dimension de l'espace des solutions ne peut excéder la dimension de l'espace des variables."
+ elif r == 5:
+ is_correct = True
+ feedback = "Le nombre maximal de variables libres dans ce système est $5$. Par la proposition 1 on en déduit la dimension maximale de l'espace des solutions du système homogène $AX = 0$."
+ elif r >= 2 and r <= 4:
+ feedback = "Ce n'est pas le nombre maximal de variables libres dans ce système."
+ elif r <= 1:
+ feedback = "Le nombre maximal de variables libres dans ce système ne peut être inférieur à $2$ ($\\text{nb. colonnes} - \\text{nb. lignes}$)."
+
+ correct_text = "C'est correct!
"
+ incorrect_text = "C'est incorrect.
"
+
+ with out:
+ display(Markdown((correct_text if is_correct else incorrect_text) + feedback))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+
+def Ex2Chapitre4_6():
+ text = widgets.IntText(
+ description='Réponse :',
+ disabled=False
+ )
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+
+ with out:
+ if r == 2:
+ display(Markdown("C'est correct!
Le nombre de variables libres est $3$, par la proposition 1 on trouve la dimension de l'espace des solutions."))
+ else:
+ display(Markdown("C'est incorrect."))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+def Ex3Chapitre4_6(base):
+ base = np.array(base)
+
+ out = widgets.Output()
+ display(out)
+
+ with out:
+ out.clear_output()
+
+ feedback = ""
+ is_correct = False
+
+ s = base.shape
+
+ if len(base) == 0:
+ feedback = "L'ensemble ne peut pas être vide."
+ elif len(s) != 2 or s[1] != 5:
+ feedback = "Le format des vecteurs n'est pas bon."
+ elif s[0] < 2:
+ feedback = "L'ensemble entré ne contient pas assez de vecteurs pour engendrer toutes les solutions du système."
+ elif s[0] > 2:
+ feedback = "L'ensemble entré n'est pas une base."
+ else:
+ expected = np.array(sp.Matrix([[6, 1, -2, 0, 1], [8, 2, -3, 1, 0]]).rref()[0])
+ actual = np.array(sp.Matrix(base).rref()[0])
+
+ if not np.array_equal(actual, expected):
+ feedback = "L'ensemble entré n'engendre pas l'espace solution du système."
+ else:
+ is_correct = True
+
+ correct_text = "C'est correct!
"
+ incorrect_text = "C'est incorrect.
"
+
+ display(Markdown((correct_text if is_correct else incorrect_text) + feedback))
+
+
+# Chapitres 4.7 - 4.8
+def Ex1Chapitre4_7():
+ select = widgets.SelectMultiple(
+ options=['0', '1', '2', '3', '4', '5'],
+ description='Réponse :',
+ disabled=False
+ )
+
+ button = widgets.Button(description='Vérifier')
+
+ out = widgets.Output()
+
+ display(select)
+ display(button)
+ display(out)
+
+ def verification(e):
+ if len(select.value) > 0:
+ out.clear_output()
+ with out:
+ other = "
La dimension de l'espace des solutions dépend du nombre de variables libres : dans ce système celle-ci peut être au plus $5-3=2$."
+ if select.value != ('0', '1', '2'):
+ display(Markdown("C'est incorrect!" + other))
+ else:
+ display(Markdown("C'est correct." + other))
+
+ button.on_click(verification)
+
+def Ex2Chapitre4_7():
+ text = widgets.IntText(description='Réponse :')
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+
+ with out:
+ other = "
En effet, comme la solution de $S_1$ est un plan les deux équations sont dépendantes. La solution de $S_2$ est donc aussi un plan, donc sa dimension est $2$."
+ if r == 2:
+ display(Markdown("C'est correct!" + other))
+ else:
+ display(Markdown("C'est incorrect." + other))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+def Ex3Chapitre4_7(answer, explanation):
+ text = widgets.IntText(description='Réponse :')
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+
+ with out:
+ other = "
" + explanation
+ if r == answer:
+ display(Markdown("C'est correct!" + other))
+ else:
+ display(Markdown("C'est incorrect." + other))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+
+# Chapitre 4.9
+def Ex1Chapitre4_9():
+ r1 = 'Le rang ligne de 𝐴 est plus petit ou égal à 2, car c\'est un sous-espace vectoriel de ℝ2.'
+ r2 = 'Le rang ligne de 𝐴 est plus petit ou égal à 3, car c\'est un sous-espace vectoriel de ℝ3.'
+ r3 = 'Le rang ligne de 𝐴 est plus petit ou égal à 3, car engendré par 3 vecteurs.'
+ r4 = 'Le rang ligne de 𝐴 est plus petit ou égal à 2, car engendré par 2 vecteurs.'
+ r5 = 'Le rang colonne de A est plus petit ou égal à 2.'
+
+ select = widgets.SelectMultiple(
+ options=[(r1, 1), (r2, 2), (r3, 3), (r4, 4), (r5, 5)],
+ description='Sélection :',
+ disabled=False,
+ layout=Layout(width='auto', height='100px')
+ )
+
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ with out:
+ if (1 in select.value or 3 in select.value):
+ print('Mauvaise réponse. \nAttention à ne pas confondre les espaces des lignes et colonnes')
+ elif (2 not in select.value or 4 not in select.value or 5 not in select.value):
+ print('Il manque au moins une réponse.')
+ elif (2 in select.value and 4 in select.value and 5 in select.value):
+ print('Correct !')
+
+ button.on_click(callback)
+
+ display(select)
+ display(button)
+ display(out)
+
+
+def Ex2_1Chapitre4_9():
+ text = widgets.IntText(
+ description='Réponse :',
+ disabled=False
+ )
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+
+ with out:
+ if r == 2:
+ display(Markdown("Par la proposition 4 c'est correct!"))
+ elif r > 2:
+ display(Markdown("Faux, c'est trop grand"))
+ else:
+ display(Markdown("Faux, c'est trop petit"))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+
+def Ex2_2Chapitre4_9():
+ select = widgets.SelectMultiple(
+ options=['E1', 'E2', 'E3', 'E4'],
+ description='Sélection :',
+ disabled=False,
+ layout=Layout(width='auto', height='auto')
+ )
+
+ button = widgets.Button(description='Vérifier')
+
+ out = widgets.Output()
+
+ def callback(e):
+
+ out.clear_output()
+ with out:
+ if len(select.value) <= 0: # Empty
+ pass
+ elif len(select.value) > 1:
+ display(Markdown("Un seul de ces ensembles génère exactement l'espace ligne de A"))
+ elif 'E1' not in select.value:
+ display(Markdown("Faux"))
+ else:
+ display(Markdown("Correct !"))
+ button.on_click(callback)
+ display(select)
+ display(button)
+ display(out)
+
+
+def Ex2_3Chapitre4_9():
+ text = widgets.IntText(description='Réponse :', disabled=False)
+
+ button = widgets.Button(description='Vérifier')
+ button2 = widgets.Button(description='Solution', disabled=True)
+ box = HBox(children=[button,button2])
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ button2.disabled = False
+ with out:
+ if(text.value == 2):
+ print('Correct !')
+ else:
+ print('Faux, essayez encore ou regardez la solution')
+
+ def solution(e):
+ out.clear_output()
+ with out:
+ A = np.array([[1, 2, 3], [0, 1, 2]])
+ A_t = A.transpose()
+ display(Markdown('Pour trouver le rang colonne de $A$, nous utilisons la remarque 1 et trouvous le rang ligne de la transposée de $A$.'))
+ display(Markdown('Par les propositions 1 et 2, nous échelonnons la matrice transposée et observont le nombre de lignes qui contiennent des pivots'))
+ M = al.echelonMat('E', A_t)
+ display(Markdown('Ainsi le rang colonne de $A$ est 2'))
+
+ button.on_click(callback)
+ button2.on_click(solution)
+
+ display(text)
+ display(box)
+ display(out)
+
+
+
+# Chapitre 4.10
+
+def Ex1_1Chapitre4_10(A,b):
+ A_sol = [[1, 4, 3, 4],[2, 6, 5, 8],[1, 0, 1, 4]]
+ b_sol = [[1], [1], [1]]
+ if A == [] or b == []:
+ print("Attention, vous avez laissé au moins une des deux entrée vide")
+ elif not (len(A) == len(b)):
+ print("Les tailles de la matrice et du vecteur ne correspondent pas")
+ else:
+ if A == A_sol:
+ if b == b_sol:
+ print("Correct !")
+ else:
+ print("Le vecteur b est faux, votre reponse correspond au système suivant:")
+ al.printSyst(A, b)
+ elif b == b_sol:
+ print("La Matrice A est fausse, votre reponse correspond au système suivant:")
+ al.printSyst(A, b)
+ else:
+ print("Faux, votre réponse correspond au système suivant:")
+ al.printSyst(A, b)
+
+def Ex1_2_ech_Chapitre_4_10():
+ global m
+ print('Échelonnez la matrice transposée de A')
+ A_sol = np.array([[1, 4, 3, 4],[2, 6, 5, 8],[1, 0, 1, 4]])
+ A_sol_t = A_sol.transpose()
+ al.printA(A_sol_t)
+ [i,j,r,alpha]= al.manualEch(A_sol_t)
+ MatriceList=[np.array(A_sol_t)]
+ m = A_sol_t
+
+
+ button = widgets.Button(description='Appliquer')
+ out = widgets.Output()
+
+ def applique(e):
+ global m
+ out.clear_output()
+ with out:
+ m=al.echelonnage(i, j, r, alpha, A_sol_t, m, MatriceList)
+
+ button.on_click(applique)
+ display(button)
+ display(out)
+
+def Ex1_2_1Chapitre_4_10():
+ text_rang = widgets.IntText()
+ box = VBox([Label('Rang colonne de A:'), text_rang])
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ with out:
+ if(text_rang.value == 2):
+ print('Correct !')
+ else:
+ print('Faux, essayez encore ou regardez la solution')
+
+ button.on_click(callback)
+ display(box)
+ display(button)
+ display(out)
+
+
+def Ex1_2_2Chapitre_4_10(base):
+ base_sol = [[1,2,1],[0,1,2]]
+
+ if base_sol == []:
+ print("L'entrée est vide")
+ else:
+ if base == base_sol:
+ print("Correct !")
+ else:
+ print("Faux")
+
+
+def Ex1_3Chapitre_4_10():
+ radio = widgets.RadioButtons(
+ options=['Oui', 'Non'],
+ description='Réponse:',
+ disabled=False
+ )
+
+ button = widgets.Button(description='Vérifier')
+ button2 = widgets.Button(description='Solution', disabled=True)
+ box = HBox(children=[button,button2])
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ button2.disabled = False
+ with out:
+ if (radio.value == "Oui"):
+ print('Mauvaise réponse.')
+ else:
+ print('Correct !')
+
+ def solution(e):
+ out.clear_output()
+ with out:
+ A = np.array([[1, 2, 1],[0, 1, 2],[0, 0, 1]])
+ display(Markdown('Après échelonnage, la matrice devient'))
+ al.printA(A)
+ display(Markdown("Ainsi le rang colonne de la matrice augmentée est 3, et le système n'admet pas de solution"))
+
+ button2.on_click(solution)
+ button.on_click(callback)
+
+ display(radio)
+ display(box)
+ display(out)
+
+
+# Chapitre 4.11
+def Ex1Chapitre4_11(base):
+ base_solution = [[1,2],[3,2]]
+ is_correct = all(item in base_solution for item in base)
+ if is_correct:
+ is_correct = all(item in base for item in base_solution)
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+
+def Ex2a_B1_Chapitre4_11(vB1):
+ v = [5,6]
+
+ if vB1==v:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex2a_B2_Chapitre4_11(vB2):
+ v = [2,1]
+
+ if vB2==v:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex2b_B1_Chapitre4_11(uB1):
+ u = [8,4]
+
+ if uB1==u:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex2b_B2_Chapitre4_11(uB2):
+ u = [-1,3]
+
+ if uB2==u:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex2c_B1_Chapitre4_11(wB1):
+ w = [5,4]
+
+ if wB1==w:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex2c_B2_Chapitre4_11(wB2):
+ w = [0.5,1.5]
+
+ if wB2==w:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex3_B1_Chapitre4_11(sB1):
+ s = [13,10]
+
+ if sB1==s:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+def Ex3_B2_Chapitre4_11(sB2):
+ s = [1,4]
+
+ if sB2==s:
+ is_correct = 1
+ else:
+ is_correct = 0
+
+ correct_text = "C'est correct!"
+ incorrect_text = "C'est incorrect."
+
+ display(correct_text if is_correct else incorrect_text)
+
+
+# Chapitre 4.12
+def Ex1Chapitre4_12():
+ nbr_ligne = widgets.IntText(
+ description='Nombre de lignes : \n',
+ disabled=False
+ )
+ nbr_colonne = widgets.IntText(
+ description='Nombre de colonne : \n',
+ disabled=False
+ )
+
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r_l = nbr_ligne.value
+ r_c = nbr_colonne.value
+ with out:
+ if r_l == 5 and r_c == 6:
+ display(Markdown("C'est correct!"))
+ else:
+ display(Markdown("C'est incorrect."))
+
+ button.on_click(callback)
+
+ display(nbr_ligne)
+ display(nbr_colonne)
+ display(button)
+ display(out)
+
+def Ex2Chapitre4_12():
+ text = widgets.IntText(
+ description='Réponse :',
+ disabled=False
+ )
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+
+ with out:
+ if r == 2:
+ display(Markdown("C'est correct!"))
+ else:
+ display(Markdown("C'est incorrect."))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+def Ex3aChapitre4_12():
+ text = widgets.IntText(
+ description='Réponse :',
+ disabled=False
+ )
+ button = widgets.Button(description='Vérifier')
+ out = widgets.Output()
+
+ def callback(e):
+ out.clear_output()
+ r = text.value
+
+ with out:
+ if r == 3:
+ display(Markdown("C'est correct!"))
+ else:
+ display(Markdown("C'est incorrect."))
+
+ button.on_click(callback)
+
+ display(text)
+ display(button)
+ display(out)
+
+
+def Ex3bChapitre4_12(base):
+ base = base + [[1,4,0,2,0,1],[0,1,1,2,1,0],[0,0,1,3,3,2]]
+ base = np.array(base)
+ out = widgets.Output()
+ display(out)
+
+ with out:
+ out.clear_output()
+
+ feedback = ""
+ is_correct = False
+
+ s = base.shape
+
+
+ if len(base) == 0:
+ feedback = "Les vecteurs nuls ne peuvent pas ."
+ elif len(s) != 2 or s[1] != 6:
+ feedback = "Le format des vecteurs n'est pas bon."
+ elif s[0] < 6:
+ feedback = "L'ensemble entré ne contient pas assez de vecteurs pour engendrer toutes les solutions du système."
+ elif s[0] > 6:
+ feedback = "L'ensemble entré contient trop de vecteurs pour être une famille libre."
+ else:
+ expected = np.array(sp.Matrix([[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,1,0,0,0],[0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0],[0, 0, 0, 0, 0, 1]]).rref()[0])
+ actual = np.array(sp.Matrix(base).rref()[0])
+
+ if not np.array_equal(actual, expected):
+ feedback = "L'ensemble entré n'engendre pas l'espace solution du système."
+ else:
+ is_correct = True
+
+ correct_text = "C'est correct!
"
+ incorrect_text = "C'est incorrect.
"
+
+ display(Markdown((correct_text if is_correct else incorrect_text) + feedback))
\ No newline at end of file
diff --git a/Chapitre 4 - Bases et dimension/Prototype 4.10.ipynb b/Chapitre 4 - Bases et dimension/Prototype 4.10.ipynb
index c4bd547..681f8a4 100644
--- a/Chapitre 4 - Bases et dimension/Prototype 4.10.ipynb
+++ b/Chapitre 4 - Bases et dimension/Prototype 4.10.ipynb
@@ -1,277 +1,205 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
+ "metadata": {},
"outputs": [],
"source": [
- "%cd ..\n",
- "import Librairie.AL_Fct as al\n",
- "%cd \"Chapitre 4 - Bases et dimension\"\n",
- "\n",
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual\n",
- "from ipywidgets import Layout, HBox, VBox, Label\n",
- "#import matplotlib\n",
- "#import plotly.express as px"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(s)\n",
"\n",
"\n",
"\n",
- "### LEMME 5 :\n",
+ "### LEMME:\n",
"\n",
- "Soit $S$ un système de $m$ équations linéaires à $n$ inconnues, $A$ la matrice des coefficients de $S$ et $\\hat{A}$ sa matrice augmentée. Alors $S$ possède une solution si et seulement si le rang colonne de $A$ est égal au rang colonne de $\\hat{A}.$"
+ "Soit $S$ un système de $m$ équations linéaires à $n$ inconnues, $A$ la matrice des coefficients de $S$ et $\\hat{A}$ sa matrice augmentée. Alors $S$ possède une solution si et seulement si le rang colonne de $A$ est égal au rang colonne de $\\hat{A}$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1.1\n",
"\n",
"Soit 𝑆 un système de 𝑚 équations linéaires à 𝑛 inconnues:\n",
"\n",
"$\\begin{equation}\n",
" \\left\\{\n",
" \\begin{aligned}\n",
" x_1 + 4x_2 + 3x_3 + 4x_4 = 1 \\\\ \n",
" 2x_1 + 6x_2 + 5x_3 + 8x_4 = 1 \\\\\n",
" x_1 + x_3 + 4x_4 = 1\n",
" \\end{aligned}\n",
" \\right.\n",
"\\end{equation}$\n",
"\n",
"Cette quation peut se repréenseter sous la forme $AX =b$.\n",
- "Ecrivez A la matrice et le vecteur b dans la cellule suivante en respectant\n",
+ "Ecrivez $A$ la matrice et le vecteur $b$ dans la cellule suivante en respectant le format suivant pour les matrices et les vecteurs\n",
"\n",
"$[[ a, b], [c, d]] = \\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}$\n",
"\n",
- "et b en suivant le format \n",
- "\n",
- "$[e, f] = \\begin{pmatrix} e \\\\ f \\end{pmatrix}$"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice1_1():\n",
- " A_sol = [[1, 4, 3, 4],[2, 6, 5, 8],[1, 0, 1, 4]]\n",
- " b_sol = [1, 1, 1]\n",
- " if A == [] or b == []:\n",
- " print(\"Au moins une des deux entrée est vide\")\n",
- " elif not (len(A) == len(b)):\n",
- " print(\"Les tailles de la matrice et du vecteur ne correspondent pas\")\n",
- " else:\n",
- " if A == A_sol:\n",
- " if b == b_sol:\n",
- " print(\"Correct !\")\n",
- " else:\n",
- " print(\"Le vecteur b est faux, votre reponse correspond au système suivant:\")\n",
- " al.printSyst(A, b)\n",
- " elif b == b_sol:\n",
- " print(\"La Matrice A est fausse, votre reponse correspond au système suivant:\")\n",
- " al.printSyst(A, b)\n",
- " else:\n",
- " print(\"Faux, votre reponse correspond au système suivant:\")\n",
- " al.printSyst(A, b)"
+ "$[[e], [f]] = \\begin{pmatrix} e \\\\ f \\end{pmatrix}$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# n'oubliez pas d'executer la cellule\n",
- "A = []\n",
- "b = []\n",
+ "A = [[],[],[]]\n",
+ "b = [[],[],[]]\n",
"\n",
- "exercice1_1() # ne pas toucher cette ligne"
+ "Ex1_1Chapitre4_10(A,b) # ne pas toucher cette ligne"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1.2\n",
"Pour calculer le rang colonne de $A$ nous échelonnons sa matrice transposée. Si et seulement si le rang colonne de $A$ est égal au rang colonne de $\\hat{A}$.\n",
"À partir de cette matrice, donnez le rang colonne de $A$ et trouvez une base de l'espace colonne de $A$ ."
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "A_sol = np.array([[1, 4, 3, 4],[2, 6, 5, 8],[1, 0, 1, 4]])\n",
- "A_sol_t = A_sol.transpose()\n",
- "M = al.echelonMat('E', A_sol_t)\n",
- " "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
+ "metadata": {},
"outputs": [],
"source": [
- "def exercice1_2_1():\n",
- " \n",
- " text_rang = widgets.IntText()\n",
- " box = VBox([Label('Rang colonne de A:'), text_rang])\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " with out:\n",
- " if(text_rang.value == 2):\n",
- " print('Correct !')\n",
- " else: \n",
- " print('False, try again or check the solution')\n",
- " \n",
- " button.on_click(callback)\n",
- " display(box)\n",
- " display(button)\n",
- " display(out)\n",
- "\n",
- "exercice1_2_1()"
+ "Ex1_2_ech_Chapitre_4_10()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice1_2_2():\n",
- " \n",
- " base_sol = [[1,2,1],[0,1,2]]\n",
- " \n",
- " if base_sol == []:\n",
- " print(\"L'entrée est vide\")\n",
- " else:\n",
- " if base == base_sol:\n",
- " print(\"Correct !\")\n",
- " else:\n",
- " print(\"Faux\")\n",
- " "
+ "Ex1_2_1Chapitre_4_10()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# [vect1,vect2,...] avec vect = [a, b, c] n'oubliez pas d'executer la cellule\n",
"base = [[1,2,1],[0,1,2]]\n",
- "exercice1_2_2()"
+ "\n",
+ "Ex1_2_2Chapitre_4_10(base)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1.3 \n",
- "Le système possède-t-il une solution ? (utilisez le lemme 5)\n"
+ "Le système possède-t-il une solution ? (utilisez le lemme)\n",
+ "\n",
+ "Maintenant nous allons utiliser le lemme affin de déterminer si le système possède une solution.\n",
+ "\n",
+ "L'énoncé du lemme est équivalent à dire que les dimmensions des espaces des colonnes de $A$ et de $\\hat{A}$.\n",
+ "Comme nous connaissons une base de l'espace des colonnes de $A$, nous pouvons l'utiliser pour trouver le rang colonne de $\\hat{A}$\n",
+ "\n",
+ "Ainsi, au lieu de trouver le rang colonne de \n",
+ "\n",
+ "$ \\hat{A} = \\begin{pmatrix} 1 & 4 & 3 & 4 & 1 \\\\ 2 & 6 & 5 & 8 & 1 \\\\ 1 & 0 & 1 & 4 & 1\\end{pmatrix}$\n",
+ "\n",
+ "nous pouvons chercher le rang colonne de \n",
+ "\n",
+ "$\\begin{pmatrix} 1 & 0 & 1 \\\\ 2 & 1 & 1 \\\\ 1 & 2 & 1\\end{pmatrix}$\n",
+ "\n",
+ "pour ceci il faut donc échelonner ça matrice transposée\n",
+ "\n",
+ "$\\begin{pmatrix} 1 & 2 & 1 \\\\ 0 & 1 & 2 \\\\ 1 & 1 & 1\\end{pmatrix}$\n",
+ "\n"
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
+ "metadata": {},
"outputs": [],
"source": [
- "def exercise_1_3():\n",
- " \n",
- " radio = widgets.RadioButtons(\n",
- " options=['Yes', 'No'],\n",
- " description='Answer:',\n",
- " disabled=False\n",
- " )\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
+ "def Ex1_3_ech_Chapitre_4_10():\n",
+ " global m\n",
+ " A= [[1, 2, 1],[0, 1, 2],[1, 1, 1]]\n",
+ " al.printA(A)\n",
+ " [i,j,r,alpha]= al.manualEch(A)\n",
+ " MatriceList=[np.array(A)]\n",
+ " m2=A\n",
+ " button = widgets.Button(description='Appliquer')\n",
" out = widgets.Output()\n",
"\n",
" def callback(e):\n",
+ " global m2\n",
" out.clear_output()\n",
" with out:\n",
- " if (radio.value == \"Yes\"):\n",
- " print('Mauvaise réponse.')\n",
- " else: \n",
- " print('Correct !')\n",
- " \n",
+ " m2=al.echelonnage(i, j, r, alpha, A, m2, MatriceList)\n",
+ "\n",
" button.on_click(callback)\n",
- " display(radio)\n",
" display(button)\n",
" display(out)\n",
" \n",
- "exercise_1_3()\n",
- "\n",
- "\n",
- "\n"
+ "Ex1_3_ech_Chapitre_4_10()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "Ex1_3Chapitre_4_10()"
]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": []
+ },
+ {
+ "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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 4 - Bases et dimension/Prototype 4.11.ipynb b/Chapitre 4 - Bases et dimension/Prototype 4.11.ipynb
index a5f80ca..f75149c 100644
--- a/Chapitre 4 - Bases et dimension/Prototype 4.11.ipynb
+++ b/Chapitre 4 - Bases et dimension/Prototype 4.11.ipynb
@@ -1,534 +1,296 @@
{
"cells": [
{
"cell_type": "code",
- "execution_count": 1,
- "metadata": {},
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
"outputs": [],
"source": [
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
- "import matplotlib\n",
- "import plotly.express as px\n",
- "import sympy as sp"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(s)\n",
"\n",
"### Définition 1 :\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie $n$, $\\mathscr{B} =\\{v_1,\\ldots,v_n\\}$ une base ordoné de $V$ et $v \\in V$. Comme $\\mathscr{B}$ est une base de $V$, il existe des uniques scalaires $\\alpha_1,\\ldots,\\alpha_n \\in \\mathbb{R}$ tels que $v = \\alpha_1v_1 + \\ldots + \\alpha_nv_n$. On appelle $\\alpha_1,\\ldots,\\alpha_n$ les coordonnées de $v$ par rapport à la base $\\mathscr{B}$ et on écrit\n",
"\n",
"\n",
"$$[v]_{\\mathscr{B}} = \\begin{pmatrix} \\alpha_1 \\\\ \\alpha_2 \\\\ \\vdots \\\\ \\alpha_n \\end{pmatrix}.$$\n",
"\n",
"### Proposition 2 :\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie $n$ et $\\mathscr{B} = (v_1,\\ldots,v_n)$ une base ordonnée de $V$. Alors les deux affirmations suivantes sont vérifiées.\n",
"\n",
"1. Pour tous $v_1,v_2 \\in V$, on a $[v_1 + v_2 ]_{\\mathscr{B}} = [v_1]_{\\mathscr{B}}+[v_2]_{\\mathscr{B}}.$\n",
"\n",
"2. Pour tout $v \\in V$ et tout $\\lambda \\in \\mathbb{R}$, on a $[\\lambda v]_{\\mathscr{B}} = \\lambda[v]_{\\mathscr{B}}$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercice 1:\n",
"\n",
"Soit $\\mathbb{R}^2$ l'espace du plan. La base la plus évidnte de cet espace vectoriel est la base orthonormée $\\mathscr{B} = ((1,0),(0,1))$. Cette base est représentée dans le graphique suivant."
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#ici un graph pas distordu (graph 1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Quelle base de $\\mathbb{R}^2$ est représentée ci-dessous?"
]
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [],
- "source": [
- "def exercice_1(base):\n",
- " base_solution = [[1,2],[3,2]]\n",
- " is_correct = all(item in base_solution for item in base)\n",
- " if is_correct:\n",
- " is_correct = all(item in base for item in base_solution)\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#ici un graph avec grille distordue (graph 2)"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est incorrect.\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les vecteurs qui forment la base réprésentée ci-dessus\n",
"# Par exemple : [[1, 2], [3, 4]]\n",
"base = [[-2,1],[4,1]]\n",
"\n",
- "exercice_1(base)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_2aB1(vB1):\n",
- " v = [5,6]\n",
- " \n",
- " if vB1==v:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)\n",
- "\n",
- "def exercice_2aB2(vB2):\n",
- " v = [2,1]\n",
- " \n",
- " if vB2==v:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)\n",
- "\n",
- "def exercice_2bB1(uB1):\n",
- " u = [8,4]\n",
- " \n",
- " if uB1==u:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)\n",
- "\n",
- "def exercice_2bB2(uB2):\n",
- " u = [-1,3]\n",
- " \n",
- " if uB2==u:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)\n",
- " \n",
- "def exercice_2cB1(wB1):\n",
- " w = [5,4]\n",
- " \n",
- " if wB1==w:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)\n",
- " \n",
- "def exercice_2cB2(wB2):\n",
- " w = [0.5,1.5]\n",
- " \n",
- " if wB2==w:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)"
+ "Ex1Chapitre4_11(base)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercice 2\n",
"\n",
"a) Soit le vecteur $\\textbf{v}$ représenté dans le graph suivant, $\\mathscr{B}_1$ la base orthonormée de $\\mathbb{R}^2$ et $\\mathscr{B}_2 = ((1,2),(3,2))$. Quelles sont les coordonnées de de $\\textbf{v}$ dans $\\mathscr{B}_1$? "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#ici graph avec v desssus (graph 3)"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur v dans la base B1\n",
"# Par exemple : [1,2]\n",
"vB1 = [5,6]\n",
"\n",
- "exercice_2aB1(vB1)"
+ "Ex2a_B1_Chapitre4_11(vB1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Et dans $\\mathscr{B}_2$?"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur v dans la base B2\n",
"# Par exemple : [1,2]\n",
"vB2 = [2,1]\n",
"\n",
- "exercice_2aB2(vB2)"
+ "Ex2a_B2_Chapitre4_11(vB2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"b) Avec les mêmes bases, quelles sont les coordonnées du vecteur $\\textbf{u}$ dans $\\mathscr{B}_1$?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#ici graph avec u desssus (graph 4)"
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur u dans la base B1\n",
"# Par exemple : [1,2]\n",
"uB1 = [8,4]\n",
"\n",
- "exercice_2bB1(uB1)"
+ "Ex2b_B1_Chapitre4_11(uB1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Et dans $\\mathscr{B}_2$?"
]
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur u dans la base B2\n",
"# Par exemple : [1,2]\n",
"uB2 = [-1,3]\n",
"\n",
- "exercice_2bB2(uB2)"
+ "Ex2b_B2_Chapitre4_11(uB2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"c) Toujours avec les mêmes bases, quelles sont les coordonnées du vecteur $\\textbf{w}$ dans $\\mathscr{B}_1$?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#ici graph avec w desssus (graph 5)"
]
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur w dans la base B1\n",
"# Par exemple : [1,2]\n",
"wB1 = [5,4]\n",
"\n",
- "exercice_2cB1(wB1)"
+ "Ex2c_B1_Chapitre4_11(wB1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Et dans $\\mathscr{B}_2$?"
]
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur w dans la base B2\n",
"# Par exemple : [1,2]\n",
"wB2 = [.5,1.5]\n",
"\n",
- "exercice_2cB2(wB2)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 14,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [],
- "source": [
- "def exercice_3_B1(sB1):\n",
- " s = [13,10]\n",
- " \n",
- " if sB1==s:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)\n",
- "\n",
- "def exercice_3_B2(sB2):\n",
- " s = [1,4]\n",
- " \n",
- " if sB2==s:\n",
- " is_correct = 1\n",
- " else:\n",
- " is_correct = 0\n",
- " \n",
- " correct_text = \"C'est correct!\"\n",
- " incorrect_text = \"C'est incorrect.\"\n",
- " \n",
- " display(correct_text if is_correct else incorrect_text)"
+ "Ex2c_B2_Chapitre4_11(wB2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercice 3\n",
"\n",
"Considérons maintenant le vecteur $\\textbf{s}$ tel que $\\textbf{s} = \\textbf{v}+\\textbf{u}$. A l'aide de la proposition 2 et de l'exerciceprécédent, déduire les coordonnées de $\\textbf{s}$ dans $\\mathscr{B}_1$."
]
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur s dans la base B1\n",
"# Par exemple : [1,2]\n",
"sB1 = [13,10]\n",
"\n",
- "exercice_3_B1(sB1)"
+ "Ex3_B1_Chapitre4_11(sB1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Et dans $\\mathscr{B}_2$?"
]
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\"C'est correct!\""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les coordonnées du vecteur s dans la base B2\n",
"# Par exemple : [1,2]\n",
"sB2 = [1,4]\n",
"\n",
- "exercice_3_B2(sB2)"
+ "Ex3_B2_Chapitre4_11(sB2)"
]
}
],
"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.9"
+ "version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 4 - Bases et dimension/Prototype 4.12.ipynb b/Chapitre 4 - Bases et dimension/Prototype 4.12.ipynb
index 60bc4b1..cfeae70 100644
--- a/Chapitre 4 - Bases et dimension/Prototype 4.12.ipynb
+++ b/Chapitre 4 - Bases et dimension/Prototype 4.12.ipynb
@@ -1,435 +1,143 @@
{
"cells": [
{
"cell_type": "code",
- "execution_count": 91,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
- "import matplotlib\n",
- "import plotly.express as px\n",
- "import sympy as sp"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(s)\n",
"\n",
"\n",
"\n",
"### MÉTHODE POUR TROUVER UNE BASE À PARTIR D'UN SYSTÈME DE GÉNÉRATEURS :\n",
"\n",
"Soient $V$ un $\\mathbb{R}$-espace vectoriel de dimension finie $n,$ $\\mathscr{B}=(v_1,\\ldots,v_n)$ une base de $V,$ $S\\subset V$ une partie finie et $W=\\mbox{Vect}(S).$ Pour trouver une base de $W$ et la compléter en une base de $V,$ on procède comme suit.\n",
"\n",
"\n",
"\n",
"1. Pour chaque $v\\in S,$ on écrit $[v]_{\\mathscr{B}} = \\begin{pmatrix} \\alpha_1 \\ \\alpha_2 \\ \\cdots \\ \\alpha_n \\end{pmatrix}^T.$\n",
"\n",
"2. On définit la matrice $A$ dont les lignes sont les vecteurs $[v]_{\\mathscr{B}}^T$ ($v\\in S$).\n",
"\n",
"3. On échelonne la matrice $A$ : les lignes non-nulles ainsi obtenues forment une base de l'espace ligne de cette matrice. De plus, les vecteurs de $W$ correspondants forment une base de $W.$\n",
"\n",
"4. On remplace les lignes nulles de la matrice échelonnée par des lignes non-nulles de manière à ce que celle-ci contienne $n$ pivots. Les vecteurs de $V$ associés aux lignes de cette nouvelle matrice forment une base de $V.$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercice 1\n",
"\n",
"Soit $S = (v_1,v_2,v_3,v_4,v_5) \\in \\mathbb{R}^6$ et $W=Vect(S)$. Selon la méthode vue en cours, quelles sont les dimensions de la matrice $A$?"
]
},
{
"cell_type": "code",
- "execution_count": 92,
+ "execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
- "outputs": [
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "55d262fd0d9b4bb2bd66bff949b93591",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "IntText(value=0, description='Nombre de lignes : \\n')"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "990af7f3e9704c648cb800181c78ec83",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "IntText(value=0, description='Nombre de colonne : \\n')"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "d89fc1bc22ab413b8cfae9f01ce53c62",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Button(description='Vérifier', style=ButtonStyle())"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "c009cef7b6aa448f9d94067df1acb58c",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Output()"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
- "def exercice_1():\n",
- " nbr_ligne = widgets.IntText(\n",
- " description='Nombre de lignes : \\n',\n",
- " disabled=False\n",
- " )\n",
- " nbr_colonne = widgets.IntText(\n",
- " description='Nombre de colonne : \\n',\n",
- " disabled=False\n",
- " )\n",
- " \n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r_l = nbr_ligne.value\n",
- " r_c = nbr_colonne.value\n",
- " with out:\n",
- " if r_l == 5 and r_c == 6:\n",
- " display(Markdown(\"C'est correct!\"))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect.\"))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(nbr_ligne)\n",
- " display(nbr_colonne)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_1()"
+ "Ex1Chapitre4_12()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercice 2\n",
"\n",
"Sachant que $v_2 = 2v_3+3v_5$, combien faut-il rajouter, au minimum, de lignes non-nulles à la matrice $A$, dans sa forme échelonnée, pour que les vecteurs associés aux lignes de celle-ci forment une base de $\\mathbb{R}^6$?"
]
},
{
"cell_type": "code",
- "execution_count": 93,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "4076b26f75744445b3cf5896f179cedf",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "IntText(value=0, description='Réponse :')"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "b58405ced7a145488354c4aaf861e6b8",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Button(description='Vérifier', style=ButtonStyle())"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "a0ba4e3933dc45a58b89e6690f045109",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Output()"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
}
- ],
+ },
+ "outputs": [],
"source": [
- "def exercice_2():\n",
- " text = widgets.IntText(\n",
- " description='Réponse :',\n",
- " disabled=False\n",
- " )\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " \n",
- " with out:\n",
- " if r == 2:\n",
- " display(Markdown(\"C'est correct!\"))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect.\"))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_2()"
+ "Ex2Chapitre4_12()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercice 3\n",
"\n",
"Voici la matrice $A$ échelonnée, nommée $B$:\n",
"\n",
"$$B = \\begin{pmatrix} 1 & 4 & 0 & 2 & 0 & 1 \\\\ 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 1 & 2 & 1 & 0 \\\\ 0 & 0 & 1 & 3 & 3 & 2 \\\\ 0 & 0 & 0 & 0 & 0 & 0\\end{pmatrix}$$\n",
"\n",
"a) Combien de vecteurs doivent être ajoutés aux lignes non-nulles de $B$ pour que celles-co soient une base de $\\mathbb{R}^6$ ?"
]
},
{
"cell_type": "code",
- "execution_count": 94,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
- "outputs": [
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "ae4d71b36c1e47eb856deba820c5246c",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "IntText(value=0, description='Réponse :')"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "c740a93affe6485781db2b9791ff7988",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Button(description='Vérifier', style=ButtonStyle())"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "b421f8f2260e44388ecd9b0e667cbe74",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Output()"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "def exercice_3_a():\n",
- " text = widgets.IntText(\n",
- " description='Réponse :',\n",
- " disabled=False\n",
- " )\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " \n",
- " with out:\n",
- " if r == 3:\n",
- " display(Markdown(\"C'est correct!\"))\n",
- " else:\n",
- " display(Markdown(\"C'est incorrect.\"))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_3_a()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 95,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
- "def exercice_3_b(base):\n",
- " base = base + [[1,4,0,2,0,1],[0,1,1,2,1,0],[0,0,1,3,3,2]]\n",
- " base = np.array(base)\n",
- " out = widgets.Output()\n",
- " display(out)\n",
- "\n",
- " with out:\n",
- " out.clear_output()\n",
- "\n",
- " feedback = \"\"\n",
- " is_correct = False\n",
- " \n",
- " s = base.shape\n",
- " \n",
- "\n",
- " if len(base) == 0:\n",
- " feedback = \"Les vecteurs nuls ne peuvent pas .\"\n",
- " elif len(s) != 2 or s[1] != 6:\n",
- " feedback = \"Le format des vecteurs n'est pas bon.\"\n",
- " elif s[0] < 6:\n",
- " feedback = \"L'ensemble entré ne contient pas assez de vecteurs pour engendrer toutes les solutions du système.\"\n",
- " elif s[0] > 6:\n",
- " feedback = \"L'ensemble entré contient trop de vecteurs pour être une famille libre.\"\n",
- " else:\n",
- " expected = np.array(sp.Matrix([[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,1,0,0,0],[0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0],[0, 0, 0, 0, 0, 1]]).rref()[0])\n",
- " actual = np.array(sp.Matrix(base).rref()[0])\n",
- " \n",
- " if not np.array_equal(actual, expected):\n",
- " feedback = \"L'ensemble entré n'engendre pas l'espace solution du système.\"\n",
- " else:\n",
- " is_correct = True\n",
- " \n",
- " correct_text = \"C'est correct!
\"\n",
- " incorrect_text = \"C'est incorrect.
\"\n",
- " \n",
- " display(Markdown((correct_text if is_correct else incorrect_text) + feedback))"
+ "Ex3aChapitre4_12()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"b) Donner une collection de vecteurs qui complètent les lignes non-nulles de $B$ en une base de $\\mathbb{R}^6$."
]
},
{
"cell_type": "code",
- "execution_count": 96,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "application/vnd.jupyter.widget-view+json": {
- "model_id": "43e5ba33de834853a4c7de5910599ba0",
- "version_major": 2,
- "version_minor": 0
- },
- "text/plain": [
- "Output()"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"# Entrez les vecteurs qui complètent les lignes non-nulles de B en une base de R^6\n",
"# Par exemple : [[1, 2], [3, 4]]\n",
"vecteurs_manquants = [[0,0,0,1,0,0],[0,0,0,0,1,0],[0,0,0,0,0,1]]\n",
"\n",
- "exercice_3_b(vecteurs_manquants)"
+ "Ex3bChapitre4_12(vecteurs_manquants)"
]
- },
- {
- "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.9"
+ "version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 4 - Bases et dimension/Prototype 4.9.ipynb b/Chapitre 4 - Bases et dimension/Prototype 4.9.ipynb
index 22e4385..b239f79 100644
--- a/Chapitre 4 - Bases et dimension/Prototype 4.9.ipynb
+++ b/Chapitre 4 - Bases et dimension/Prototype 4.9.ipynb
@@ -1,314 +1,185 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "%cd ..\n",
- "import Librairie.AL_Fct as al\n",
- "%cd \"Chapitre 4 - Bases et dimension\"\n",
- "\n",
- "import numpy as np\n",
- "from IPython.display import display, Markdown, Latex\n",
- "import plotly.graph_objs as go\n",
- "import plotly\n",
- "import ipywidgets as widgets\n",
- "from ipywidgets import interact, interactive, fixed, interact_manual, Layout, HBox, VBox"
+ "from Fonctions.chapitre4 import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Concept(s)-clé(s)\n",
"\n",
"\n",
"\n",
"### DÉFINITION 1 :\n",
"\n",
"Soit $A\\in M_{m\\times n}(\\mathbb{R})$ une matrice de taille $m\\times n$ à coefficients réels.\n",
"\n",
"\n",
"\n",
"1. Le *rang ligne* de $A$ est la dimension de l'espace ligne de $A.$\n",
"\n",
"2. Le *rang colonne* de $A$ est la dimension de l'espace colonne de $A.$\n",
"\n",
"\n",
"\n",
- "### REMARQUES 2 :\n",
+ "### REMARQUES 1 :\n",
"\n",
"\n",
"\n",
"1. Le rang ligne de $A$ est plus petit ou égal à $n,$ car c'est un sous-espace vectoriel de $\\mathbb{R}^n.$\n",
"\n",
"2. Le rang ligne de $A$ est plus petit ou égal à $m,$ car engendré par $m$ vecteurs.\n",
"\n",
"3. Le rang colonne de $A$ est plus petit ou égal à $m$ et $n,$ par le même raisonnement.\n",
"\n",
"4. Le rang colonne de $A$ est égal au rang ligne de $A^T.$\n",
"\n",
"5. Le rang ligne de $A$ est égal au rang colonne de $A^T.$\n",
"\n",
"\n",
"\n",
- "### PROPOSITION 3 :\n",
+ "### PROPOSITION 1 :\n",
"\n",
"Soient $A,B\\in M_{m\\times n}(\\mathbb{R})$ des matrices ligne équivalentes. Alors l'espace ligne de $A$ est égal à l'espace ligne de $B.$ Par conséquent, le rang ligne de $A$ est égal au rang ligne de $B.$\n",
"\n",
- "### PROPOSITION 4 :\n",
+ "### PROPOSITION 2 :\n",
"\n",
"Soit $A$ une matrice échelonnée. Alors le rang ligne de $A$ est égal au nombre de pivots. Aussi, une base de l'espace ligne de $A$ est donnée par les lignes contenant un pivots."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 1\n",
"\n",
"Soit la matrice A :\n",
"\n",
"$$A = \\begin{pmatrix} 1 & 2 & 3 \\\\ 4 & 5 & 6 \\end{pmatrix}$$\n",
"\n",
"Sélectionnez les propositions correctes\n",
"(maintenez CTRL pour sélectionner plusieurs cellules à la fois)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercise_1():\n",
- " r1 = 'Le rang ligne de 𝐴 est plus petit ou égal à 2, car c\\'est un sous-espace vectoriel de ℝ2.'\n",
- " r2 = 'Le rang ligne de 𝐴 est plus petit ou égal à 3, car c\\'est un sous-espace vectoriel de ℝ3.'\n",
- " r3 = 'Le rang ligne de 𝐴 est plus petit ou égal à 3, car engendré par 3 vecteurs.'\n",
- " r4 = 'Le rang ligne de 𝐴 est plus petit ou égal à 2, car engendré par 2 vecteurs.'\n",
- " r5 = 'Le rang colonne de A est plus petit ou égal à 2.'\n",
- "\n",
- " select = widgets.SelectMultiple(\n",
- " options=[(r1, 1), (r2, 2), (r3, 3), (r4, 4), (r5, 5)],\n",
- " description='Sélection :',\n",
- " disabled=False,\n",
- " layout=Layout(width='auto', height='100px')\n",
- " )\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- "\n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " with out:\n",
- " if (1 in select.value or 3 in select.value):\n",
- " print('Mauvaise réponse. \\nAttention à ne pas confondre les espaces des lignes et colonnes')\n",
- " elif (2 not in select.value or 4 not in select.value or 5 not in select.value):\n",
- " print('Il manque au moins une réponse.')\n",
- " elif (2 in select.value and 4 in select.value and 5 in select.value):\n",
- " print('Correct !')\n",
- " \n",
- " button.on_click(callback)\n",
- "\n",
- " display(select)\n",
- " display(button)\n",
- " display(out)\n",
- " \n",
- "exercise_1()"
+ "Ex1Chapitre4_9()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXERCICE 2\n",
"#### 2.1\n",
"Soit la matrice $A$ :\n",
"\n",
"$$A = \\begin{pmatrix} 1 & 2 & 3 \\\\ 0 & 1 & 2 \\end{pmatrix}$$\n",
"\n",
"Donnez le rang ligne de $A$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercice_2_1():\n",
- " text = widgets.IntText(\n",
- " description='Réponse :',\n",
- " disabled=False\n",
- " )\n",
- " button = widgets.Button(description='Vérifier')\n",
- " out = widgets.Output()\n",
- " \n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " r = text.value\n",
- " \n",
- " with out:\n",
- " if r == 2:\n",
- " display(Markdown(\"Par la proposition 4 c'est correct!\"))\n",
- " elif r > 2:\n",
- " display(Markdown(\"Faux, c'est trop grand\"))\n",
- " else:\n",
- " display(Markdown(\"Faux, c'est trop petit\"))\n",
- " \n",
- " button.on_click(callback)\n",
- " \n",
- " display(text)\n",
- " display(button)\n",
- " display(out)\n",
- "exercice_2_1()"
+ "Ex2_1Chapitre4_9()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2.2\n",
"Parmi les ensembles suivants, séléctionnez l'ensemble générant l'espace ligne de $A$\n",
"\n",
"$E_1 = \\begin{Bmatrix}\\begin{pmatrix} 1 \\\\ 2 \\\\ 3 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 1 \\\\ 2 \\end{pmatrix}\\end{Bmatrix}$ $E_2 = \\begin{Bmatrix}\\begin{pmatrix} 1 \\\\ 2 \\\\ 3 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 1 \\\\ 2 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix}\\end{Bmatrix}$ \n",
"$E_3 = \\begin{Bmatrix}\\begin{pmatrix} 1 \\\\ 0\\end{pmatrix}, \\begin{pmatrix} 2 \\\\ 1 \\end{pmatrix}, \\begin{pmatrix} 3 \\\\ 2 \\end{pmatrix}\\end{Bmatrix}$\n",
"$E_4 = \\begin{Bmatrix}\\begin{pmatrix} 1 \\\\ 0\\end{pmatrix}, \\begin{pmatrix} 2 \\\\ 1 \\end{pmatrix}\\end{Bmatrix}$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
- "def exercise_2_2():\n",
- " select = widgets.SelectMultiple(\n",
- " options=['E1', 'E2', 'E3', 'E4'],\n",
- " description='Sélection :',\n",
- " disabled=False,\n",
- " layout=Layout(width='auto', height='auto')\n",
- " )\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
- "\n",
- " out = widgets.Output()\n",
- "\n",
- " def callback(e):\n",
- " \n",
- " out.clear_output()\n",
- " with out:\n",
- " if len(select.value) <= 0: # Empty\n",
- " pass\n",
- " elif len(select.value) > 1:\n",
- " display(Markdown(\"Un seul de ces ensembles génère exactement l'espace ligne de A\"))\n",
- " elif 'E1' not in select.value:\n",
- " display(Markdown(\"Faux\"))\n",
- " else:\n",
- " display(Markdown(\"Correct !\"))\n",
- " button.on_click(callback)\n",
- " display(select)\n",
- " display(button)\n",
- " display(out)\n",
- " \n",
- "exercise_2_2()"
+ "Ex2_2Chapitre4_9()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 2.3\n",
"Utilizez la remarque 2 ainsi que les propositions 3 et 4 pour trouver le rang colonne de $A$"
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
+ "metadata": {},
"outputs": [],
"source": [
- "\n",
- "\n",
- "def exercise_2_3():\n",
- " text = widgets.IntText(description='Réponse :', disabled=False)\n",
- "\n",
- " button = widgets.Button(description='Vérifier')\n",
- " button2 = widgets.Button(description='Solution', disabled=True)\n",
- " box = HBox(children=[button,button2])\n",
- " out = widgets.Output()\n",
- "\n",
- " def callback(e):\n",
- " out.clear_output()\n",
- " button2.disabled = False\n",
- " with out:\n",
- " if(text.value == 2):\n",
- " print('Correct !')\n",
- " else: \n",
- " print('False, try again or check the solution')\n",
- " \n",
- " def solution(e):\n",
- " out.clear_output()\n",
- " with out:\n",
- " A = np.array([[1, 2, 3], [0, 1, 2]])\n",
- " A_t = A.transpose()\n",
- " display(Markdown('Pour trouver le rang colonne de $A$, nous utilisons la remarque 2 et trouvous le rang ligne de la transposée de $A$.'))\n",
- " display(Markdown('Par les propositions 3 et 4, nous échelonnons la matrice transposée et observont le nombre de lignes qui contiennent des pivots'))\n",
- " M = al.echelonMat('E', A_t)\n",
- " display(Markdown('Ainsi le rang colonne de $A$ est 2'))\n",
- " \n",
- " button.on_click(callback)\n",
- " button2.on_click(solution)\n",
- " \n",
- " display(text)\n",
- " display(box)\n",
- " display(out)\n",
- " \n",
- "exercise_2_3()\n"
+ "Ex2_3Chapitre4_9()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "[Passez au notebook du chapitre 4.10](./Prototype%204.10.ipynb)"
]
}
],
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
diff --git a/Chapitre 5 - Applications lineaires/5.7.ipynb b/Chapitre 5 - Applications lineaires/5.7.ipynb
new file mode 100644
index 0000000..a4c74c1
--- /dev/null
+++ b/Chapitre 5 - Applications lineaires/5.7.ipynb
@@ -0,0 +1,272 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "%cd ..\n",
+ "import Librairie.AL_Fct as al\n",
+ "%cd \"Chapitre 5 - Applications lineaires\"\n",
+ "\n",
+ "import numpy as np\n",
+ "from IPython.display import display, Markdown, Latex\n",
+ "import plotly.graph_objs as go\n",
+ "import plotly\n",
+ "import ipywidgets as widgets\n",
+ "from ipywidgets import interact, interactive, fixed, interact_manual\n",
+ "from ipywidgets import Layout, HBox, VBox, Label\n",
+ "#import matplotlib\n",
+ "#import plotly.express as px"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Concept(s)-clé(s)\n",
+ "\n",
+ "### THÉORÈME DU RANG :\n",
+ "\n",
+ "Soient $𝑉$,$𝑊$\n",
+ "deux ℝ-espaces vectoriels et $𝑇:𝑉 \\rightarrow𝑊$ une application linéaire. Si 𝑉 est de dimension finie, alors $im(𝑇)$ est de dimension finie et $\\mbox{dim} V=\\mbox{dim} (\\mbox{ker} (T)) + \\mbox{dim}( \\mbox{im} (T)).$\n",
+ "\n",
+ "### Conséquences :\n",
+ "1. $dim(Im(T)) = dim(V) - dim(ket(T)) \\rightarrow dim(Im(T)) \\leq dim(V)$\n",
+ "2. Si $T$ est injectie, $ker(T) = {0}$, $ dim(V) = dim(Im(T)) \\leq dim(W)$\n",
+ "3. Si $T$ est surjective, $W = im(T)$, $ dim(V) = dim(W) \\leq dim(V)$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### EXERCICE 1\n",
+ "\n",
+ "Soit l'application $T:\\mathbb{R}_2 \\rightarrow \\mathbb{P}_3(\\mathbb{R}_2)$\n",
+ "\n",
+ "$T(a,b) = a+ax+bx^2-(a+b)x^3$\n",
+ "\n",
+ "**1.1** $T$ peut-elle être surjective ?\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def exercise_1_1():\n",
+ " \n",
+ " radio = widgets.RadioButtons(\n",
+ " options=['Oui', 'Non'],\n",
+ " description='Réponse:',\n",
+ " disabled=False\n",
+ " )\n",
+ "\n",
+ " button = widgets.Button(description='Vérifier')\n",
+ " out = widgets.Output()\n",
+ "\n",
+ " def callback(e):\n",
+ " out.clear_output()\n",
+ " with out:\n",
+ " if (radio.value == \"Oui\"):\n",
+ " display(Markdown('Mauvaise réponse.'))\n",
+ " else: \n",
+ " display(Markdown('Correct !'))\n",
+ " display(Latex(\"L'une des conséquences du théorème du rang est la suivante: si $T:V \\Rightarrow W$ est surjective, cela signifie que $W = im(T)$ et par le théorème du rang $dim(W) \\leq dim(V)$, mais dans notre cas $dim(W) > dim(V)$\"))\n",
+ " \n",
+ " button.on_click(callback)\n",
+ " display(radio)\n",
+ " display(button)\n",
+ " display(out)\n",
+ " \n",
+ "exercise_1_1()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**1.2** $T$ Est elle injective ?\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def exercise_1_2():\n",
+ " \n",
+ " radio = widgets.RadioButtons(\n",
+ " options=['Oui', 'Non'],\n",
+ " description='Réponse:',\n",
+ " disabled=False\n",
+ " )\n",
+ "\n",
+ " button = widgets.Button(description='Vérifier')\n",
+ " solution_btn = widgets.Button(description='Solution', disabled = True)\n",
+ " box = HBox([button, solution_btn])\n",
+ " out = widgets.Output()\n",
+ "\n",
+ " def callback(e):\n",
+ " out.clear_output()\n",
+ " with out:\n",
+ " if (radio.value == \"Non\"):\n",
+ " display(Markdown('Mauvaise réponse.'))\n",
+ " else: \n",
+ " display(Markdown('Correct !'))\n",
+ " solution_btn.disabled = False\n",
+ "\n",
+ " def solution(b):\n",
+ " with out:\n",
+ " display(Markdown(\"En remarque que si $T(a,b) = 0$ alors $a=b=0$, ce qui signifie que $ker(T) = 0 $. Ainsi, T est injective\"))\n",
+ " \n",
+ " button.on_click(callback)\n",
+ " solution_btn.on_click(solution)\n",
+ " display(radio)\n",
+ " display(box)\n",
+ " display(out)\n",
+ " \n",
+ "exercise_1_2()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### EXERCICE 2\n",
+ "\n",
+ "Soit l'application $T:M_{2 \\times 2}(\\mathbb{R})\\rightarrow \\mathbb{R}_3 $\n",
+ "\n",
+ "$T\\begin{pmatrix}\\begin{pmatrix}a & b \\\\ c& d \\end{pmatrix}\\end{pmatrix} = \\begin{pmatrix} a+b \\\\c+d \\\\ c-d \\end{pmatrix}$\n",
+ "\n",
+ "1.1 $T$ peut-elle être injective ?\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def exercise_2_1():\n",
+ " \n",
+ " radio = widgets.RadioButtons(\n",
+ " options=['Oui', 'Non'],\n",
+ " description='Réponse:',\n",
+ " disabled=False\n",
+ " )\n",
+ "\n",
+ " button = widgets.Button(description='Vérifier')\n",
+ " out = widgets.Output()\n",
+ "\n",
+ " def callback(e):\n",
+ " out.clear_output()\n",
+ " with out:\n",
+ " if (radio.value == \"Oui\"):\n",
+ " display(Markdown('Mauvaise réponse.'))\n",
+ " else: \n",
+ " display(Markdown('Correct !'))\n",
+ " display(Markdown(\"L'une des conséquences du théorème du rang est la suivante: si $T:V \\Rightarrow W$ est injective, cela signifie que $ker(T) = 0$ et donc, par le théorème du rang, $dim(V) = dim(im(T)) \\leq dim(W)$, mais dans notre cas $dim(V) > dim(W)$\"))\n",
+ " \n",
+ " button.on_click(callback)\n",
+ " display(radio)\n",
+ " display(button)\n",
+ " display(out)\n",
+ " \n",
+ "exercise_2_1()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "2.2 $T$ est-elle surjective ?\n",
+ "Pour répondre a cette question, trouvez le noyau de T puis utilisez le théorème du rang\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def exercise_2_2():\n",
+ " \n",
+ " radio = widgets.RadioButtons(\n",
+ " options=['Oui', 'Non'],\n",
+ " description='Réponse:',\n",
+ " disabled=False\n",
+ " )\n",
+ "\n",
+ " button = widgets.Button(description='Vérifier')\n",
+ " solution_btn = widgets.Button(description='Solution', disabled = True)\n",
+ " box = HBox([button, solution_btn])\n",
+ " out = widgets.Output()\n",
+ "\n",
+ " def callback(e):\n",
+ " out.clear_output()\n",
+ " with out:\n",
+ " if (radio.value == \"Oui\"):\n",
+ " display(Markdown('Mauvaise réponse.'))\n",
+ " else: \n",
+ " display(Markdown('Correct !'))\n",
+ " solution_btn.disabled = False\n",
+ "\n",
+ " def solution(b):\n",
+ " with out:\n",
+ " display(Markdown(\"Le noyau de $T$ est définit par : $$ ker(T) = \\\\Bigg\\{ \\\\begin{pmatrix}a & b \\\\\\ c& d \\\\end{pmatrix} \\\\Bigg| \\\\begin{pmatrix} a+b \\\\\\ c+d \\\\\\ c-d \\\\end{pmatrix} = \\\\begin{pmatrix} 0 \\\\\\ 0 \\\\\\ 0 \\\\end{pmatrix} \\\\Bigg\\}$$\"))\n",
+ " display(Markdown(\"Il correspond donc au système suivant: $\\\\begin{equation}\\left\\{\\\\begin{aligned} a+b = 0 \\\\\\ c+d = 0 \\\\\\ c-d = 0 \\end{aligned}\\\\right.\\end{equation}$ $\\\\rightarrow$ $\\\\begin{equation}\\left\\{\\\\begin{aligned} a = -b \\\\\\ c = 0 \\\\\\ d = 0 \\end{aligned}\\\\right.\\end{equation}$\")) \n",
+ " display(Markdown(\"Ainsi, $$ ker(T) = \\\\Bigg\\{ \\\\begin{pmatrix}a & -a \\\\\\ 0 & 0 \\\\end{pmatrix} \\\\Bigg| \\\\quad a \\in \\mathbb{R} \\\\Bigg\\}$$\"))\n",
+ " \n",
+ " button.on_click(callback)\n",
+ " solution_btn.on_click(solution)\n",
+ " display(radio)\n",
+ " display(box)\n",
+ " display(out)\n",
+ " \n",
+ "exercise_2_2()"
+ ]
+ }
+ ],
+ "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.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/Chapitre 5 - Applications lineaires/5.8.ipynb b/Chapitre 5 - Applications lineaires/5.8.ipynb
new file mode 100644
index 0000000..3d04ba2
--- /dev/null
+++ b/Chapitre 5 - Applications lineaires/5.8.ipynb
@@ -0,0 +1,179 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from Fonctions.chapitre5 import *\n",
+ "\n",
+ "import sys\n",
+ "sys.path.insert(0, './../')\n",
+ "import Librairie.AL_Fct as al\n",
+ "\n",
+ "import numpy as np\n",
+ "from IPython.display import display, Markdown, Latex\n",
+ "import plotly.graph_objs as go\n",
+ "import plotly\n",
+ "import ipywidgets as widgets\n",
+ "from ipywidgets import interact, interactive, fixed, interact_manual, Layout, HBox, VBox, Label\n",
+ "import matplotlib\n",
+ "import plotly.express as px\n",
+ "import sympy as sp\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Concept(s)-clé(s)\n",
+ "\n",
+ "### COROLLAIRE DU THÉORÈME DU RANG :\n",
+ "\n",
+ "Soient $V,W$ deux $\\\\\\mathbb{R}$-espaces vectoriels de dimension finie et $T:V\\to W$ une application linéaire. Alors les affirmations suivantes sont vérifiées.\n",
+ "\n",
+ "1. Si $T$ est bijective, alors $\\mbox{dim} V= \\mbox{dim} W$.\n",
+ "2. Si $\\mbox{dim} V=\\mbox{dim} W$ et $T$ est injective, alors $T$ est bijective.\n",
+ "3. Si $\\mbox{dim} V=\\mbox{dim} W$ et $T$ est surjective, alors $T$ est bijective."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Exercice 1 \n",
+ "Soit $T:V\\to W$ une application linéaire bijective, que peut-on dire de $V$ et $W$ ?\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def Ex1Chapitre5_1():\n",
+ " radio = widgets.RadioButtons(\n",
+ " options=['dim𝑉dim𝑊'],\n",
+ " description='Réponse:',\n",
+ " disabled=False\n",
+ " )\n",
+ " \n",
+ " button = widgets.Button(description='Vérifier')\n",
+ " out = widgets.Output()\n",
+ "\n",
+ " def callback(e):\n",
+ " out.clear_output()\n",
+ " with out:\n",
+ " if(radio.value == 'dim𝑉=dim𝑊'):\n",
+ " print('Correct !')\n",
+ " else: \n",
+ " print('Faux, veuillez revoir le corollaire du théorème du rang')\n",
+ " \n",
+ "\n",
+ " \n",
+ " button.on_click(callback) \n",
+ " display(radio)\n",
+ " display(button)\n",
+ " display(out)\n",
+ " \n",
+ " \n",
+ "Ex1Chapitre5_1()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Exercice 2\n",
+ "Soit $T: M_{4\\times 4}(\\mathbb{R}) \\to \\mathbb{P}_{3}(\\mathbb{R})$,\n",
+ "\n",
+ "$T\\Big(\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}\\Big) = a+b+c + ax + bx^2 + cx^3 $\n",
+ "\n",
+ "Trouvez le noyeau de T puis déterminez si T est bijective."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "jupyter": {
+ "source_hidden": true
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def Ex1Chapitre5_2():\n",
+ " radio = widgets.RadioButtons(\n",
+ " options=['T est injective mais pas surjective', 'T est surjective mais pas injective', 'T est bijective'],\n",
+ " layout={'width': 'max-content'}, # If the items' names are long\n",
+ " description='Réponse:',\n",
+ " disabled=False\n",
+ " )\n",
+ " \n",
+ "\n",
+ " button = widgets.Button(description='Vérifier')\n",
+ " button2 = widgets.Button(description='Solution', disabled=True)\n",
+ " box = HBox(children=[button,button2])\n",
+ " out = widgets.Output()\n",
+ "\n",
+ " def callback(e):\n",
+ " out.clear_output()\n",
+ " button2.disabled = False\n",
+ " with out:\n",
+ " if(radio.value == 'T est bijective'):\n",
+ " print('Correct !')\n",
+ " else: \n",
+ " print('Faux, essayez encore ou regardez la solution')\n",
+ " \n",
+ " def solution(e):\n",
+ " out.clear_output()\n",
+ " with out:\n",
+ " display(Markdown(\"Le noyau de $T$ est définit par : $$ ker(T) = \\\\Bigg\\{ \\\\begin{pmatrix}a & b \\\\\\ c& d \\\\end{pmatrix} \\\\Bigg|\\\\ a+b+c + (a+d)x + (b+d)x^2 + cx^3 \\ = 0 \\\\Bigg\\}$$\"))\n",
+ " display(Markdown(\"Il correspond au système suivant: $\\\\begin{equation}\\left\\{\\\\begin{aligned} a+b+c = 0 \\\\\\ a+d = 0 \\\\\\ b+d = 0 \\\\\\ c = 0 \\end{aligned}\\\\right.\\end{equation}$ dont la solution est $a=b=c=d=0$\")) \n",
+ " display(Markdown(\"Ainsi, $ ker(T) = 0$ donc T est injective.\"))\n",
+ " display(Markdown(\"T est injective et $dim(M_{4\\\\times 4}(\\mathbb{R})) = dim( \\mathbb{P}_{3}(\\mathbb{R}))$, d'après le corollaire du théorème du rang, T est également bijective\"))\n",
+ " \n",
+ " \n",
+ " button.on_click(callback)\n",
+ " button2.on_click(solution)\n",
+ " \n",
+ " display(radio)\n",
+ " display(box)\n",
+ " display(out)\n",
+ " \n",
+ " \n",
+ "Ex1Chapitre5_2()"
+ ]
+ }
+ ],
+ "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.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}