Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: From Reduce to List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120462] Re: From Reduce to List
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 24 Jul 2011 03:19:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201107232354.TAA08719@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

(a == 1001 && b == 1001000) || (a == 1002 &&
     b == 501000) || (a == 1004 && b == 251000) /. {Or -> List,
   And -> List, Equal[_, x_] :> x}

{{1001, 1001000}, {1002, 501000}, {1004, 251000}}

or

expr = (a == 1001 && b == 1001000) || (a == 1002 &&
      b == 501000) || (a == 1004 && b == 251000);
{a, b} /. List[expr // ToRules]

{{1001, 1001000}, {1002, 501000}, {1004, 251000}}

Bobby

On Sat, 23 Jul 2011 18:54:16 -0500, Harvey P. Dale <hpd1 at nyu.edu> wrote:

> 	What is the easiest and most efficient way to transform the
> output from Reduce into a list of values?  For example, if Reduce
> produces
> (a==1001&&b==1001000)||(a==1002&&b==501000)||(a==1004=
> &&b==251000) and I
> want {{1001,1001000},{1002,501000},{1004,251000}}, what is the best way
> to go from the former to the latter?
>
> 	Harvey
>
> Harvey P. Dale
> University Professor of Philanthropy and the Law
> Director, National Center on Philanthropy and the Law
> 139 MacDougal Street
> New York, N.Y. 10012-1076
> Tel: 212-998-6161
> Fax: 212-995-3149
>


-- 
DrMajorBob at yahoo.com




  • Prev by Date: Re: From Reduce to List
  • Next by Date: TransformedDistribution -- odd problem
  • Previous by thread: From Reduce to List
  • Next by thread: Re: From Reduce to List