diff --git "a/Chapitre 9 - Produits scalaires et espaces euclidens/9.5 Bases othogonales, orthonormales-orthonorm\303\251e.ipynb" "b/Chapitre 9 - Produits scalaires et espaces euclidens/9.5 Bases othogonales, orthonormales-orthonorm\303\251e.ipynb" index 10260de..41810a6 100644 --- "a/Chapitre 9 - Produits scalaires et espaces euclidens/9.5 Bases othogonales, orthonormales-orthonorm\303\251e.ipynb" +++ "b/Chapitre 9 - Produits scalaires et espaces euclidens/9.5 Bases othogonales, orthonormales-orthonorm\303\251e.ipynb" @@ -1,145 +1,418 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# **Concept(s)-clé(s) et théorie**\n", "\n", "## Définition 1 - Famille/Base Orthogonale/Orthonormal\n", "Soient $V$ un $\\mathbb{R}$-espace vectoriel muni d'un produit scalaire $\\langle \\cdot,\\cdot \\rangle$ et $S \\subset V$ un sous-ensemble de $V$. On dit que $S$ est une **famille orthogonale** si $\\langle u,v \\rangle = 0 \\quad \\forall \\ u,v \\in S$ et que $S$ est une **famille orthonormale** (ou **orthonormée**) si de plus $\\langle u,u, \\rangle = 1$ pour tout $u \\in S$. Enfin, si $S$ est une base de $V$, alors on parle de **base orthogonale** our de **base othonormale** (ou **orthonormèe**).\n", "\n", "## Proposition 1 - Représentation d'un vecteur par rapport à une base orthogonale\n", "Soient $V$ un $\\mathbb{R}$-espace vectoriel muni d'un produit scalaire $\\langle \\cdot,\\cdot \\rangle$ et $\\mathcal{B} = (v_1, \\dots, v_n)$ une base orthogonale de $V$. Alors pour tout $v \\in V$ on a\n", "\n", "$$\n", "([v]_{\\mathcal{B}})_i = \\dfrac{\\langle v,v_i \\rangle}{||v_i||^2}\n", "$$\n", "\n", "ceci pour tout $1 \\leq i \\leq n$. En particulier, si $\\mathcal{B}$ est orthonormale, alors on a\n", "\n", "$$\n", "([v]_{\\mathcal{B}})_i = \\langle v,v_i \\rangle\n", "$$\n", "\n", "ceci pour tout $1 \\leq i \\leq n$.\n", "\n", "## Proposition 2 - Produit scalaire et bases orthonormales\n", "Soient $V$ un $\\mathbb{R}$-espace euclidien de dimension $n$ muni d'un produit scalaire $\\langle \\cdot,\\cdot \\rangle_V$ et $\\mathcal{B}$ une base ordonée de $V$. Aussi, designons par $\\cdot : \\mathbb{R}^n \\times \\mathbb{R}^n \\to \\mathbb{R}$ le produit scalaire usuel sur $\\mathbb{R}^n$. Alors\n", "\n", "$$\n", "\\langle x,y \\rangle_V = [x]_{\\mathcal{B}} \\cdot [y]_{\\mathcal{B}} \\quad \\forall \\ x,y \\in V \\qquad \\Longleftrightarrow \\qquad\\mathcal{B} \\ \\ est \\ une \\ base \\ orthonormale\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercises et Exemples" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "import Librairie.AL_Fct as al\n", "import Corrections.corrections as corrections\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercice 1\n", "\n", "Considérez les familles de vecteurs suivantes dans $\\mathbb{R}^n$ ($n \\in \\{2, \\dots, 5 \\}$) et déterminez si elles sont des familles/bases ortogonales/orthonormées, par rapport au produit scalaire donnée.\n", "\n", "1. $\\quad$ $V = \\mathbb{R}^2$; $\\qquad$ $\\langle u,v \\rangle_V = u^Tv$; $\\qquad \\qquad \\qquad \\qquad \\qquad \\qquad \\quad \\ $ $\\mathcal{F} = \\left\\{\\begin{pmatrix} 0\\\\1 \\end{pmatrix}, \\begin{pmatrix} \\frac{\\sqrt{2}}{2} \\\\ \\frac{\\sqrt{2}}{2} \\end{pmatrix}, \\begin{pmatrix} -\\frac{\\sqrt{2}}{2} \\\\ \\frac{\\sqrt{2}}{2} \\end{pmatrix}\\right\\}$\n", "\n", - "2. $\\quad$ $V = \\mathbb{R}^3$; $\\qquad$ $\\langle u,v \\rangle_V = u^TAv \\quad with \\ A=\\begin{bmatrix} 2 & 0 & -1\\\\ 0 & 1 & 0\\\\ -1 & 0 & 1 \\end{bmatrix}$; $\\qquad$ $\\mathcal{F} = \\left\\{\\begin{pmatrix} 0\\\\1\\\\0 \\end{pmatrix}, \\begin{pmatrix} \\frac{\\sqrt{5}}{5} \\\\ 0 \\\\ -\\frac{\\sqrt{5}}{5} \\end{pmatrix}, \\begin{pmatrix} -\\frac{6}{5} \\\\ 0 \\\\ \\frac{9}{5} \\end{pmatrix}\\right\\}$\n", + "2. $\\quad$ $V = \\mathbb{R}^3$; $\\qquad$ $\\langle u,v \\rangle_V = u^TAv \\quad avec \\ \\ A=\\begin{bmatrix} 2 & 0 & -1\\\\ 0 & 1 & 0\\\\ -1 & 0 & 1 \\end{bmatrix}$ $\\qquad$ $\\mathcal{F} = \\left\\{\\begin{pmatrix} 0\\\\1\\\\0 \\end{pmatrix}, \\begin{pmatrix} \\frac{\\sqrt{5}}{5} \\\\ 0 \\\\ -\\frac{\\sqrt{5}}{5} \\end{pmatrix}, \\begin{pmatrix} -\\frac{6}{5} \\\\ 0 \\\\ \\frac{9}{5} \\end{pmatrix}\\right\\}$\n", "\n", - "3. $\\quad$ $V = \\mathbb{R}^4$; $\\qquad$ $\\langle u,v \\rangle_V = u^Tv$; $\\qquad \\qquad \\qquad \\qquad \\qquad \\qquad \\quad \\ $ $\\mathcal{F} = \\left\\{\\begin{pmatrix} 2\\\\0\\\\1\\\\1 \\end{pmatrix}, \\begin{pmatrix} 0\\\\1\\\\-1\\\\1 \\end{pmatrix}, \\begin{pmatrix} 1\\\\0\\\\-1\\\\-1 \\end{pmatrix} \\begin{pmatrix} 0\\\\2\\\\1\\\\-1 \\end{pmatrix}\\right\\}$\n", + "3. $\\quad$ $V = \\mathbb{R}^4$; $\\qquad$ $\\langle u,v \\rangle_V = u^Tv$; $\\qquad \\qquad \\qquad \\qquad \\qquad \\qquad \\quad \\ $ $\\mathcal{F} = \\left\\{\\begin{pmatrix} 2\\\\0\\\\1\\\\1 \\end{pmatrix}, \\begin{pmatrix} 0\\\\1\\\\-1\\\\1 \\end{pmatrix}, \\begin{pmatrix} 1\\\\0\\\\-1\\\\-1 \\end{pmatrix}, \\begin{pmatrix} 0\\\\2\\\\1\\\\-1 \\end{pmatrix}\\right\\}$\n", "\n", "4. $\\quad$ $V = \\mathbb{R}^5$; $\\qquad$ $\\langle u,v \\rangle_V = u^Tv$; $\\qquad \\qquad \\qquad \\qquad \\qquad \\qquad \\quad \\ $ $\\mathcal{F} = \\left\\{\\begin{pmatrix} \\frac{\\sqrt{7}}{7}\\\\0\\\\\\frac{2\\sqrt{7}}{7}\\\\\\frac{\\sqrt{7}}{7}\\\\-\\frac{\\sqrt{7}}{7} \\end{pmatrix}, \\begin{pmatrix} \\frac{\\sqrt{3}}{3} \\\\ -\\frac{\\sqrt{3}}{3} \\\\ 0 \\\\ -\\frac{\\sqrt{3}}{3} \\\\ 0 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ \\frac{\\sqrt{3}}{3} \\\\ 0 \\\\ -\\frac{\\sqrt{3}}{3} \\\\ -\\frac{\\sqrt{3}}{3} \\end{pmatrix} \\right\\}$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "corrections.Ex1Chapitre9_5()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercice 2\n", "\n", "Considérez les familles de fonctions suivantes et déterminez si elles sont des familles/bases ortogonales/orthonormées, par rapport au produit scalaire donnée.\n", "\n", "1. $\\quad$ $V = \\mathbb{P}^3(\\mathbb{R})$; $\\qquad \\qquad \\ \\ \\ $ $\\langle f,g \\rangle_V = \\int_0^1 f(x)g(x) \\ dx$; $\\qquad \\qquad \\qquad \\qquad $ $\\mathcal{F} = \\left\\{1, x, x^2, x^3\\right\\}$\n", "\n", - "2. $\\quad$ $V = \\mathbb{P}^4(\\mathbb{R})$; $\\qquad \\qquad \\ \\ \\ $ $\\langle f,g \\rangle_V = \\int_0^1 f(x)g(x) \\ dx$; $\\qquad \\qquad \\qquad \\qquad $ $\\mathcal{F} = \\left\\{1, \\ x-\\frac{1}{2}, \\ x^2-x-\\frac{1}{6}, \\ x^3 - \\frac{3}{2}x^2 + \\frac{3}{5}x - \\frac{1}{20}\\right\\}$\n", + "2. $\\quad$ $V = \\mathbb{P}^4(\\mathbb{R})$; $\\qquad \\qquad \\ \\ \\ $ $\\langle f,g \\rangle_V = \\int_0^1 f(x)g(x) \\ dx$; $\\qquad \\qquad \\qquad \\qquad $ $\\mathcal{F} = \\left\\{1, \\ x-\\frac{1}{2}, \\ x^2-x+\\frac{1}{6}, \\ x^3 - \\frac{3}{2}x^2 + \\frac{3}{5}x - \\frac{1}{20}\\right\\}$\n", "\n", "3. $\\quad$ $V = \\mathbb{P}^2(\\mathbb{R})$; $\\qquad \\qquad \\ \\ \\ $ $\\langle f,g \\rangle_V = \\int_{-1}^1 (1-x^2)f(x)g(x) \\ dx$; $\\qquad \\qquad \\quad$ $\\mathcal{F} = \\left\\{\\frac{\\sqrt{3}}{2}, \\sqrt{\\frac{15}{2}}x, \\frac{5\\sqrt{7}}{7}x^2 - \\frac{\\sqrt{7}}{14}\\right\\}$\n", "\n", "4. $\\quad$ $V = \\mathcal{C}\\left([-\\pi;\\pi]; \\mathbb{R}\\right)$; $\\qquad$ $\\langle f,g \\rangle_V = \\int_{-\\pi}^{\\pi} f(x)g(x) \\ dx$; $\\qquad \\qquad \\qquad \\quad \\ \\ \\ $ $\\mathcal{F} = \\{\\sin(kx)\\}_{k=1}^{+\\infty} \\cup \\{\\cos(kx)\\}_{k=0}^{+\\infty}$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "corrections.Ex2Chapitre9_5() # TODO: add plots!!" + "corrections.Ex2Chapitre9_5()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercice 3\n", "\n", - "Give some basis and an element and ask to compute the coordinates with respect to such basis. We can stay both in $\\mathbb{R}^n$ and in polynomial spaces; we have to use standard basis, orthonormal basis and orthogonal basis." + "Considerez les $\\mathbb{R}$-espaces vectoriels $D$-dimensionnels suivant $V$, équipés de la base $\\mathcal{B} = \\{b_i\\}_{i=1}^D$ et avec le produit scalaire $\\langle \\cdot, \\cdot \\rangle_V$. Pour l'élément donné $v \\in V$, calculez ses coordonnées par rapport aux éléments de la base $\\mathcal{B}$ i.e. les coefficients réels $\\left\\{([v]_{\\mathcal{B}})_i\\right\\}_{i=1}^D$, telles que $$v = \\sum\\limits_{i=1}^D ([v]_{\\mathcal{B}})_ib_i$$\n", + "\n", + "1. $\\quad$ $V = \\mathbb{R}^3$ $\\qquad$ $\\mathcal{B} =\\left\\{\\begin{pmatrix}2 \\\\ 0 \\\\ 1 \\end{pmatrix}, \\begin{pmatrix} 0 \\\\ 1 \\\\ -1 \\end{pmatrix}, \\begin{pmatrix} 1 \\\\ 1 \\\\ 0 \\end{pmatrix}\\right\\}$ $\\qquad \\qquad \\qquad \\qquad \\quad \\ \\ $ $\\langle u,v \\rangle_V = u^Tv$ $\\qquad \\qquad \\qquad \\qquad \\ \\ \\ $ $v = \\begin{pmatrix} 1 \\\\ 1 \\\\ 1 \\end{pmatrix}$\n", + "\n", + "2. $\\quad$ $V = \\mathbb{R}^4$ $\\qquad$ $\\mathcal{B} = \\left\\{\\begin{pmatrix} 2\\\\0\\\\1\\\\1 \\end{pmatrix}, \\begin{pmatrix} 0\\\\1\\\\-1\\\\1 \\end{pmatrix}, \\begin{pmatrix} 1\\\\0\\\\-1\\\\-1 \\end{pmatrix}, \\begin{pmatrix} 0\\\\2\\\\1\\\\-1 \\end{pmatrix}\\right\\}$ $\\qquad \\qquad \\qquad \\ $ $\\langle u,v \\rangle_V = u^Tv$ $\\qquad \\qquad \\qquad \\qquad \\ \\ \\ $ $v = \\begin{pmatrix} -1 \\\\ 0 \\\\ 2 \\\\ -2 \\end{pmatrix}$\n", + "\n", + "3. $\\quad$ $V = \\mathbb{P}^3(\\mathbb{R})$ $\\ \\ \\ $ $\\mathcal{B} = \\left\\{1, \\ x-\\frac{1}{2}, \\ x^2-x+\\frac{1}{6}, \\ x^3 - \\frac{3}{2}x^2 + \\frac{3}{5}x - \\frac{1}{20}\\right\\}$ $\\ \\ $ $\\langle f,g \\rangle_V = \\int_0^1 f(x)g(x) \\ dx$; $\\qquad \\qquad$ $v(x) = x^3 - x^2 + x - 1$\n", + "\n", + "4. $\\quad$ $V = \\mathbb{P}^2(\\mathbb{R})$ $\\ \\ \\ $ $\\mathcal{B} = \\left\\{\\frac{\\sqrt{3}}{2}, \\sqrt{\\frac{15}{2}}x, \\frac{5\\sqrt{7}}{7}x^2 - \\frac{\\sqrt{7}}{14}\\right\\}$ $\\qquad \\qquad \\qquad \\quad $ $\\langle f,g \\rangle_V = \\int_{-1}^1 (1-x^2)f(x)g(x) \\ dx$; $\\quad$ $v(x) = x^2+x+1$\n", + "\n", + "**EXTRA**: Dans quel cas, sur les deux derniers, la norme de $v$ peut être rapidement calculée et comment?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Exercise 4\n", + "## HINT\n", + "Dans le cas général (en supposant que $\\mathcal{B}$ est une base de $V$!), les coefficients d'expansion peuvent être calculés en résolvant le système linéaire $D$-dimensionnel suivant\n", + "\n", + "$$\n", + "\\begin{pmatrix}\n", + "\\langle b_1, b_1 \\rangle & \\langle b_1, b_2 \\rangle & \\dots & \\langle b_1, b_D \\rangle \\\\\n", + "\\langle b_2, b_1 \\rangle & \\langle b_2, b_2 \\rangle & \\dots & \\langle b_2, b_D \\rangle \\\\\n", + "\\vdots & \\ddots & \\ddots & \\vdots \\\\\n", + "\\langle b_D, b_1 \\rangle & \\langle b_D, b_2 \\rangle & \\dots & \\langle b_D, b_D \\rangle \\\\\n", + "\\end{pmatrix}\n", + "\\begin{pmatrix}\n", + "([v]_{\\mathcal{B}})_1\\\\\n", + "([v]_{\\mathcal{B}})_2\\\\\n", + "\\vdots \\\\\n", + "([v]_{\\mathcal{B}})_D\n", + "\\end{pmatrix} \n", + "=\n", + "\\begin{pmatrix}\n", + "\\langle v, b_1 \\rangle \\\\\n", + "\\langle v, b_2 \\rangle \\\\\n", + "\\vdots \\\\\n", + "\\langle v, b_D \\rangle \\\\\n", + "\\end{pmatrix}\n", + "$$\n", "\n", - "With the same data of Ex 3, add an extra element and ask to compute $||u||$, $||v||$ et $\\langle u,v \\rangle$ both in $V$ and in $\\mathbb{R}^n$." + "Mais les choses peuvent être beaucoup plus faciles si $\\mathcal{B}$ est une base orthogonale ou orthonormée de $V$ (voir la proposition 1)!" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "C'est faux! N'oubliez pas d'insérer tous les résultats avec 4 chiffres après la virgule" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3dc7b694007d4a67a3aa63ffec0f23c4", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Button(description='Solution', style=ButtonStyle()),))" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "9546a20e9ebe48beba4835ef7e518217", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# CAS 1\n", + "v_B = [0,0,0] # INSÉREZ ICI VOTRE RÉSULTAT. UTILISEZ 4 CHIFFRES APRÈS LA VIRGULE!\n", + "corrections.Ex3Chapitre9_5(v_B, case_nb=1)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "C'est faux! N'oubliez pas d'insérer tous les résultats avec 4 chiffres après la virgule" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e7452e24911740169654adabc749afc0", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Button(description='Solution', style=ButtonStyle()),))" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "47eea8ebf4e046f5945bb3f60f477e76", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# CAS 2\n", + "v_B = [0,0,0,0] # INSÉREZ ICI VOTRE RÉSULTAT. UTILISEZ 4 CHIFFRES APRÈS LA VIRGULE!\n", + "corrections.Ex3Chapitre9_5(v_B, case_nb=2)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "C'est faux! N'oubliez pas d'insérer tous les résultats avec 4 chiffres après la virgule" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "931c62641d6446708522b6e6a63d1fe7", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Button(description='Solution', style=ButtonStyle()),))" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "eebb9a6564fc40e18e035bc5a63ed75b", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# CAS 3\n", + "v_B = [0,0,0,0] # INSÉREZ ICI VOTRE RÉSULTAT. UTILISEZ 4 CHIFFRES APRÈS LA VIRGULE!\n", + "corrections.Ex3Chapitre9_5(v_B, case_nb=3)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "C'est faux! N'oubliez pas d'insérer tous les résultats avec 4 chiffres après la virgule" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "57dd48a3f695451db098ef40d83370b2", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Button(description='Solution', style=ButtonStyle()),))" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "f0447eb161334ef9ae295ec49a37bf41", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# CAS 4\n", + "v_B = [0,0,0] # INSÉREZ ICI VOTRE RÉSULTAT. UTILISEZ 4 CHIFFRES APRÈS LA VIRGULE!\n", + "corrections.Ex3Chapitre9_5(v_B, case_nb=4)" ] + }, + { + "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 }