Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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