2
$\begingroup$

Mathematica 12.0 gives me a result of the form

Sqrt[a b + x y z] Sqrt[-(1/(- a b - x y z))]

which obviously should simplify to 1. However, even with the assumption

Simplify[Sqrt[a b + x y z] Sqrt[-(1/(- a b - x y z))], a b + x y z > 0]

Mathematica refuses to further simplify this expression. If I set any of the five variables to one by hand (i.e. delete, for instance, all occurrences of a) then it correctly simplifies.

What is the reason for this strange behaviour and how can I get Mathematica to fully simplify square root expressions like this?

$\endgroup$
7
  • $\begingroup$ As a workaround, I can square the result and then take the square root, but I would still prefer to understand the cause of the issue. $\endgroup$
    – André
    Sep 22 '20 at 14:21
  • $\begingroup$ Try this: FullSimplify[Sqrt[a b + x y z] Sqrt[-(1/(-a b - x y z))], Element[{a, b, x, y, z}, PositiveReals]] $\endgroup$
    – flinty
    Sep 22 '20 at 14:26
  • 1
    $\begingroup$ Since it chokes on too many variables, as a workaround reduce the number of variables. expr = Sqrt[a b + x y z] Sqrt[-(1/(-a b - x y z))]; expr /. x y z :> t // Simplify[#, a b + t > 0] & $\endgroup$
    – Bob Hanlon
    Sep 22 '20 at 14:50
  • 2
    $\begingroup$ Sqrt[a b + x y z] Sqrt[-(1/(-a b - x y z)) // Simplify] // PowerExpand $\endgroup$
    – Bill Watts
    Sep 22 '20 at 17:04
  • 1
    $\begingroup$ A problem seems to be with simplifying Sign. The expression Assuming[a b + x y z > 0, Sqrt[a b + x y z] Sqrt[-(1/(-a b - x y z)) // Simplify] // ComplexExpand[#, TargetFunctions -> {Re, Im}] & // FullSimplify] with v12.1.1 evaluates to 1/Sign[a b + x y z] and the Sign is obviously 1 $\endgroup$
    – Bob Hanlon
    Sep 22 '20 at 18:48
1
$\begingroup$

The simplify work for Sqrt if we assumption that all the variables is positive real numbers.

Simplify[Sqrt[a b + x y z] Sqrt[-(1/(-a b - x y z))], 
 Assumptions -> AllTrue[{a, b, x, y, z}, Element[#, PositiveReals] &]]
$\endgroup$
6
  • $\begingroup$ But the expression should evaluate to 1 also for negative reals or even complex a, b, x, y, z, as long as (a b + x y z) is a positive real? Why is it not sufficient to give this information as an assumption? And why is it sufficient for, say, (a b + x y)? $\endgroup$
    – André
    Sep 22 '20 at 14:34
  • 1
    $\begingroup$ @André Sqrt[z] is a complex and difficult function that I could not understand completely :) $\endgroup$
    – cvgmt
    Sep 22 '20 at 14:45
  • $\begingroup$ @André except when they're all exactly zero of course, in which case it's Indeterminate $\endgroup$
    – flinty
    Sep 22 '20 at 17:35
  • $\begingroup$ Considering that Sqrt is a two valued function, you may understand that the simplification is not so simple.Therefore x is not equal to Sqrt[x^2.] $\endgroup$ Sep 22 '20 at 18:30
  • $\begingroup$ @flinty a b + x y z > 0 excludes the possibility of all of them being zero. $\endgroup$
    – André
    Sep 23 '20 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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