Re: Problems with Module
- To: mathgroup at smc.vnet.net
- Subject: [mg112069] Re: Problems with Module
- From: Tomas Garza <tgarza10 at msn.com>
- Date: Sat, 28 Aug 2010 07:03:43 -0400 (EDT)
I think you're using an invalid notation for your derivatives. The on-line help uses a straight ' to denote a derivative (q.v.). For the texts you had better use the writing assistant palette, special symbols, and you'll find a prime and a double prime symbol. Making these changes, I get a clean result for t == 0, but as soon as the slider is moved an error is reported, which has to do with your code, I guess. Saludos, Tomas > Date: Fri, 27 Aug 2010 04:07:29 -0400 > From: sterraza at uacj.mx > Subject: [mg112052] Problems with Module > To: mathgroup at smc.vnet.net > > Hi! > > The following is a slight modification of a code that works fine. But this > one does not work. > However, if I empty the list of local variables in Module, Then it works! > Could some of you enlighten me? > > f[t_]:==4 Sin[t];g[t_]:==2 Cos[t];a==0;b==2\[Pi]; > DerVectConst[f,g,a,b] > > DerVectConst[f_,g_,a_,b_]:==Module[{r,vel,acel,unitario,derivadadeu,du}, > $Assumptions==t\[Element]Reals; > > r[t_]=={f[t],g[t]}; > vel[t_]==(r^\[Prime])[t]; > acel[t_]==(r^\[DoublePrime])[t]; > unitario[t_]==acel[t]/Norm[acel[t]]; > derivadadeu[t_]==(unitario^\[Prime])[t]; > du[t_]==derivadadeu[t]//FullSimplify; > > Manipulate[ > > f1==Graphics[{Thick,Blue,Arrow[{r[t],r[t]+du[t]}]}]; > f2==Graphics[{Thick,Green,Arrow[{r[t],r[t]+unitario[t]}]}]; > g1==ParametricPlot[r[t],{t,a,b},AspectRatio->Automatic,PlotStyle->{Thick, Red}]; > txt==Graphics[{Text[Style["\!\(\*OverscriptBox[\"u\", > \"^\"]\)",18,Bold],(r[t]+1.1unitario[t])],Text[Style["\!\(\*OverscriptBox[\"u\", > \"^\"]\)^\[Prime]",18,Bold],(r[t]+1.1du[t])]}]; > punto==Graphics[{PointSize[.02],Point[r[t]]}]; > Show[g1,f1,f2,txt,punto,PlotRange->All] > ,{t,a,b}] > ] >