Consider the following example:

Manipulate[u, {u, Locator}]

which evaluates to:

Now, if you start moving the locator around, you will see the coordinates update:

So the question is, why is the initial value of the locator (Automatic in this case since none was specified) held unevaluated and what can be done for Manipulate to evaluate the initial value?

  • $\begingroup$ Any thoughts on why user interaction evaluates the initial value and whether this is intended behaviour? $\endgroup$
    – Musang
    Jun 22 '17 at 7:54

You can use Initialization:

Manipulate[u, {u, Locator}, Initialization :> (u = {0, 0})]

enter image description here

  • 3
    $\begingroup$ Also Manipulate[u, {{u, {0, 0}}, Locator}] $\endgroup$
    – Coolwater
    Jun 21 '17 at 18:01
  • $\begingroup$ This is interesting, it seems that this works for lists but if you use other kinds of heads, this stops working... Try replacing {0,0} in your answers with Scaled[{1,0}] for example and you see that this isn't evaluated. $\endgroup$
    – Musang
    Jun 22 '17 at 9:53

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.