MathGroup Archive 2011

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

Search the Archive

Re: Question about Manipulate


On 11/09/2011 05:24 AM, mailcwc 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?
>

This does seem to be an FAQ. See

Documentation Center > Manipulate > Possible Issues

Third item begines: "Manipulate only "notices" explicit visible 
parameters:" and goes on to show how this should generally be handled 
(with almost the same example as yours). In this case one would do

f[a_, b_] = Sin[a*x + b]

Manipulate[
  Plot[f[a, b], {x, 0, 4 \[Pi]}], {a, 0.5, 2}, {b, 0, 2 \[Pi]}]

Daniel Lichtblau
Wolfram Research




  • Prev by Date: Re: AspectRatio -> 1 vs AspectRatio ->1.25
  • Next by Date: Re: How to use SeriesCoefficient to define new functions
  • Previous by thread: Re: Question about Manipulate
  • Next by thread: Re: Question about Manipulate