Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: extract from Reduce
Posted:
Apr 4, 2013 10:29 PM


Hi,
> I have a result from the command Reduce that looks like this (as an > example): > > a:= x==3x==4x==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. >
There might be more efficient ways to do this, but I think this is clear and compact:
Cases[{a}, Equal[x, v_?NumericQ] :> v, Infinity]
hth,
albert



