---
title: VISI601_CMI (2a) Calcul scientifique I
type: slide
slideOptions:
transition: slide
progress: true
slideNumber: true
---
# Calcul scientifique I
> [name=Jacques-Olivier Lachaud][time=Decembre 2021][color=#907bf7]
> (Les images peuvent être soumises à des droits d'auteur. Elles sont utilisées ici exclusivement dans un but pédagogique)
###### tags: `visi601`
Retour à [VISI601_CMI (Main) Algorithmique numérique](https://codimd.math.cnrs.fr/s/IWTaBkA9m)
---
## Calcul scientifique
:::info
Etude des problèmes modélisés sous forme d'équations ou de minimisation de fonctionnelle, et algorithmes de résolution numérique
:::
- pas de méthode universelle
- collection d'outils et de résultats
- domaine large : études très théoriques d'existence et de stabilité à des problèmes très informatiques d'implémentation sur GPU
---
## Problèmes étudiés
Pour des données $\mathbf{d} \in D$, une relation $F$ et des variables $\mathbf{x} \in X$, on étudie
$$
F(\mathbf{x},\mathbf{d})=0 \quad \text{ou} \quad F(\mathbf{x},\mathbf{d})=\mathbf{0}
$$
:::info
Le problème est **bien posé** si la solution $\mathbf{x}$ *existe*, est *unique* et dépend *continûment* des données $\mathbf{d}$. On dit aussi *bien posé au sens de Hadamard*, ou *stable*.
Dans ce cas $\forall \delta\mathbf{d} \text{ petit}, \exists \delta\mathbf{x}, F(\mathbf{x}+\delta\mathbf{x},\mathbf{d}+\delta\mathbf{d})=0$ avec $\| \delta\mathbf{x} \| \le K \| \delta\mathbf{d} \|$.
:::
:::warning
Soit $\mathbf{d}=d$, $D=\mathbb{R}$, déterminer le nombre de solutions réelles de $F(x,d)=x^2+dx+1=0$ n'est pas bien posé autour de $d=2$ ou $d=-2$.
Le problème est bien posé sur $D=\rbrack -\infty, -2\lbrack \cup \rbrack -2, 2 \lbrack \cup \rbrack 2,+\infty \lbrack$
:::
---
## Conditionnement
:::info
Souvent des problèmes bien posés théoriquement, sont mal posés numériquement => on veut **quantifier** la stabilité.
:::
==conditionnement relatif== $K_{rel}(d)$ et ==conditionnement absolu== $K_{abs}(d)$ (si $d=0$ ou $x=0$)
$$
\begin{align} K_{rel}(d) = &\lim_{B \rightarrow 0} \sup_{\|\delta d\| \le B } \left\{ \frac{\|\delta x\| / \|x\|}{\|\delta d\| / \|d\|}, \delta d \neq 0, d + \delta d \in D \right\} \\ K_{abs}(d) = &\lim_{B \rightarrow 0} \sup_{\|\delta d\| \le B } \left\{ \frac{\|\delta x\| }{\|\delta d\|}, \delta d \neq 0, d + \delta d \in D \right\}. \end{align}
$$
:::danger
Mauvais conditionnement => gros impact sur la qualité numérique de la solution
:::
---
## Résolvante et conditionnement (formule + facile)
Si problème bien posé, il existe une fonction $G$, appelée ==résolvante== t.q.
$$
F(G(\mathbf{d}),\mathbf{d})=0 \quad \text{autrement dit} \quad \mathbf{x}=G(\mathbf{d})
$$
:::success
Si $G$ est différentiable autour de $\mathbf{d}$, alors
$K_{rel}(\mathbf{d}) \approx \| G'(\mathbf{d}) \| \frac{\|\mathbf{d}\|}{\|G(\mathbf{d})\|}, \quad K_{abs}(\mathbf{d}) \approx \| G'(\mathbf{d}) \|$
et $G'(\mathbf{d})$ est la matrice Jacobienne de $G$ en $\mathbf{d}$, i.e. la matrice t.q.
$G(\mathbf{d}+\delta \mathbf{d}) - G(\mathbf{d}) = G'(\mathbf{d}) \delta \mathbf{d} + o( \| \delta \mathbf{d} \| )$
:::
car $K_{rel}(d) = \lim \sup \left\{ \frac{\|\delta \mathbf{x}\| / \|\mathbf{x}\|}{\|\delta \mathbf{d}\| / \|\mathbf{d}\|} \right\} = \frac{\| G'(\mathbf{d}) \delta \mathbf{d} + o( \| \delta \mathbf{d} \|) \|}{\|\mathbf{x}\|}\| \mathbf{d}\|$
---
## Exercice
:::warning
Soit $\mathbf{d}=d$, $D=\mathbb{R}$, on cherche le conditionnement du problème:
déterminer la plus petite solution réelle de $F(x,d)=x^2+dx+1=0$,
sur le domaine $D=\rbrack -\infty, -2\lbrack \cup \rbrack 2,+\infty \lbrack$
Ecrivez la résolvante $G(d)$, sa dérivée $G'(d)$
:::
---
## (Rappel) Matrice Jacobienne
Si $F$ fonction d'un ouvert de $\mathbb{R}^n$ vers $\mathbb{R}^m$, $F: {\begin{bmatrix}x_{1}\\\vdots \\x_{n}\end{bmatrix}}\longmapsto {\begin{bmatrix}f_{1}(x_{1},\dots ,x_{n})\\\vdots \\f_{m}(x_{1},\dots ,x_{n})\end{bmatrix}}.$
alors sa matrice Jacobienne au point $\mathbf{x}\in \mathbb{R^n}$, notée $F'(\mathbf{x})$ ou $J_{F}(\mathbf{x})$, est
$$
F'(\mathbf{x})=J_{F}(\mathbf{x})={\begin{bmatrix}{\dfrac {\partial f_{1}}{\partial x_{1}}}(\mathbf{x})&\cdots &{\dfrac {\partial f_{1}}{\partial x_{n}}}(\mathbf{x})\\\vdots &\ddots &\vdots \\{\dfrac {\partial f_{m}}{\partial x_{1}}}(\mathbf{x})&\cdots &{\dfrac {\partial f_{m}}{\partial x_{n}}}(\mathbf{x})\end{bmatrix}}, \quad \text{matrice $m \times n $}
$$
*Exemple*: $F(x,y)=3x^2+xy+y^3$, $F'(x,y)=\begin{bmatrix}6x+y & x+3y^2 \end{bmatrix}$
---
## Exercices
(Rappel) $K_{rel}(\mathbf{d}) \approx \| G'(\mathbf{d}) \| \frac{\|\mathbf{d}\|}{\|G(\mathbf{d})\|}, \quad K_{abs}(\mathbf{d}) \approx \| G'(\mathbf{d}) \|$
1. matrice Jacobienne de $F_1:(x,y) \mapsto \begin{bmatrix}1 & 4\\3 & -1 \end{bmatrix} \begin{bmatrix}x \\ y \end{bmatrix} = \begin{bmatrix}x+4y \\ 3x-y \end{bmatrix}$ ?
2. matrice Jacobienne de $F_2:\mathbf{x} \mapsto \mathbf{Ax}$, avec $\mathbf{A}$ matrice constante ?
3. matrice Jacobienne de $F_3:\mathbf{x} \mapsto \mathbf{u}^T \mathbf{x}$, avec $\mathbf{u}$ vecteur constant ?
4. matrice Jacobienne de $M:\mathbf{x} \mapsto \mathbf{x}^T\mathbf{Ax}$, avec $\mathbf{A}$ matrice constante ?
5. conditionnement relatif de $x=e^d$, $x=d^k$, $x=\sin(d)$ ?
6. conditionnement relatif de $F_3:\mathbf{d} \mapsto \mathbf{u}^T \mathbf{d}$ ?
7. conditionnement relatif de $F_4:\mathbf{d} \mapsto \mathbf{A}^{-1}\mathbf{d}$ ?
---
## Note: lien Jacobien et gradient
Si $F$ fonction d'un ouvert de $\mathbb{R}^n$ vers $\mathbb{R}$, $F: {\begin{bmatrix}x_{1}\\\vdots \\x_{n}\end{bmatrix}}\longmapsto f(x_{1},\dots ,x_{n})$
alors gradient $\nabla F$ et Jacobien $J_F$ au point $\mathbf{x}$ sont respectivement:
$$ \nabla F(\mathbf{x}) = \begin{bmatrix} \dfrac{\partial f}{\partial x_{1}}(\mathbf{x}) \\ \vdots \\ \dfrac{\partial f}{\partial x_{n}}(\mathbf{x}) \end{bmatrix} \qquad J_{F}(\mathbf{x})=\begin{bmatrix} \dfrac{\partial f}{\partial x_{1}}(\mathbf{x}) & \cdots & \dfrac{\partial f}{\partial x_{n}}(\mathbf{x}) \end{bmatrix}$$
i.e. $\nabla F = (J_{F})^T$