Re: extract from Reduce
- To: mathgroup at smc.vnet.net
- Subject: [mg130359] Re: extract from Reduce
- From: debguy <johnandsara2 at cox.net>
- Date: Thu, 4 Apr 2013 22:31:56 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <kjkc5k$7n0$1@smc.vnet.net>
this will get a num list if ==, !=, ||, && are involved
Begin["a`"]
Reduce[p*x == 1 && x^2 == y, {p, x}];
% /. x_ == y_ -> {x, y} /. x_ != y_ -> {x, y}; (* 1 *)
% //. x_ && y_ -> {x, y} //. x_ || y_ -> {x, y};
Partition[Flatten[%], 2]; (* 2 *)
answer=%[[All,2]] (* just the numbers so to speak *)
End[];
Scan[Remove, Names["a`*"]]
(* note! without !=, &&, || values are "wrong" unless used in context
*)
(* (1)
%//InputForm
{p, -(1/Sqrt[y])} && {x, -Sqrt[y]} && {y, 0} ||
{p, 1/Sqrt[y]} && {x, Sqrt[y]} && {y, 0}
*)
(* 2
% // InputForm
{{p, -(1/Sqrt[y])}, {x, -Sqrt[y]}, {y, 0}, {p, 1/Sqrt[y]}, {x,
Sqrt[y]},
{y, 0}}
*)