MathGroup Archive 2009

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

Search the Archive

Re: Plotting in a dynamic environment.

A function is a far more beautiful thing if one writes a coherent definition
of it with arguments localized to the function and specifically listed on
the lhs of the definition.

myfun[x_, t_] := x^2 + 3 t x

 Plot[myfun[x, t], {x, 1, 2},
  PlotRange -> {0, 65}],
 {{t, 1}, 0, 10}]

Or, if you wish, you could define myfun by:

myfun = Function[{x, t}, x^2 + 3 t x];

In the Plot statement within Manipulate one should almost always set an
explicit PlotRange to avoid the "Manipulate Jitters".

David Park
djmpark at  

From: mgoic [mailto:magoic at] 

Hi everyone,

I am having problems when trying to plot an expression in a Dynamic
model using manipulate tool. For example, in this simple code I can
plot the function (first plot), I can evaluate its value in a
manipulate environment (second plot), but when trying to plot in a
dynamic environment I just get empty axis (third plot).

myfun = x^2 + 3 t x ;
t = 1;
Plot[myfun, {x, 0, 2}]
Manipulate[Evaluate[myfun], {x, 1, 2}, {{t, 1}, 0, 10}]
Manipulate[Plot[Evaluate[myfun], {x, 1, 2}], {{t, 1}, 0, 10}]

Any idea of what I am doing wrong? I will really appreciate any

Marcel Goic

  • Prev by Date: Re: Manipulate Issue - resend with code
  • Next by Date: Re: Manipulate Issue - resend with code
  • Previous by thread: Re: Plotting in a dynamic environment.
  • Next by thread: a' vs a and a vs a' looks different in streamplot