3
$\begingroup$

I am having trouble adding a point to mark the Min values of each parabola when using the Manipulate command?

Manipulate[
 Plot[x^2 - 2*(a - 2)*x + a - 2, {a, -20, 20}, 
  PlotRange -> {-200, 200}], {a, -10, 10}]

This gives me the parabolas but how do I get a vertex point visible as it moves with parameter a.

$\endgroup$
4
$\begingroup$

You can use the options MeshFunctions, Mesh and MeshStyle as follows:

Manipulate[Plot[x^2 - 2*(a - 2)*x + a - 2, {x, -20, 20}, 
  ClippingStyle -> False,
  MeshFunctions -> {# &}, 
  Mesh -> {{a - 2}}, 
  MeshStyle -> Directive[PointSize[Large], Red], 
  PlotRange -> {-200, 200}], {a, -10, 10}]

enter image description here

Alternatively, you can use Epilog

Manipulate[Plot[x^2 - 2*(a - 2)*x + a - 2, {x, -20, 20}, 
  Epilog -> {PointSize[Large], Red, Point[{a - 2, -6 + 5 a - a^2}]}, 
  PlotRange -> {-200, 200}], {a, -10, 10}]

enter image description here

where I have used the results from:

Minimize[x^2 - 2*(a - 2)*x + a - 2, x]
 {-6 + 5 a - a^2, {x -> -2 + a}}
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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