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..f293f73 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,319 @@
{
"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 ipywidgets import interact, interactive, fixed, interact_manual, Layout\n",
+ "import plotly.express as px"
]
},
{
"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",
+ " w = s * v\n",
" \n",
- " #plotly.offline.init_notebook_mode(connected=True)\n",
+ " cumsum = np.cumsum(np.insert(w, 0, 0, axis=1), axis=1).transpose()\n",
" \n",
- " w = s * v\n",
+ " colors = px.colors.qualitative.Plotly\n",
+ " global color_index\n",
+ " color_index = 0\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",
+ " 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 = 1.5 * n\n",
+ " c_end = end - 0.37 * n\n",
+ " cone = go.Cone(x=[c_end[0]], y=[c_end[1]], z=[c_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()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"solution = [1, 0, 2] # Réponse à compléter\n",
"\n",
"verification_1()"
]
},
{
"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)"
]
},
{
"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)"
]
},
{
"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)"
]
},
{
"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)"
+ "exercice_3(False)"
]
}
],
"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"
}
},
"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..35e083d 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,342 @@
{
"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"
]
},
{
"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",
+ " c_end = end - 0.37 * n\n",
+ " cone = go.Cone(x=[c_end[0]], y=[c_end[1]], z=[c_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",
"\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",
"\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()"
]
},
{
"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",
"\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",
"\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.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}