MathGroup Archive 2007

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

Search the Archive

Re: question about evaluation and Manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78345] Re: question about evaluation and Manipulate
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 28 Jun 2007 06:33:59 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f5vqp7$iqj$1@smc.vnet.net>

Yaroslav Bulatov wrote:
> I'm trying to manipulate a plot where the plotted expression is a
> symbol that should be evaluated before plotting.
> 
> f[x_] = a x;
> Manipulate[Plot[f[x], {x, 0, 1}], {a, 0, 1}]
> 
> This doesn't work, presumably because Plot doesn't have access to the
> value of "a" set by Manipulate. So I'd like to evaluate the first
> argument Plot, but not Plot itself before Manipulate is executed, is
> there a way to do this?

Either one of the following expressions will yield the desired result.

f[a_][x_] = a*x;
Manipulate[Plot[f[a][x], {x, 0, 1}], {a, 0, 1}]

f[x_] = a*x;
Manipulate[Plot[f[x] /. a -> b, {x, 0, 1}], {b, 0, 1}]

Regards,
Jean-Marc


  • Prev by Date: Re: question about evaluation and Manipulate
  • Next by Date: Re: comparing rewite rules
  • Previous by thread: Re: question about evaluation and Manipulate
  • Next by thread: Re: question about evaluation and Manipulate