MathGroup Archive 1996

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

Search the Archive

Re: Function


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] ====


  • Prev by Date: Bottom line on remote kernel
  • Next by Date: Re: Function
  • Previous by thread: Function
  • Next by thread: Re: Function