MathGroup Archive 2012

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

Search the Archive

Re: A problem with Manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127921] Re: A problem with Manipulate
  • From: Sergio Miguel Terrazas Porras <sterraza at uacj.mx>
  • Date: Sat, 1 Sep 2012 02:28:26 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k1ch1e$n2t$1@smc.vnet.net>,<20120831075745.747ED6864@smc.vnet.net>

That d; was not there, it must have been during the Copy Paste.

I say again, the notebook works, the problem is that, for each initial velocity, the total time (time of flight)

must be different, but Mathematica "remembers" the preceding time when I change the initial speed.

By the way, you are the only one to have bother to answer.

Is the question too stupid?

Thanks

Sergio

________________________________________
Desde: Dominik Hezel [sendme2000 at me.com]
Enviado el: viernes, 31 de agosto de 2012 01:57 a.m.
Hasta: mathgroup at smc.vnet.net
Asunto: Re: A problem with Manipulate

On Sunday, August 26, 2012 8:51:26 AM UTC+2, Sergio Miguel Terrazas Porras wrote:
> Hello guys, I am having a problem with a Manipulate I wrote, to ilustrate a physics problem.
>
>
>
> If you aim at an object that is hanging a height H at a distance D. And at the instant you shoot, the object starts to fall, you will alwais hit it, regardless os the initial speed (provided the floor does not interfere).
>
>
>
>
>
>
>
> However, if I make an evaluation, it works fine, but when I change the speed, it "remembers" the time of flight of the preceding speed.
>
>
>
>
>
>
>
> I will appreciate any help, as I am frustrated at not beeig able to fix the problem.
>
>
>
>
>
>
>
> Thanks
>
>
>
>
>
>
>
>
>
>
>
> d;H=10;r01={0,0};\[Theta]=ArcTan[H/d];a=9.8*{0,-1};
>
> r02={d,H};
>
> chango
>
> chango:=Manipulate[Module[{v0,r1,r2,linea,flecha,chango},
>
> v0=vi*{Cos[\[Theta]],Sin[\[Theta]]};
>
> r1[t_]=r01+v0*t+1/2 a*t^2;
>
> r2[t_]=r02+1/2 a*t^2;
>
>
>
> linea=Graphics[{Red,Dashing[{.01,.01}],Line[{r01,r02}]}];
>
>
>
> flecha=Graphics[Arrow[{r01,r2[t]}]];
>
>
>
> trayectoria1=ParametricPlot[r1[z],{z,0,t+.001}];
>
>
>
> trayectoria2=ParametricPlot[r2[z],{z,0,t+.001},PlotStyle->{Dashing[.02],Brown}];
>
>
>
> chango=Graphics[{Brown,PointSize[.03],Point[r2[t]]}];
>
>
>
>
>
>
>
>
>
>
>
> (*Time of Flight*)
>
> tf=Dynamic[H/(vi*Sin[\[Theta]])];
>
>
>
>
>
>
>
>
>
>
>
> Show[flecha,chango,linea,trayectoria1,trayectoria2,PlotRange->All]
>
> ]
>
> ,{{vi,10,"Subscript[v, i]"},{10,15,20}},{{t,0},0,tf,Appearance->"Labeled"},TrackedSymbols->{vi,t,tf},SaveDefinitions->True]


Some of the code is opaque to me, but if you define 'd' at the very beginning, at least something happens and it's not all red.



  • Prev by Date: Mathematica Prove[...] Command Possible?
  • Next by Date: Is there documentation of the format of a "sound object"
  • Previous by thread: Re: Mathematica Prove[...] Command Possible?
  • Next by thread: Is there documentation of the format of a "sound object"