MathGroup Archive 1996

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

Search the Archive

Re: Help on Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3857] Re: [mg3799] Help on Function
  • From: Lou Talman <me at talmanl.mscd.edu>
  • Date: Sat, 4 May 1996 02:12:42 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Roberto Diego asks:

> Could you please help me? I4m trying to write a function (not procedure 

> if possible) that works on a list such as {a1, a2, a3, a4, ...} and 

> returns a list {a2/a1, a3/a2, a4/a3, ...}. 




In[1]:=
  f[X_List] := Map[Apply[Divide, #]&, 

                   Transpose[{Rest[X], Drop[X, -1],}]]
In[2]:=
  stuff = {a1, a2, a3, a4, a5}
Out[2]=
  {a1, a2, a3, a4, a5}
In[3]:=
  f[stuff]
Out[3]=
   a2  a3  a4  a5
  {--, --, --, --}
   a1  a3  a3  a4


--Lou Talman
  Metropolitan State College of Denver

==== [MESSAGE SEPARATOR] ====


  • Next by Date: Re: Function
  • Next by thread: Re: Help on Function