1
$\begingroup$

I'm trying to place points on these functions

Manipulate[
  Plot[{a^x, b^x}, {x, -10, 10},
    PlotRange -> {{-3, 3}, {-2, 15}}], 
  {a, 3, 10, 1}, 
  {b, 2, 11, 1}, 
  {c, 3, 10, 1}]

and control the number of points along the function with a slider using manipulate. I've managed to write out this function, somehow, but I'm relatively new to Mathematica and don't know where to start.

For example, when the 3rd slider is at 0, there should be 0 points. When its at 1, there should be 1 point in the middle of the graph. This should change to 2 evenly spaced points on each function when the slider is 2, and so on.

$\endgroup$
  • 1
    $\begingroup$ This + Epilog + Point. $\endgroup$ – Kuba Apr 20 '16 at 15:08
3
$\begingroup$

Why not use Mesh to add points on the curve:

Manipulate[
    Plot[{a^x, b^x}, {x, -10, 10}, PlotRange -> {{-3, 3}, {-2, 15}}, 
          Mesh -> 2 p, MeshStyle -> Directive[PointSize[0.02], Red]], {a, 3, 10, 1}, 
          {b, 2, 11, 1}, {{p, 4}, 0, 100, 1}]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Beat me to it! From the OP's description, I would set it to Mesh->2p so that when p=2 there are 2 points on each curve. $\endgroup$ – Jason B. Apr 20 '16 at 15:23
  • $\begingroup$ @JasonB, good point. Thanks $\endgroup$ – RunnyKine Apr 20 '16 at 15:23
  • $\begingroup$ Thanks! This was really helpful. $\endgroup$ – Riley Morgan Apr 20 '16 at 21:16
  • $\begingroup$ @RileyMorgan. You're welcome, glad I could help. $\endgroup$ – RunnyKine Apr 20 '16 at 21:33

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.