Re: extract from Reduce
- To: mathgroup at smc.vnet.net
- Subject: [mg130365] Re: extract from Reduce
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Thu, 4 Apr 2013 22:33: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: <20130404025057.81F326A68@smc.vnet.net>
a := x == 3 || x == 4 || x == 7
x /. {a // ToRules}
{3, 4, 7}
a := x == 6
x /. {a // ToRules}
{6}
Bob Hanlon
On Wed, Apr 3, 2013 at 10:50 PM, <hamiltoncycle at gmail.com> wrote:
> I have a result from the command Reduce that looks like this (as an
> example):
>
> a:= x==3||x==4||x==7
>
> I need to extract the numbers but I can't find a nice way to handle the
> case when there is only one equation, for instance:
>
> a:= x==6
>
> currently I check what the head of the expression is (Head[a]) and handle
> the case Head[a]=Or with a Map[] and the case Head[a]="Equal" with a[[2]].
> Not very nice, but I guess that there is a neat way to do it.
>
> cheers, Robert
>
>
- References:
- extract from Reduce
- From: hamiltoncycle@gmail.com
- extract from Reduce