Re: question about evaluation and Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg78339] Re: question about evaluation and Manipulate
- From: dh <dh at metrohm.ch>
- Date: Thu, 28 Jun 2007 06:28:23 -0400 (EDT)
- References: <f5vqp7$iqj$1@smc.vnet.net>
Hi Yaroslav ,
the variable a in the function definition is a global variable, but
inside Manipulate a is a local variable. Therefore, these two a are
different variables. What you can do is to define a as an argument:
f[x_,a_]=a x;
Manipulate[Plot[f[x,a],{x,0,1}],{a,0,1}]
hope this helps, Daniel
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?
>
>