Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Plotting in a dynamic environment.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99674] Re: [mg99614] Plotting in a dynamic environment.
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 10 May 2009 05:20:55 -0400 (EDT)
  • References: <13178409.1241854630710.JavaMail.root@n11>

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.

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

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

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

Clear[myfun];
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 comcast.net
http://home.comcast.net/~djmpark/  


From: mgoic [mailto:magoic at gmail.com] 

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}]
Clear[t]
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
guidance.

Regards,
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