Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92296] Re: Help
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 27 Sep 2008 06:48:18 -0400 (EDT)
  • References: <gbjmbb$3ah$1@smc.vnet.net>

Although this is not an iron-clad rule, still I would never write an 
expression like:

a = Sin[34*x - 2*t];

Clear[a]

Instead, I would always define a function with argument patterns on the left 
hand side.

a[x_, t_] := Sin[34 x - 2 t]

Also you don't actually have to use "*" for a multiplication sign. You can 
just leave a space. Between numbers and symbols Mathematica will 
automatically insert a space. Then it is easy to write your Animate 
statement:

Animate[Plot[a[x, t], {x, 0, 2 \[Pi]}, PlotPoints -> 200,
  MaxRecursion -> 2], {t, 0, 5}]

In this case, because the animation had many oscillations you should 
probably use the PlotPoints and MaxRecursion options to obtain a reasonably 
smooth curve. Usually MaxRecursion, which has a default value of 2, is the 
best option to adjust, but in this case you actually have to use PlotPoints.

(There was also an error in that you used pi instead of Pi.)

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Rui" <rui.rojo at gmail.com> wrote in message 
news:gbjmbb$3ah$1 at smc.vnet.net...
> I'm new in Mathematica. I have version 6.0.3.0.
> I'm trying to create an animation or a plot, something simple. I found
> Animate[].
> I can make it work fine by doing something "like"
> Animate[Plot[Sin[34*x-2*t], {x, 0, 2*pi}], {t, 0, 5} ]
> But if i have my expression stored in a variable i can't...
> a = Sin[34*x-2*t];
> Animate[Plot[a, {x, 0, 2*pi}], {t, 0, 5} ]
> leaves the animation blank.
>
> I tries all variants I could think of and I always fail. I actually
> wanted to create several animations of expressions i have stored in a
> list, and I could do it one by one manually but I wanted to learn the
> proper way and I'm frustrated already. Any ideas?
> 



  • Prev by Date: Re: Help
  • Next by Date: Re: Get Graphics Coordinates accuracy
  • Previous by thread: Re: Help
  • Next by thread: Re: Help