Re: Help x-y pairs with rules
- To: mathgroup at smc.vnet.net
- Subject: [mg97858] Re: Help x-y pairs with rules
- From: Raffy <raffy at mac.com>
- Date: Tue, 24 Mar 2009 05:29:42 -0500 (EST)
- References: <gq7j74$qco$1@smc.vnet.net>
On Mar 23, 2:02 am, dragec <culino... at gmail.com> wrote: > Please, help with this: > > I have list like this, but bigger: > With one expression (function), always go one or more points (rules) > > {{x^2, {x -> 2, x -> 3}}, {x^3, {x -> 5}}} > > I would like results like this (pairs of x-y) but grouped in lists > according to expression(function): > {{2,2^2},{3,3^2}},{5^3}} > > Please help with expression that compute this. > > THX Your example appears bugged, if I am extrapolating correctly. The proper result should be: {{{2, 4}, {3, 9}}, {{5, 125}}} ? If so, the simplest solution would be: replacements = {{x^2, {x -> 2, x -> 3}}, {x^3, {x -> 5}}} Function[$, {Last[$], #1 /. $}] /@ #2 & @@@ replacements Additionally, you could apply Join to the result, to get a flatter result list.