Qurak

Normals to contours

Exemple 4 étapes, exécutées dans l'ordre dans une même session. Chaque étape a été exécutée sur le moteur et la sortie ci-dessous est ce qu'elle a produit.

Étape 1
f[x_, y_] := (x ^ 2/4) - 2x ^ 2 y - 3x y + y ^ 4 / 16

Pas de sortie - cette étape prépare quelque chose pour la suivante.

Étape 2
grad[x_, y_] = Grad[f[x, y], {x, y}]
Sortie
{x/2 - 3*y - 4*x*y, -3*x - 2*x^2 + y^3/4}
Étape 3
normal[x_, y_] = Simplify[(grad[x, y]/Sqrt[grad[x, y].grad[x, y]])]
Sortie
{(x - 6*y - 8*x*y)/(2*Sqrt[(37*x^2)/4 + 12*x^3 + 4*x^4 - 3*x*y - 4*x^2*y + 9*y^2 + 24*x*y^2 + 16*x^2*y^2 - (3*x*y^3)/2 - x^2*y^3 + y^6/16]), (-12*x - 8*x^2 + y^3)/(4*Sqrt[(37*x^2)/4 + 12*x^3 + 4*x^4 - 3*x*y - 4*x^2*y + 9*y^2 + 24*x*y^2 + 16*x^2*y^2 - (3*x*y^3)/2 - x^2*y^3 + y^6/16])}
Étape 4
Manipulate[ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Epilog -> Arrow[{pt, pt + normal@@pt}], PerformanceGoal -> "Quality", Contours -> 20, PlotRange -> {{-2, 2}, {-2, 2}, {-30, 30}}], {{pt, {.01, -.1}}, Locator}, FrameLabel -> "Click a point to see its normal", SaveDefinitions -> True]
Sortie
Manipulate[ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}, Epilog -> Arrow[{pt, pt + normal @@ pt}], PerformanceGoal -> Quality, Contours -> 20, PlotRange -> {{-2, 2}, {-2, 2}, {-30, 30}}], {{pt, {0.01, -0.1}}, Locator}, FrameLabel -> Click a point to see its normal, SaveDefinitions -> True]

Fonctions utilisées

Recettes connexes

Toutes les recettes · Référence des fonctions · Utiliser ceci depuis un client MCP