Re: Help
- To: mathgroup at smc.vnet.net
- Subject: [mg92302] Re: Help
- From: "Rui Rojo" <rui.rojo at gmail.com>
- Date: Sat, 27 Sep 2008 06:49:26 -0400 (EDT)
- References: <gbjmbb$3ah$1@smc.vnet.net> <48DDBD6E.4080304@gmail.com>
Or, for example, now I wanted to create a wave pack, adding up different waves... so i put in a for loop something like Onda+= Sin[blabla] now I have my wave pack stored in Onda, but I want to make it a function and I can't... If I do f[x_, t_]:=Onda it doesn't work :S On Sat, Sep 27, 2008 at 2:46 AM, Rui Rojo <rui.rojo at gmail.com> wrote: > Thanks a lot :) . > I'll go on bothering, feel free not to answer, hehe... > > I'm trying to understand how all this works. > If I put in a variable an expression, like > expr = 2*x+65-t; > then I can't use it in certain situations because mathematica seems to > expect to "see" the x and t, but in some others I can. > for example > expr = 2*x+65-t; Animate[Plot[expr, {x, 0, 4}], {t, 0, 5}]; > doesn't work... > neither does: > ran={x, 0, 4}; Plot[Sin[x], ran] > but > Clear[expr];expr=2+x;Plot[expr, {x, 0, 4}] > does work. > In some of the places where it doesn't work, you seem to be able to sort > the problem by declaring expr[x_, etc]=etc etc and then using expr[x, > etc]... but not all the times... in the case of ran, it doesn't work either. > How exactly does all of this work, or where can I read about it? i can't > find anything clear in the Help... > Is there any way to tell mathematica: "ok, heere replace expr for what you > have stored, imagine instead of expr it says what i read when i type expr > and press shift+enter"... or how do you think i should manage all this? just > guessing, testing and changing? > > > > On Sat, Sep 27, 2008 at 1:58 AM, Jean-Marc Gulliet < > jeanmarc.gulliet at gmail.com> wrote: > >> Rui wrote: >> >> 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? >>> >> >