Re: How to parse result from Reduce[ ] function

• To: mathgroup at smc.vnet.net
• Subject: [mg73273] Re: How to parse result from Reduce[ ] function
• From: "dimitris" <dimmechan at yahoo.com>
• Date: Fri, 9 Feb 2007 02:24:10 -0500 (EST)
• References: <eqep0l\$5bs\$1@smc.vnet.net>

On Feb 8, 11:03=C2=A0am, Anton Vrba <antonv... at yahoo.com> wrote:
> Hi,
>
> The output of a Reduce[...] function call is
>
> C[1](element)Integers &&
> x==358537039003+2964364736430689 C[1] &&
> y==28744265823+237656026328741 C[1] &&
> p==205319+1697566324 C[1]
>
> but I want to use the values =C2=A0after the p== i.e. 205319 and 1697=
566324 for further calculation in my program
>
> How do I obtain these? other than by manual cut and paste.
>
> Thanks for your help
> best regards
> Anton

Since you don't give your input I use a system of equations from the
Help Browser.

In[127]:=
Reduce[x^2 - 2*y^2 == 1 && x >= 0 && y >= 0 &&
Element[Alternatives[x,y],Integers], {x, y}]
(Cases[#1, (x_) == (a_) :> x -> a, Infinity] & ) /@ %
List @@ %
Sin[x + y] /. %
N[% /. C[1] -> 2]

Out[127]=
(x == 1 && y == 0) || (C[1] =E2=88=88 Integers && C[1] >= 0 && x =
== (1/2)*((3
- 2*Sqrt[2])^C[1] + (3 + 2*Sqrt[2])^C[1]) &&
y == -(((3 - 2*Sqrt[2])^C[1] - (3 + 2*Sqrt[2])^C[1])/(2*Sqrt[2])))

Out[128]=
{x -> 1, y -> 0} || {x -> (1/2)*((3 - 2*Sqrt[2])^C[1] + (3 +
2*Sqrt[2])^C[1]),
y -> -(((3 - 2*Sqrt[2])^C[1] - (3 + 2*Sqrt[2])^C[1])/(2*Sqrt[2]))}

Out[129]=
{{x -> 1, y -> 0}, {x -> (1/2)*((3 - 2*Sqrt[2])^C[1] + (3 +
2*Sqrt[2])^C[1]),
y -> -(((3 - 2*Sqrt[2])^C[1] - (3 + 2*Sqrt[2])^C[1])/(2*Sqrt[2]))}}

Out[130]=
{Sin[1], -Sin[(1/2)*(-(3 - 2*Sqrt[2])^C[1] - (3 + 2*Sqrt[2])^C[1]) +
((3 - 2*Sqrt[2])^C[1] - (3 + 2*Sqrt[2])^C[1])/(2*Sqrt[2])]}

Out[131]=
{0.8414709848078965, -0.6636338842129649}

Regards
Dimitris

• Prev by Date: Re: Mathematica, Quad Core, Linux
• Next by Date: Re: Showing that a hypergeometric expression is 0?
• Previous by thread: Re: How to parse result from Reduce[ ] function
• Next by thread: Re: How to parse result from Reduce[ ] function