Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

This snippet

mm = m
Manipulate[{mm, Plot[mm x, {x, 0, 1}]}, {m, 0, 1}]

(m is not defined anywhere) produces a sadly fixed output, m remains symbolic.

This instead

mm = m
Manipulate[Evaluate@{mm, Plot[mm x, {x, 0, 1}]}, {m, 0, 1}]

makes the first element of the list be dynamically evaluated, but not the Plot, which remains empty because m remains symbolic. Lastly,

mm = m
Manipulate[{%, Plot[% x, {x, 0, 1}]}, {m, 0, 1}]

gets the correct thing, everything is evaluated dynamically. Why?

share|improve this question

marked as duplicate by Mr.Wizard Jul 21 '13 at 7:09

This question was marked as an exact duplicate of an existing question.

As I understand it... Manipulate-able variables are only evaluated when they are defined within Manipulate

mm = m
Manipulate[{%, Plot[% x, {x, 0, 1}]}, {m, 0, 1}]

is the same as writing,

Manipulate[{mm = m, Plot[mm x, {x, 0, 1}]}, {m, 0, 1}]

In your first two examples the variable m is undefined and remains that way (i.e. is not linked to the Manipulate variable m).

Is this an answer? Perhaps, not quite?...

It is interesting that Evaluate seems to force mm to link to the Manipulate-"m" but doesn't work for Plot... Also, if only Plot is evaluated, e.g.,

Manipulate[{mm, Evaluate[Plot[mm x, {x, 0, 1}]]}, {m, 0, 1}]

The output slider stops working, however, the graphic is now dynamically linked to the other sliders/outputs in the notebook... try it!


share|improve this answer

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