Re: On partitioning lists by intervals

• To: mathgroup at smc.vnet.net
• Subject: [mg80443] Re: [mg80396] On partitioning lists by intervals
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Wed, 22 Aug 2007 04:52:57 -0400 (EDT)
• References: <200708210903.FAA14595@smc.vnet.net>

```On 21 Aug 2007, at 11:03, Mauricio Esteban Cuak wrote:

> Hello there.
> I'm just starting in mathematica and I realise this is a very basic
> question, but I tried to find an answer on the documentation center
> for a couple of hours and on the archive for mathgroup, but couldn't
> find it.
> I have a list of say 500 different random values. I need to divide it
> in n intervals of fixed length (for example, the lowest value is 0 and
> the maximum 100 so I need to get sublists of values that go from 0 to
> 10, 10 to 20, etc.)
>
> cd
>

Using Mathematica 6.0:

ls = RandomInteger[{0, 100}, {30}]
{51, 75, 6, 78, 43, 80, 9, 12, 65, 10, 26, 71, 49, 53, 39, 67, 98,
62, 12, \
43, 70, 38, 51, 13, 45, 75, 52, 0, 70, 77}

BinLists[ls, 10]
{{}, {6, 9, 0}, {12, 10, 12, 13}, {26}, {39, 38}, {43, 49, 43, 45},
{51, 53,
51, 52}, {65, 67, 62}, {75, 78, 71, 70, 75, 70, 77}, {80}, {98}}

Andrzej Kozlowski

```

• Prev by Date: FWHM, InterpolationFunction & Solve
• Next by Date: Re: Intensive numerical calculations
• Previous by thread: On partitioning lists by intervals
• Next by thread: RE: On partitioning lists by intervals