1
$\begingroup$

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?

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

1 Answer 1

3
$\begingroup$

You can use Initialization:

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

enter image description here

$\endgroup$
2
  • 3
    $\begingroup$ Also Manipulate[u, {{u, {0, 0}}, Locator}] $\endgroup$
    – Coolwater
    Jun 21, 2017 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, 2017 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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