MathGroup Archive 2009

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

Search the Archive

Re: Manipulating list of functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96325] Re: Manipulating list of functions
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 11 Feb 2009 05:24:26 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <gmrmek$9vj$1@smc.vnet.net>

In article <gmrmek$9vj$1 at smc.vnet.net>, replicatorzed at gmail.com wrote:

> I have the following code:
> 
> Manipulate[
>  funcA[z_] := Sin[z + a];
>  funcB[z_] := Cos[z + b];
>  funcC[z_] := 0;
>  funcList = #[x] & /@ {funcA, funcB, funcC};
>  Plot[funcList, {x, 1, 10}, Axes -> False, Frame -> True],
>  {a, 0, 1},
>  {b, 0, 1}
>  ]
> 
> It returns the Manipulate panel correctly. What annoys me is the cell
> bracket of it that is constantly highlighted, probably because there
> is some calculation going on even when I do not move any of the
> sliders, due to some function-definitions. I'm afraid I do not fully
> understand the cause of it. Nor do I know how to overcome it. Also
> what should I do, if I want to move the funcA, funcB, funcC
> definitions outside of Manipulate?

As it has already answered many times in this very list, the arguments 
manipulated by Manipulate[] bust be seen explicitly in the expression 
being manipulated. For instance,

    funcA[z_] := Sin[z + a];
    funcB[z_] := Cos[z + b];
    funcC[z_] = 0;
    funcList[a_, b_, x_] = #[x] & /@ {funcA, funcB, funcC};

    Manipulate[
     Plot[funcList[a, b, x], {x, 1, 10}, Axes -> False, 
      Frame -> True], {a, 0, 1}, {b, 0, 1}]

works as expected and avoid the undesired background computations.

Regards,
--Jean-Marc


  • Prev by Date: Re: WeatherData - many properties unavailable?
  • Next by Date: Re: Re: Map[] and multiple args function
  • Previous by thread: Re: Manipulating list of functions
  • Next by thread: Re: Manipulating list of functions