More about Problems with Module
- To: mathgroup at smc.vnet.net
- Subject: [mg112076] More about Problems with Module
- From: Docente Sergio Miguel Terrazas Porras <sterraza at uacj.mx>
- Date: Sun, 29 Aug 2010 02:49:58 -0400 (EDT)
Hi again Sjoerd, The point of the program is this. It is easily proven mathematically that the derivative of a vector of constant magnitude is a vector perpendicular to the first one (this is what I am trying to ilustrate). By replacing du[t_] = acel'[t] // Normalize, for du[t_] = unitario'[t]// Normalize, the resulting vector is not perpendicular to acel[t], because acel'[t] is not of constant length. So the problem seems to come at taking de derivative of acel[t]/Norm[acel[t]]. By the way, I was not aware of the Normalize command. Thanks any way, my code does work as expected, as long as I leave empty the list of local variables in Module. Thanks Sergio ________________________________________ De: Sjoerd C. de Vries [sjoerd.c.devries at gmail.com] Enviado el: s=E1bado, 28 de agosto de 2010 04:28 p.m. Para: Docente Sergio Miguel Terrazas Porras Asunto: Re: Problems with Module This slight modification of your code seems to work (even though it shouldn't according to John). f[t_] := 4 Sin[t]; g[t_] := 2 Cos[t]; a = 0; b = 2 \[Pi]; DerVectConst[f_, g_, a_, b_] := Module[{r, vel, acel, unitario, derivadadeu, du}, r[t_] = {f[t], g[t]}; vel[t_] = r'[t]; acel[t_] = r''[t]; unitario[t_] = acel[t] // Normalize; du[t_] = acel'[t] // Normalize; 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.1 unitario[t])], Text[Style[ "\!\(\*SuperscriptBox[OverscriptBox[\"u\", \"^\"], \"\[Prime]\ \"]\)", 18, Bold], (r[t] + 1.1 du[t])]}]; punto = Graphics[{PointSize[.02], Point[r[t]]}]; Show[g1, f1, f2, txt, punto, PlotRange -> All], {t, a, b}]] DerVectConst[f, g, a, b] Cheers -- Sjoerd