Want a general method to extract cases resulting from Reduce

*To*: mathgroup at smc.vnet.net*Subject*: [mg88433] Want a general method to extract cases resulting from Reduce*From*: dontdont at gmail.com*Date*: Mon, 5 May 2008 06:13:54 -0400 (EDT)

Someone recently posted asking "How to remove unneeded constraints." I can see a general use for something perhaps related to this. Reduce often gives back fairly complicated nested boolean structures of constraints. Consider the results from the following concrete example: Reduce[{a x1^2 + b x1 + c == y1, a x2^2 + b x2 + c == y2, a( -b/ (2a))^2+ b ( -b/(2a)) + c == y3, y1 < y3, y2 < y3, x1 < x2, Element[Alternatives[ x1, x2, x3, y1, y2, y3, a, b, c], Reals]}, {a, b, c}] or even worse Reduce[{a x1^2 + b x1 + c == y1, a x2^2 + b x2 + c == y2, a( -b/ (2a))^2+ b ( -b/(2a)) + c == y3, y1 < y3, y2 < y3, x1 < x2, Element[Alternatives[ x1, x2, x3, y1, y2, y3, a, b, c], Reals]}, {a, b, c}, Backsubstitution->True] For examples like these I then spend time carefully matching up () and trying to determine how many layers and which of the nested constraints apply to each of the alternatives. I now realize I could often use a general purpose solution to inspect results like these. For example, (all the conditions except the last one are just the conditions I gave Reduce, the y1<y2 I then manually provide after inspecting the result from Reduce) Assuming[y1<y3&&y2<y3&&x1<x2&&Element[Alternatives[x1, x2, x3, y1, y2, y3, a, b, c], Reals]&&y1<y2, reduceExtract[%]] to get from the first example a == (y1 + y2 - 2*y3)/(x1 - x2)^2 - 2*Sqrt[(y1*y2 - y1*y3 - y2*y3 + y3^2)/(x1 - x2)^4] || a == (y1 + y2 - 2*y3)/(x1 - x2)^2 + 2*Sqrt[(y1*y2 - y1*y3 - y2*y3 + y3^2)/(x1 - x2)^4] and in general, to have reduceExtract do the equivalent of unification with all the nested conditions and give me back all the alternatives that match but without the constraints that I have assumed to be in force. (It is not necessary that Assuming[] be used, but that would be an understandable way of reading this) LogicalExpand will at least flatten out the nested conditionals and this might be useful in creating reduceExtract, but by itself it makes the result from Reduce even larger and still leaves me with manually searching through each alternative, checking which constraints apply, and then doing cut and paste to try to get what I am after without making a mistake. reduceExtract would also have to deal with things like And[Element[x3, Reals], Element[Alternatives[x2, y3], Reals]] that are generated by Reduce, even though constraints on x3,x2,y3 were given in exactly the same form to Reduce. I've searched old postings and searched help, trying to see if someone had described a way of doing this but I haven't found any hits. Can anyone come up with something that will do this general reduceExtract? On a different and much smaller note, it would be nice if Reduce had noticed that it had expr^(4n) of non-zero real expressions in the denominators of args to to Sqrt and pulled those outside the Sqrt as expr^(2n). Then Together would have happily made the resullting expressions smaller. Reduce knows enough to do this, it just doesn't do it. It does not appear that leaving those inside reduces the complexity measure of the expressions. But if I could have reduceExtract then I'd happily live with manually cutting and pasting to fix this detail. All this is still under 5.2, but my reading of the documentation says this still applies to 6.0. Thank you

**Re: function to check if array is empty**

**Hash Table for self avoiding random walks**

**Re: Interpolation with FourierTrigSeries with mathematica 6 tia sal2**

**Re: Want a general method to extract cases resulting from Reduce**