MathGroup Archive 2008

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

Search the Archive

Re: evaluations in Plot in Manipulate?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91033] Re: evaluations in Plot in Manipulate?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Mon, 4 Aug 2008 03:23:19 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <g6kc15$k4d$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

you miss, that Manipulate[] by default localize the variables
and in

expr=Exp[a]

Manipulate[
   Exp[a],{a,1,5}]

a in expr is not the same as "a" in Manipulate[]. You can see this
when you type

Manipulate[HoldForm[a], {a, 1, 5}]

The option LocalizeVariables control the generation of local variables.

Regards
   Jens

J Davis wrote:
> I must be overlooking something simple in the way Mathematica handles
> the arguments of Manipulate.
> 
> Could someone expound on the contrast in behavior between the last
> example below and the previous two?
> 
> Clear[a, b, c, h];
> a = 1;
> c = 1;
> h[t_] = InverseLaplaceTransform[1/(a s^2 + b s + c), s, t]
> 
> 
> Manipulate[
>  Plot[Evaluate[
>    InverseLaplaceTransform[1/(a s^2 + b s + c), s, t]], {t, 0, 10},
>   PlotRange -> {{0, 10}, {-1, 1}}], {b, 0, 5}]
> 
> (* works fine *)
> 
> 
> Manipulate[
>  Plot[-((E^((-(b/(2 a)) - Sqrt[b^2 - 4 a c]/(2 a)) t) -
>     E^((-(b/(2 a)) + Sqrt[b^2 - 4 a c]/(2 a)) t))/Sqrt[
>    b^2 - 4 a c]), {t, 0, 10}, PlotRange -> {{0, 10}, {-1, 1}}], {b, 0,
>    5}]
> 
> (* works fine... I just copied and pasted the output of h[t] into the
> Plot[...] *)
> 
> 
> Manipulate[
>  Plot[Evaluate[h[t]], {t, 0, 10},
>   PlotRange -> {{0, 10}, {-1, 1}}], {b, 0, 5}]
> 
> (* nothing... what am I missing? *)
> 
> Doesn't Evaluate[h[t]] hold the evaluated form of h[t] (so that it is
> computed just once) and then Plot simply substitutes a sequence of
> numerical values into that evaluated form? If so, why is there no
> output?
> 
> Thanks in advance,
> John
> 


  • Prev by Date: Re: How do I set PlotRegion value permantly?
  • Next by Date: Workaround for an unexpected behavior of Sum
  • Previous by thread: Re: How do I set PlotRegion value permantly?
  • Next by thread: Workaround for an unexpected behavior of Sum