3
$\begingroup$

For the parabola y = a x^2+ b x + c I want to see the locus of the vertex as b varies (with a and c to be parameters). What are the ways to plot the locus of the parabola dynamically in Mathematica?

I am very new to Mathematica, so I could figure out only basic Manipulate:

Manipulate[
  Plot[a x^2 + b x + c, {x, -10, 10}, PlotRange -> 40, AspectRatio -> 1], 
   {a, -20, 20}, {b, -20, 20}, {c, -10, 10}
 ]

I would like to see the locus parabola appearing in the same manner as in the post, if possible.

Thanks.

$\endgroup$
2
  • $\begingroup$ Can you give more details about exactly what you want? As it is, this is likely to be closed as being unclear what you're asking. $\endgroup$
    – march
    Mar 25, 2016 at 17:43
  • 1
    $\begingroup$ I want something like this. A animation where the locus of the vertex of the parabola is plotted as i manipulate a,b,c. $\endgroup$ Mar 26, 2016 at 1:59

1 Answer 1

3
$\begingroup$
Manipulate[
 plot1 = Plot[a x^2 + b x + c, {x, -10, 10}, PlotRange -> 40, 
   AspectRatio -> 1, ImageSize -> Small];
 plot3 = If[a == 0, Graphics[], 
   ParametricPlot[{-u / (2 a), a (-u / (2 a))^2 + u (-u / (2 a)) + c}, {u, -b, b}, 
    PlotStyle -> {Red, Thick}]];

 Show[plot1, plot3],

 {{a, -2}, -20, 20}, {b, -20, 20}, {c, -10, 10}, 
 TrackedSymbols :> True]

enter image description here

Edit Another method to visualize locus:

Manipulate[
  f[x_, i_] := a x^2 + (b + i) x + c;
  tmp = Table[f[x, i], {i, -20, 20, 5}];

  plot1 = Plot[tmp, {x, -10, 10}, PlotRange -> 40, AspectRatio -> 1];
  plot2 = Plot[Tooltip[-a x^2 + c, "Locus"], {x, -10, 10}, PlotStyle -> {Black, Thick}];

  Show[plot1, plot2],

{a, -20, 20}, {b, -20, 20}, {c, -10, 10}, TrackedSymbols :> True]

enter image description here

Edit2 Note on connection between first and second parts. Notice in 'plot3' we have used parametric form.

Solve[{x == -b / (2 a), y == a x^2 + b x + c}, {x, y}] // FullSimplify

$y=c-\frac{b^2}{4 a}$ and $x^2=\frac{b^2}{4 a^2}$.

So, we may come back from parametric to cartesian equation $y= - a x^2 + c$

(this equation is used in plot2).

$\endgroup$
4
  • $\begingroup$ Thank you. And how to find the equation of that locus? $\endgroup$ Mar 26, 2016 at 15:52
  • $\begingroup$ @LokeshJaddu, in the second visualisation it is -a x^2 + c. In practice it is more complicated, but in Manipulate your a and c change sign from - to +, so we may use this very simple representation. $\endgroup$
    – garej
    Mar 26, 2016 at 16:03
  • $\begingroup$ I understood that its -a x^2 + c . But isn't there a way to let mathematica figure that equation out for me? $\endgroup$ Mar 26, 2016 at 16:08
  • $\begingroup$ You can use GroebnerBasis[] for eliminating parameters. $\endgroup$ Mar 27, 2016 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.