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$ Commented Sep 22, 2020 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$ Commented Sep 22, 2020 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$ Commented Sep 22, 2020 at 14:50
  • 2
    $\begingroup$ Sqrt[a b + x y z] Sqrt[-(1/(-a b - x y z)) // Simplify] // PowerExpand $\endgroup$ Commented Sep 22, 2020 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$ Commented Sep 22, 2020 at 18:48

1 Answer 1

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$ Commented Sep 22, 2020 at 14:34
  • 1
    $\begingroup$ @André Sqrt[z] is a complex and difficult function that I could not understand completely :) $\endgroup$ Commented Sep 22, 2020 at 14:45
  • $\begingroup$ @André except when they're all exactly zero of course, in which case it's Indeterminate $\endgroup$ Commented Sep 22, 2020 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$ Commented Sep 22, 2020 at 18:30
  • $\begingroup$ @flinty a b + x y z > 0 excludes the possibility of all of them being zero. $\endgroup$ Commented Sep 23, 2020 at 5:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.