Here is what I have thus far:
SetOptions[VectorPlot,
VectorScale -> {0.045, .9, None},
Axes -> True,
AxesLabel -> {x, y},
VectorPoints -> 16,
VectorStyle -> {GrayLevel[0.8]}];
SetOptions[ContourPlot,
ContourStyle -> {Orange, Green}];
SetOptions[ParametricPlot,
PlotStyle -> Blue];
I made the above an initialization cell. Next, I have this:
Manipulate[
Module[{f, g, tmin, tmax, xmin, xmax, ymin, ymax},
tmin = -2; tmax = 2;
xmin = -2; xmax = 4;
ymin = -4; ymax = 2;
f[x_, y_] = 2 x - y + 3 (x^2 - y^2) + 2 x y;
g[x_, y_] = x - 3 y - 3 (x^2 - y^2) + 3 x y;
ptRules = NSolve[{f[x, y] == 0, g[x, y] == 0}, {x, y}];
z = NDSolveValue[{{x'[t], y'[t]} == {f[x[t], y[t]],
g[x[t], y[t]]}, {x[0], y[0]} == #}, {x[t], y[t]}, {t, tmin,
tmax}] & /@ u;
Show[
VectorPlot[{f[x, y], g[x, y]}, {x, xmin, xmax}, {y, ymin, ymax}],
ContourPlot[{f[x, y] == 0, g[x, y] == 0}, {x, xmin, xmax}, {y,
ymin, ymax}],
Graphics[{Red, PointSize[Large], Point[{x, y}] /. ptRules}],
ParametricPlot[z, {t, tmin, tmax}]]],
{{u, {}}, Locator, Appearance -> None, LocatorAutoCreate -> All},
{z, {}, None}, Paneled -> False]
Running the manipulate gives this image.
Now use your mouse to click anywhere in the phase plane vector field and a solution trajectory will be drawn.
Now my question. Each time I click in the vector field, it shrinks, then expands, then draws. Can anything be done to stop this motion (shrink, expand on each click)?
Second question: The cell indicators on the right margin are blinking. What's up with that?
Comments
Post a Comment