How do I plot a sampling of gradient vectors for fby using the vectorplot command? I’m confused how to use both these commands.
$\begingroup$
$\endgroup$
Add a comment
|
$\begingroup$
$\endgroup$
2
f[x_, y_] := (4 x^2 + y^2) Exp[-x^2 - y^2]
VectorPlot[Evaluate@Grad[f[x, y], {x, y}], {x, -2, 2}, {y, -2, 2}]
Show[ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}], %]
EDIT
The default presentation of VectorPlot
has evolved on Mathematica Version 12.1 .
Now it gives :
A lot of possibilities of tuning have been added too.
An overview of the state of the art :
f[x_, y_] := (4 x^2 + y^2) Exp[-x^2 - y^2]
VectorPlot[Evaluate@Grad[f[x, y], {x, y}], {x, -2, 2}, {y, -2, 2},
PlotLegends -> Automatic]
Show[ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2},
PlotLegends -> Automatic, ContourLabels -> True], %]
-
$\begingroup$ How would you find the exact critical points? $\endgroup$ – calculusbuff39 Oct 18 '18 at 3:09
-
$\begingroup$ @calculusbuff39 Try
FindRoot
with initial guess read of from the plots. $\endgroup$ – Henrik Schumacher Oct 18 '18 at 6:28