Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

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!

Weird.

share|improve this answer

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