MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Question about Manipulate


On Nov 9, 10:37 pm, "mail... at gmail.com" <mail... at gmail.com> wrote:
> I tried the following code in Mathematica 8.0
>
> Clear["Global`*"]
> f = Sin[a x + b]
> Manipulate[Plot[f, {x, 0, 4 \[Pi]}], {a, 0.5, 2}, {b, 0, 2 \[Pi]}]
>
> The Manipulate block is showed, but the Sin function is not plotted.
>
> When I replace f in the third line with its definition,
>
> Clear["Global`*"]
> Manipulate[ Plot[Sin[a x + b], {x, 0, 4 \[Pi]}], {a, 0.5, 2}, {b, 0, 2
> \[Pi]}]
>
> The Sin function is plotted.
>
> Is this a bug or a limitation in Mathematica?

your a and b within the Manipulate are not the global a and b you have
used outside of the manipulate in your definition of f. That is why it
is failing. In this particular case the syntax styling gives a heads
up that they are different beasts.

Mike




  • Prev by Date: Re: How to use SeriesCoefficient to define new functions
  • Next by Date: Re: Question about Manipulate
  • Previous by thread: Re: Question about Manipulate
  • Next by thread: Re: Question about Manipulate