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$
  • 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 '20 at 5:30
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$
  • $\begingroup$ in the {{n, 2}, {...}} what does the 2 do? $\endgroup$ – Jules Manson Mar 6 '20 at 8:09
  • 1
    $\begingroup$ @JulesManson. It sets the initial value for the setter bar. $\endgroup$ – m_goldberg Mar 6 '20 at 15:41

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.