Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Help x-y pairs with rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97857] Re: [mg97829] Help x-y pairs with rules
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Tue, 24 Mar 2009 05:29:30 -0500 (EST)
  • References: <200903230902.EAA27034@smc.vnet.net>

Thread over lists of rules

In[1]:= (Thread[#1] & ) /@ {{x^2, {x -> 2, x -> 3}}, {x^3, {x -> 5}}}
Out[1]= {{{x^2, x -> 2}, {x^2, x -> 3}}, {{x^3, x -> 5}}}

and map

{x, #[[1]]} /. #[[2]] &

at the second level

In[2]:= Map[{x, #1[[1]]} /. #1[[2]] & , (Thread[#1] & ) /@
     {{x^2, {x -> 2, x -> 3}}, {x^3, {x -> 5}}}, {2}]
Out[2]= {{{2, 4}, {3, 9}}, {{5, 125}}}


Adriano Pascoletti


2009/3/23 dragec <culinovic at gmail.com>

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


  • Prev by Date: Re: Got a tip ?
  • Next by Date: Re: Question about how to graph the vector field for the
  • Previous by thread: Help x-y pairs with rules
  • Next by thread: Re: Help x-y pairs with rules