Qurak

Normals to contours

範例 共 4 個步驟,在同一個工作階段中依序執行。每一步都在引擎上實際執行過,下方的輸出就是它產生的結果。

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

沒有輸出——這個步驟是在為下一步做準備。

步驟 2
grad[x_, y_] = Grad[f[x, y], {x, y}]
輸出
{x/2 - 3*y - 4*x*y, -3*x - 2*x^2 + y^3/4}
步驟 3
normal[x_, y_] = Simplify[(grad[x, y]/Sqrt[grad[x, y].grad[x, y]])]
輸出
{(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])}
步驟 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]
輸出
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]

使用到的函式

相關的操作範例

所有操作範例 · 函式參考 · 從 MCP 用戶端使用這個