1
$\begingroup$

I am new to Mathematica so I could really use your help.

I am hoping to figure out the condition that the following function is larger than 0.

I tried to FullSimplify it and to simplify it myself based on my assumption of the ranges of the variable, but the input still runs forever (more than a day). So my question is that are there any ways I can get the answer faster?

The way I do it now is to set it to 0 and solve it (for r, specifically) as below. Is there a way I can also tell Mathematica the ranges of my variables and their relationships (e.g. r>c)?

Many thanks!

Solve[(-a^3 r (c (8 + (-7 + c) c) + (-2 + 
        c (-5 + c + 2 c^2)) r + (5 + 3 (-2 + c) c) r^2) + 
  c^2 (1 + c) (-1 + r) r ((-1 + c^2) r + 
     Sqrt[(-1 + 
        c) r (4 a (a (-2 + c) + c) + (2 a + (-1 + c) (1 + c)^2 - 
           2 a c (2 + c) + a^2 (-1 + 5 c)) r)]) + 
  a (c^5 r + c^4 (3 - 2 r) r^2 + 
     r^2 (r - 
        Sqrt[(-1 + 
           c) r (4 a (a (-2 + c) + 
              c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
              a^2 (-1 + 5 c)) r)]) - 
     c r (-3 + 4 r) (-r + 
        Sqrt[(-1 + 
           c) r (4 a (a (-2 + c) + 
              c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
              a^2 (-1 + 5 c)) r)]) + 
     c^3 (Sqrt[(-1 + 
           c) r (4 a (a (-2 + c) + 
              c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
              a^2 (-1 + 5 c)) r)] + r (-3 + (7 - 6 r) r)) + 
     c^2 r (2 Sqrt[(-1 + 
            c) r (4 a (a (-2 + c) + 
               c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
               a^2 (-1 + 5 c)) r)] + 
        r (-3 + r - 
           Sqrt[(-1 + 
              c) r (4 a (a (-2 + c) + 
                c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
                a^2 (-1 + 5 c)) r)]))) + 
  a^2 (-2 c^4 r - 
     c (-1 + r) r Sqrt[(-1 + 
         c) r (4 a (a (-2 + c) + c) + (2 a + (-1 + c) (1 + c)^2 - 
            2 a c (2 + c) + a^2 (-1 + 5 c)) r)] + 
     c^3 r (-5 + r + 4 r^2) - 
     c^2 (Sqrt[(-1 + 
           c) r (4 a (a (-2 + c) + 
              c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
              a^2 (-1 + 5 c)) r)] + r (-11 + (11 - 4 r) r)) + 
     r (-2 Sqrt[(-1 + 
            c) r (4 a (a (-2 + c) + 
               c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
               a^2 (-1 + 5 c)) r)] + 
        r (2 - 4 r + 
           3 Sqrt[(-1 + 
               c) r (4 a (a (-2 + c) + 
                c) + (2 a + (-1 + c) (1 + c)^2 - 2 a c (2 + c) + 
                a^2 (-1 + 5 c)) r)]))))/(2 a c + 3 r + 
  a (-3 + c) r - c^2 (2 + r) + 
  Sqrt[(-1 + 
     c) r (4 a (a (-2 + c) + c) + (2 a + (-1 + c) (1 + c)^2 - 
        2 a c (2 + c) + a^2 (-1 + 5 c)) r)]) == 0,r] // FullSimplify 
$\endgroup$
2
  • 2
    $\begingroup$ You have BigNumerator/MediumDenominator==0 and denominators make problems harder. You could try solving BigNumerator==0 and check afterwards that the solution doesn't also make MediumDenominator==0 That should help, but I'm not sure it will help enough. $\endgroup$
    – Bill
    Commented Mar 3 at 4:23
  • $\begingroup$ Thank you for your sharing! It does make a lot of sense! $\endgroup$
    – C. K
    Commented Mar 3 at 13:17

1 Answer 1

3
$\begingroup$
$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"]

Use Reduce and add constraints as below; don't use FullSimplify (too slow). Tighter constraints might help.

AbsoluteTiming[
 sol = Reduce[{(-a^3  r  (c  (8 + (-7 + c)  c) + (-2 + 
                c  (-5 + c + 2  c^2))  r + (5 + 3  (-2 + c)  c)  r^2) + 
          c^2  (1 + c)  (-1 + r)  r  ((-1 + c^2)  r + 
             Sqrt[(-1 + 
                 c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)]) + 
          a  (c^5  r + c^4  (3 - 2  r)  r^2 + 
             r^2  (r - 
                Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)]) - 
             c  r  (-3 + 4  r)  (-r + 
                Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)]) + 
             c^3  (Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)] + r  (-3 + (7 - 6  r)  r)) + 
             c^2  r  (2  Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)] + 
                r  (-3 + r - 
                   Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)]))) + 
          a^2  (-2  c^4  r - 
             c  (-1 + r)  r  Sqrt[(-1 + 
                  c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)] + c^3  r  (-5 + r + 4  r^2) - 
             c^2  (Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)] + r  (-11 + (11 - 4  r)  r)) + 
             r  (-2  Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)] + 
                r  (2 - 4  r + 
                   3  Sqrt[(-1 + 
                    c)  r  (4  a  (a  (-2 + c) + 
                    c) + (2  a + (-1 + c)  (1 + c)^2 - 2  a  c  (2 + c) + 
                    a^2  (-1 + 5  c))  r)]))))/(2  a  c + 3  r + 
          a  (-3 + c)  r - c^2  (2 + r) + 
          Sqrt[(-1 + 
              c)  r  (4  a  (a  (-2 + c) + c) + (2  a + (-1 + c)  (1 + c)^2 - 
                 2  a  c  (2 + c) + a^2  (-1 + 5  c))  r)]) > 0, r > c, 
      a ∈ Reals}, r] // Simplify;]

(* {425.306, Null} *)

LeafCount@sol

(* 286260 *)
$\endgroup$
3
  • $\begingroup$ Thank you, Bob! I am using Reduce now as you suggested to try to solve that, but one problem is that when I did not include the constraints (e.g. r>c) I did get a result (a really really long one, more than 100mb) after a few minute. However, when I included several constraints, it took much longer and has not given me a result yet after a few hours. Isn't adding constraints supposed to speed up the calculation? $\endgroup$
    – C. K
    Commented Mar 3 at 15:15
  • $\begingroup$ I suspect constraints have a case-by-case effect. Adding constraints may enable discarding some paths in the process and speed up the solution. Or as they spawn additional paths to be tracked and analyzed, slow the solution down. $\endgroup$
    – Bob Hanlon
    Commented Mar 3 at 16:24
  • $\begingroup$ Thank you very much. Your replies really helps me to code and to think! $\endgroup$
    – C. K
    Commented Mar 3 at 16:31

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.