Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Problems with Module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112066] Re: Problems with Module
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sat, 28 Aug 2010 07:03:11 -0400 (EDT)
  • References: <i57rns$1h4$1@smc.vnet.net>

Hi Sergio,

The problem in your code seems to be an incorrect way of writing down
your derivatives. If you use the few lines below instead of the four
original lines all seems to work:

vel[t_] = r'[t];
acel[t_] = r''[t];
unitario[t_] = acel[t]/Norm[acel[t]];
derivadadeu[t_] = unitario'[t];

Cheers -- Sjoerd


On Aug 27, 10:07 am, Docente Sergio Miguel Terrazas Porras
<sterr... at uacj.mx> wrote:
>  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}]
>  ]



  • Prev by Date: Re: Selecting points from graphics
  • Next by Date: Re: Problems with Module
  • Previous by thread: Problems with Module
  • Next by thread: Re: Problems with Module