Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12940 > unrolled thread

custom label/display for a Manipulate slider?

Started byDavid <dkehlenbeck@gmail.com>
First post2012-12-25 07:00 +0000
Last post2012-12-27 10:03 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  custom label/display for a Manipulate slider? David <dkehlenbeck@gmail.com> - 2012-12-25 07:00 +0000
    Re: custom label/display for a Manipulate slider? Helen Read <readhpr@gmail.com> - 2012-12-27 10:03 +0000

#12940 — custom label/display for a Manipulate slider?

FromDavid <dkehlenbeck@gmail.com>
Date2012-12-25 07:00 +0000
Subjectcustom label/display for a Manipulate slider?
Message-ID<kbbitg$9o3$1@smc.vnet.net>
Hi,

So I'm trying to make a somewhat simple unit-circle, and have a slider control within Manipulate that lets the user change theta at the usual steps from 0 to 2Pi. When I use Appearance ->"Labeled" for the slider, it shows the value of theta but in decimals - is there any way to make it show the exact values? I'm assuming I'd have to type out that list somewhere in the code, but as I move the slider, I want it to display Pi/6, 4Pi/3, etc. Is there an easy way to do this?

Thanks!
David

Manipulate[
 Show[
  Graphics[{
    {Gray, Circle[{0, 0}, 1]},
    {Darker[Green, 0.2], Thick, Circle[{0, 0}, 1, {0, theta}]},
    {Darker[Gray], Line[{{0, 0}, {Cos[theta], Sin[theta]}}]},
    {Darker[Blue, 0.1], Thickness[0.006],
     Line[{{Cos[theta], 0}, {Cos[theta], Sin[theta]}}]},
    {Darker[Red, 0.1], Thickness[0.006],
     Line[{{0, 0}, {Cos[theta], 0}}]},
    {}
    }],
  PlotRange -> 2, ImageSize -> 300, Axes -> True,
  Ticks -> {{-1, 1}, {-1, 1}}
  ],
 {theta, {0, \[Pi]/6, \[Pi]/4, \[Pi]/3, \[Pi]/2, 2 \[Pi]/3, 3 \[Pi]/4,
    5 \[Pi]/6, \[Pi], 7 \[Pi]/6, 5 \[Pi]/4, 4 \[Pi]/3, 3 \[Pi]/2,
   5 \[Pi]/3, 7 \[Pi]/4, 11 \[Pi]/6, 2 \[Pi]}, ControlType -> Slider,
  Appearance -> "Labeled"
  }]

[toc] | [next] | [standalone]


#12950

FromHelen Read <readhpr@gmail.com>
Date2012-12-27 10:03 +0000
Message-ID<kbh6cq$ii1$1@smc.vnet.net>
In reply to#12940
All you need to specify is start, end, and an increment. Try something 
like this.

{theta, 0, 2 \[Pi], \[Pi]/24, ControlType -> Slider,
  Appearance -> "Labeled"}

Helen Read
University of Vermont

On 12/25/2012 2:00 AM, David wrote:
> Hi,
>
> So I'm trying to make a somewhat simple unit-circle, and have a slider control within Manipulate that lets the user change theta at the usual steps from 0 to 2Pi. When I use Appearance ->"Labeled" for the slider, it shows the value of theta but in decimals - is there any way to make it show the exact values? I'm assuming I'd have to type out that list somewhere in the code, but as I move the slider, I want it to display Pi/6, 4Pi/3, etc. Is there an easy way to do this?
>
> Thanks!
> David
>
> Manipulate[
>   Show[
>    Graphics[{
>      {Gray, Circle[{0, 0}, 1]},
>      {Darker[Green, 0.2], Thick, Circle[{0, 0}, 1, {0, theta}]},
>      {Darker[Gray], Line[{{0, 0}, {Cos[theta], Sin[theta]}}]},
>      {Darker[Blue, 0.1], Thickness[0.006],
>       Line[{{Cos[theta], 0}, {Cos[theta], Sin[theta]}}]},
>      {Darker[Red, 0.1], Thickness[0.006],
>       Line[{{0, 0}, {Cos[theta], 0}}]},
>      {}
>      }],
>    PlotRange -> 2, ImageSize -> 300, Axes -> True,
>    Ticks -> {{-1, 1}, {-1, 1}}
>    ],
>   {theta, {0, \[Pi]/6, \[Pi]/4, \[Pi]/3, \[Pi]/2, 2 \[Pi]/3, 3 \[Pi]/4,
>      5 \[Pi]/6, \[Pi], 7 \[Pi]/6, 5 \[Pi]/4, 4 \[Pi]/3, 3 \[Pi]/2,
>     5 \[Pi]/3, 7 \[Pi]/4, 11 \[Pi]/6, 2 \[Pi]}, ControlType -> Slider,
>    Appearance -> "Labeled"
>    }]
>



[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web