       Re: How to parse result from Reduce[ ] function

• To: mathgroup at smc.vnet.net
• Subject: [mg73268] Re: How to parse result from Reduce[ ] function
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Fri, 9 Feb 2007 02:21:34 -0500 (EST)
• Organization: The Open University, Milton Keynes, UK
• References: <eqep0l\$5bs\$1@smc.vnet.net>

```Anton Vrba wrote:
> Hi,
>
> The output of a Reduce[...] function call is
>
> C(element)Integers &&
> x==358537039003+2964364736430689 C &&
> y==28744265823+237656026328741 C &&
> p==205319+1697566324 C
>
> but I want to use the values  after the p== i.e. 205319 and 1697566324 for further calculation in my program
>
> How do I obtain these? other than by manual cut and paste.
>
> best regards
> Anton
>

A combination of Cases and transformation rules should do the trick.

In:=
sol = C â?? Integers && x == 358537039003 +
2964364736430689*C &&
y == 28744265823 + 237656026328741*C &&
p == 205319 + 1697566324*C;

In:=
savedvalues = Flatten[
Cases[sol, p == (val_) -> val] /. Plus -> List /.
C -> 1]

Out=
{205319, 1697566324}

In:=
First[savedvalues]

Out=
205319

In:=
Last[savedvalues]

Out=
1697566324

Regards,
Jean-Marc

```

• Prev by Date: Re: List manipulation
• Next by Date: Re: How to parse result from Reduce[ ] function
• Previous by thread: Re: How to parse result from Reduce[ ] function
• Next by thread: Re: How to parse result from Reduce[ ] function