# How can one eliminate results in which symbols are assigned constant values?

As an exercise (pertaining to my posting Perform a constrained integration over $[-1,1]^6--yielding a "separability probability"), I issued the command p = Integrate[Boole[a2 + b2 z > z^2 && a5 + b5 z > a2 + b2 z], {z, -1, 1}];  and obtained a result with LeafCount[p]=8354. Since, actually I then want to regard a2, b2, a5, b5 as multivariable expressions for further integrations, I would like to eliminate those (multitudinous) parts of the results for $$p$$ in which any of the four symbols are assigned constant values, such as those containing a2==0, as they would be of measure zero in subsequent integrations. (I've briefly tried the use of NumberQ--but that didn't accomplish the intended eliminations.) As a note with regard to the previous indicated posting, I intend to substitute for a2, the constant term of the expression--regarded as a quadratic polynomial in $$z$$--for the constraint C2 there (after its division by $$(1-t^2)$$), and for b2, the coefficient of $$z$$; and for a5, the constant term of the similarly regarded expression for the quadratic constraint C5 there [after its division by ($$u^2 (1-t^2)$$], and for b5 the coefficient of $$z$$ in it. (After these substitutions, I would attempt to proceed with the further integrations over $$y,x,w,v,t$$, incorporating the additional positivity constraints C1 and C4--which do not contain $$z$$.) The normalized forms of the constraints C2 and C5 indicated above both have their quadratic terms equal to $$-z^2$$. • I have to admit that I have a hard time understanding what you want in all of your posts (which likely reflects on me rather than you). Using the following might be an approach that can be modified to get what you want: Select[p[[1]], ! ContainsAny[#[[2]] /. And -> List, {a2 == 0, a2 == 1}] &] I know this won't work completely because if '{a2 == 0, a2 == 1, a2 == -1}' is used, then no parts of p are found. – JimB Mar 29 '19 at 15:13 ## 2 Answers This could be a start: Dimensions @ p[[1]] (* Out: {36, 2} *)  This indicates that there are 36 piecewise conditions in your original result. Now we replace those piecewise definitions whose condition contains anything of the form "symbol == number", i.e. things like a2 == 1 etc: p /. {val_, cond_} /; MemberQ[cond, _Symbol == _Integer, -1] -> Nothing; Dimensions @ %[[1]] (* Out: {7, 2} *)  That seems like a significant simplification. However, I am not sure how you want to deal with inequalities, so I left those alone for now. You should be able to expand the method to those as well though. • OK, thanks--quite sophisticated! As to inequalities, I certainly have to leave them alone. Issuing your command reduces the LeafCount from 8354 to 6157--quite impressive. I didn't know of the Nothing command--just what's needed, it seems. It would be nice to have a procedure that accomplishes the task without painfully having to go through the specific constant values that a2, say, assumes in this particular command (like the minus 1 in your example). Phooey--pressed the return inadvertently again--submitting the comment. Pressing return is OK, on the other hand, in submitting the question. – Paul B. Slater Mar 29 '19 at 15:55 • Maybe your command fully accomplishes the task--I searched through the LeafCount 6157 result for "==", and didn't find any such equality signs!! I think I initially misunderstood the use of "-1" in your command. In fact--does your command work with all integers?--I first thought it was designed just for minus 1. – Paul B. Slater Mar 29 '19 at 16:08 • A Simplify command applied to the LeafCount[6157] result gives a LeafCount of 2855. Now, I'm trying FullSimplify on that result. – Paul B. Slater Mar 29 '19 at 16:13 • @Paul It should work with all integers: the -1 is a level specification; it indicates the level in each expression at which the search is to be made. Here, that means the lowest level, i.e. level 1 counting from the bottom. – MarcoB Mar 29 '19 at 16:22 • I appear to have misspoken in my earler comment--I do now see equality "==" signs remaining in the LeafCount=6157 result, such as a5==a2, obtained after application of your command, p /. {val_, cond_} /; MemberQ[cond, _Symbol == _Integer, -1] -> Nothing; So, what I'm aiming for is a result in which no equality signs/conditions are present at all. So, it presently seems to me that the problem remains open. (I seem to have difficulties using the Edit/Find command to search for the double equality sign--it doesn't show any, even thought I can see them.) – Paul B. Slater Mar 30 '19 at 18:31 The original command in question was p = Integrate[Boole[a2 + b2 z > z^2 && a5 + b5 z > a2 + b2 z], {z, -1, 1}];  which when performed yielded a result having LeafCount[p]=8354. The application of the command of MarcoB p /. {val_, cond_} /; MemberQ[cond, _Symbol == _Integer, -1] -> Nothing; Dimensions @ %[[1]] did substantially reduce the LeafCount to 6157. But (as not as first realized in my initial comments to the answer of MarcoB), this did not remove all the equal signs--as I desire, since the eventual plan is to replace a2, b2, a5, b5 by multivariable expressions and perform further integrations (in which the equals signs would correspond to scenarios of measure zero, and unnecessarily further complicate matters). But, after trying a number of modifications of the initial command, I have found that its replacement (adding && a2 != a5 && b2 != b5 && a2 != 0 && a2 != -1 && a2 != 1  to the argument of the Boolean function) by p = Integrate[Boole[a2 + b2 z > z^2 && a5 + b5 z > a2 + b2 z&& a2 != a5 && b2 != b5 && a2 != 0 && a2 != -1 && a2 != 1], {z, -1, 1}];  yields a result with LeafCount[p]=4530, and, as far, as I can perceive, which has no embedded equalities. Now--given this result--pursuing the original problem Perform a constrained integration over$[-1,1]^6--yielding a "separability probability"

I need to make the replacements

{a2 -> (t^2 - (-1 + w^2) (-1 + x^2) + 2 v w x y + y^2 - 2 t (v w + x y) - v^2 (-1 + y^2))/(-1 + t^2)}

{a5 -> (u^4 w^2 - 2 t u v x + x^2 - 2 t u^3 w y + u^2 (-1 + t^2 + v^2 - w^2 x^2 + 2 v w x y + y^2 - v^2 y^2))/((-1 + t^2) u^2)}


and

{b2 -> (2 (-v x + t w x + t v y - w y))/(-1 + t^2), b5 -> (2 u v w + (2 x y)/u - 2 t (w x + v y))/(1 - t^2)}.


Then, it would seem that I should attempt to simplify the result, keeping in mind the constraints denoted C1, C2 and C3--in preparing for further integrations.

Also, I should investigate whether there exist further relations between a2, b2, a5, b5--under the constraint

C3 = -1 < t < 1 && -1 < v < 1 && -1 < w < 1 && -1 < x < 1 && -1 < y < 1


that can be introduced into the modified initial command given above.