2
$\begingroup$

I'm using Reduce to verify some inequalities on vectors. I understand that the mathematical part of my computation is not important in this context, so I'll just show you the commands I want to execute in Mathematica.

I need to execute some Reduce commands concerning many variables. The following command

Reduce[{2 (1 + (-1 + a) s) (a^2 s u x - b^2 s x^2 + b (-1 + s) x (u +x) 
+ c (-1 + s - c s) y^2 + a (-(-1 + s + b s) u x + (1 + (-1 + b) s) x^2 
+ (1+ (-1 + c) s) y^2)) < 0 && a >= b && a >= c && a >= 0 && b >= 0 && 
c >= 0&& u > 0 && x > 0 && y > 0 && 0 < s < 1}, {a, b, c, u, x, y}]

gives the output "False" which is what I expect.

Unfortunately, adding one other variable $t$ and making an inequality more complicated, Mathematica isn't able anymore to compute the result of Reduce. In particular I'm referring to the following Reduce:

Reduce[{D[(1 + s (a - 1))^2, s]*(((1 + s (a - 1)) + x + 
s ((-1 + b) x Cos[t]^2 + (b - c) y Cos[t] Sin[t] + (-1 + c) x 
Sin[t]^2))^2 + (y + s ((-1 + c) y Cos[t]^2 + (b - c) x Cos[t] Sin[
t] + (-1 + b) y Sin[t]^2))^2) + (1 + s (a - 1))^2*D[((1 + s (a - 1)) + 
x + s ((-1 + b) x Cos[t]^2 + (b - c) y Cos[t] Sin[t] + (-1 + c) x 
Sin[t]^2))^2 + (y + s ((-1 + c) y Cos[t]^2 + (b - c) x Cos[t] Sin[t]
+ (-1 + b) y Sin[t]^2))^2, s] < 0 && a >= b && a >= c && b >= 0 && 
c >= 0 && x > 0 && y > 0 && 0 < t < 2*Pi && 0 < s < 1}, {a, b,c,t,x,y}]

I'm expecting (or hoping) the output "False", but Mathematica isn't able to finish computations within a reasonable time.

Do you know how can I make Mathematica solve my second Reduce? Maybe using another command instead of Reduce?

Thank you!

$\endgroup$

1 Answer 1

1
$\begingroup$

Reduce with a large number of variables is notoriously slow and sometimes the order of the variables makes a huge difference. One way to handle these problems is to use TimeConstrained computations to abort the cases where Mathematica is taking too long. For example, we can use the following function to cycle through all permutations of the variables

ALTREDUCE[EXP_, VARS_, TIME_] := 
 First@Sort[
   Select[ParallelMap[TimeConstrained[Reduce[EXP, #], TIME] &, 
    Permutations[VARS]], # =!= $Aborted &], 
      Simplify`SimplifyCount[#1] < Simplify`SimplifyCount[#2] &]

For example, try

ALTREDUCE[x > 0 && y > 0 && x + y^2 <= 1 && x + 2 y^2 <= 1, {x, y}, 1]

I am not sure if this will solve your problem, but is an approach that I have used in cases reduce is taking too long.

$\endgroup$
2
  • $\begingroup$ Doesn't this simply add more conditions to Reduce? If I understand correctly this doesn't solve my problem $\endgroup$
    – User28341
    Jul 15, 2017 at 9:19
  • $\begingroup$ What ALTREDUCE does is that attempts to reduce EXP using all possible orders of VARS and aborts each computation if it takes too long. There may be a particular order in which the expression is faster to reduce and becomes simpler $\endgroup$ Jul 16, 2017 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.