Re: Function
- To: mathgroup at smc.vnet.net
- Subject: [mg3830] Re: Function
- From: rhall2 at umbc.edu (hall robert)
- Date: Mon, 29 Apr 1996 00:30:12 -0400
- Organization: University of Maryland, Baltimore County
- Sender: owner-wri-mathgroup at wolfram.com
In article <4letbt$esv at dragonfly.wolfram.com>,
Roberto Diego <roberto at medusa.es> wrote:
>
> I4m trying to find a function that works on a list like {a1, a2, a3,
>a4, ..., an} and returns a list like {a2/a1, a3/a2, a4/a3, ... an/an-1}.
In[26]:=
l = { a1, a2, a3, a4, a5, a6, a7, a8, a9 };
divideList[ l_List ] := Table[
l[[ lpart ]] / l[[ lpart - 1 ]], { lpart, 2, Length[ l ] }
]
In[28]:=
divideList[ l ]
Out[28]=
a2 a3 a4 a5 a6 a7 a8 a9
{ --, --, --, --, --, --, --, -- }
a1 a2 a3 a4 a5 a6 a7 a8
Aside from arithmetic operators, I think Table[] is used more
than any other function in Mathematica.
--
Bob Hall | "Know thyself? Absurd direction!
rhall2 at gl.umbc.edu | Bubbles bear no introspection." -Khushhal Khan Khatak
==== [MESSAGE SEPARATOR] ====