Re: Help on Function
- To: mathgroup at smc.vnet.net
- Subject: [mg3851] Re: Help on Function
- From: Harald Berndt <haraldb at nature.berkeley.edu>
- Date: Sat, 4 May 1996 02:11:38 -0400
- Organization: University of California Forest Prodcts Lab
- Sender: owner-wri-mathgroup at wolfram.com
Roberto Diego wrote:
>
> Hi people,
>
> 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, ...}. I know it should be an easy
> task but I4m a newbe...
>
How about
divL[list_] := Last[#]/First[#]& /@ Partition[list, 2, 1]
where list is {a1, a2, a3, a4, ...}
--
______________________________________________________________________
Harald Berndt, University of California
Research Specialist Forest Products Laboratory
Phone: 510-215-4224 FAX: 510-215-4299
______________________________________________________________________
==== [MESSAGE SEPARATOR] ====