# Using the Plot function with the Manipulate function

Can anyone explain why the below code does not produce a plot?

Clear["Global*"]
f[x_, a_] = a - x^2;
Solve[f[x, a] == x, x]

Manipulate[ Plot[{f[x, a], x}, {a, -2, 2}], {a, 1, 20, Appearance -> "Labeled"}]


• Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Commented Feb 24, 2016 at 0:41
• Partly because using Solve doesn't set the value of x, so you are trying to plot something that has the parameter x in it with no value plugged in for x. You also have some scoping problems, I think, where the a's aren't actually the same. It's actually pretty unclear what you're actually trying to do here. Can you add some explanations to your post? Commented Feb 24, 2016 at 0:43
• You should plot for x, not for a. Change to : Manipulate[ Plot[{f[x, a], x}, {x, -2, 2}], {a, 1, 20, Appearance -> "Labeled"}] Commented Feb 24, 2016 at 10:28

f[x_, a_] = a - x^2;
Manipulate[
Plot[{f[x, a], x},
{x, -5, 5},
PlotRange -> {{-5, 5}, {-5, 5}},
Epilog -> {Red, PointSize[0.02], Point[{x, f[x, a]} /. # & /@ Solve[f[x, a] == x, x]]}
],
{a, 1, 20, Appearance -> "Labeled"}]


• OP here. I had to log into the correct account. Sorry for the confusion in my post. I'm not familiar with how the end of the Epilog line works. That is, what does  /. # & /@  do? I am inferring that this places a red point where I have a fixed point, but i'm still curious. And thank you for the help! Commented Feb 24, 2016 at 0:56
• /. is shorthand Infix notation for ReplaceAll. /@ is Infix notation for Map. # is Slot[1] which is used for defining a pure function with & is the short-hand for Function. You can look up all of these in the documentation. Commented Feb 24, 2016 at 0:58
• Okay. Thank you for the information. Since I am not in the original account I posted in (my mistake), I supposed i'll just say: POST RESOLVED ?Maybe I can ask a moderator to accept this post? Commented Feb 24, 2016 at 1:01
• @Ozera. You should be able to merge accounts, perhaps by contacting a moderator. Commented Feb 24, 2016 at 3:03
• @Ozera, please see this for help with merging your accounts. Commented Feb 24, 2016 at 10:23

With a few bells and whistles.

Clear[f]

f[x_, a_] = a - x^2;
soln[x_, a_] = Solve[f[x, a] == x, x];

Manipulate[
Column[{
Plot[{f[x, a], x}, {x, -2, 2},
Epilog -> {Red, AbsolutePointSize[5],
Point[{x, f[x, a]} /. soln[x, a]]},
ImageSize -> 360,
PlotLegends -> Placed[{f[x, a], x}, {.7, .2}]],
StringForm["\nx = ", Or @@ (x /. soln[x, a])]},
Alignment -> Center],
{{a, 0}, -0.25, 2, .05,
Appearance -> "Labeled"}]
`