Re: Cascaded (Multi-range) Iterators?
- To: mathgroup at smc.vnet.net
- Subject: [mg79054] Re: [mg79025] Cascaded (Multi-range) Iterators?
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Tue, 17 Jul 2007 03:21:27 -0400 (EDT)
- References: <30242330.1184576074112.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
Something like this??
Clear[tbl]
tbl[expr_, lists : {__List}] := Flatten[Table[expr, #] & /@ lists, 1]
tbl[f[x], {{x, 0, 1, 0.1}, {x, 2, 10}, {x, 20, 100, 10}}]
{f[0.], f[0.1], f[0.2], f[0.3], f[0.4], f[0.5], f[0.6], f[0.7],
f[0.8], f[0.9], f[1.], f[2], f[3], f[4], f[5], f[6], f[7], f[8],
f[9], f[10], f[20], f[30], f[40], f[50], f[60], f[70], f[80], f[90],
f[100]}
Bobby
On Mon, 16 Jul 2007 01:14:38 -0500, AES <siegman at stanford.edu> wrote:
> Seems like a very useful (and feasible?) (and not too difficult)
> extension to the Iterator concept for Tables, etc., would be a cascaded
> or multi-range Iterator, e.g. something like
>
> Table[ f[x], { {x, 0, 1, 0.1}, {x, 2, 10}, {x, 20, 100, 10} } ]
>
> I often have need for a "different step sizes over different ranges"
> capability like this, and have to resort to workarounds to achieve it.
>
> [Apologies if my searches in the Help files have missed something that
> already does this.]
>
>
--
DrMajorBob at bigfoot.com