Géométrie 3D — Vecteurs
Produit scalaire, norme, produit vectoriel
Enonce
Implémenter quatre fonctions sur des tuples 3D :
- produit_scalaire(u, v) → flottant
- norme(u) → flottant
- normaliser(u) → tuple unitaire (lever ValueError si vecteur nul)
- produit_vectoriel(u, v) → tuple
⚠ Sans numpy. Tuples Python uniquement.
Signature attendue
def produit_scalaire(u: tuple, v: tuple) -> float:
Exemples
produit_scalaire((1.0, 0.0, 0.0), (0.0, 1.0, 0.0))→0.0 (orthogonaux)produit_scalaire((1.0, 0.0, 0.0), (1.0, 0.0, 0.0))→1.0norme((3.0, 4.0, 0.0))→5.0
📖 Rappel de cours
Pour deux vecteurs $\mathbf{u}=(u_1,u_2,u_3)$ et $\mathbf{v}=(v_1,v_2,v_3)$ de $\mathbb{R}^3$ :
Produit scalaire :
$\mathbf{u}\cdot\mathbf{v} = u_1 v_1 + u_2 v_2 + u_3 v_3 = \|\mathbf{u}\|\,\|\mathbf{v}\|\cos\theta$
Norme euclidienne :
$\|\mathbf{u}\| = \sqrt{u_1^2 + u_2^2 + u_3^2}$
Produit vectoriel :
$\mathbf{u}\wedge\mathbf{v} = (u_2 v_3 - u_3 v_2,\; u_3 v_1 - u_1 v_3,\; u_1 v_2 - u_2 v_1)$
$\mathbf{u}\wedge\mathbf{v}$ est orthogonal à $\mathbf{u}$ et $\mathbf{v}$, de norme $\|\mathbf{u}\|\|\mathbf{v}\|\sin\theta$.
← Exercices d'analyse numérique en Python — dichotomie, Newton, intégration
Exercices du meme theme
- Méthode de Jacobi
- Méthode de Romberg
- Interpolation Bilinéaire
- Marche Aléatoire 2D
- Algorithme de Metropolis
- Intersection Rayon-Sphère
La correction commentee, les indices progressifs, l'execution du code dans le navigateur et la verification par l'IA sont reserves aux abonnes.