MathGroup Archive 2009

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

Search the Archive

Re: Help x-y pairs with rules

  • To: mathgroup at
  • Subject: [mg97891] Re: Help x-y pairs with rules
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Wed, 25 Mar 2009 05:41:30 -0500 (EST)

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

Please help with expression that compute this.


Hi, THX,
try this:

In[212]:=        lst = {{x^2, {x -> 2, x -> 3}}, {x^3, {x -> 5}}};

                 myRewrite[lst_] := Module[{lst1},
  		       lst1 = (lst /. t_Rule -> {t}) /. t_^a_ :> {t, t^a};
                             Table[  First[lst1[[i]]] /. Last[lst1[[i]]],
                                  {i, 1, Length[lst1]}] ]

Out[214]= {{{2, 4}, {3, 9}}, {{5, 125}}}

Alexei Boulbitch, Dr., habil.
Senior Scientist

ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern

Phone: +352 2454 2566
Fax:   +352 2454 3566


This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.

  • Prev by Date: Re: Re: Different results with FourierTransform[]
  • Next by Date: Re: Histograms and Iterators - Beginner Question
  • Previous by thread: Re: Help x-y pairs with rules
  • Next by thread: Question about how to graph the vector field for the differential