5
$\begingroup$

How do I label the "2" and "3" so they show "square" and "cubed" in Manipulate controls? The following is my code:

f[x_] := x
Manipulate[f[x]^n, {x, -10, 10, 1}, {n, {2, 3}}]
$\endgroup$
1
  • 3
    $\begingroup$ You find this information in the documentation page of Manipulate. Open the "Details and Options` section and it should jump right at you :) $\endgroup$
    – halirutan
    Mar 6, 2020 at 5:30

1 Answer 1

5
$\begingroup$

I'd do it this way:

Manipulate[
  x^n,
  {x, -10, 10, 1, Appearance-> "Labeled"},
  {{n, 2}, {2 -> "square", 3 -> "cube"}}]

manip

$\endgroup$
2
  • $\begingroup$ in the {{n, 2}, {...}} what does the 2 do? $\endgroup$ Mar 6, 2020 at 8:09
  • 1
    $\begingroup$ @JulesManson. It sets the initial value for the setter bar. $\endgroup$
    – m_goldberg
    Mar 6, 2020 at 15:41

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.