1
$\begingroup$

I have the following code:

1/2 (Sqrt[(-4 + x1) x1] + Sqrt[-4 + x1] Sqrt[x1]) //Simplify[#, {x1 < 0, (-4 + x1) < 0}] &

Sqrt[x] Sqrt[ y] + Sqrt[x y] // Simplify[#, {x < 0, y < 0}] &

which give respectively

1/2 (Sqrt[-4 + x1] Sqrt[x1] + Sqrt[(-4 + x1) x1]) 

and

0

Why in one case mathematica recognise a simplification and in the other not?

$\endgroup$
2
  • 1
    $\begingroup$ Seems to be an issue of the default ComplexityFunction giving too high complexities for the intermediate expressions in the first case. You can use e.g. ComplexityFunction -> (Count[#, Power[_, 1/2], All] &) to devalue square roots, which makes Simplify return 0 in both examples. You can also use `ComplexityFunction -> (100 Count[#, Power[_, 1/2], All] + LeafCount[#] &) as a more general complexity function that just gives a high penalty to square roots. $\endgroup$
    – Lukas Lang
    Apr 27, 2019 at 9:57
  • $\begingroup$ Related: Can't simplify Abs[a*Cos[x]]^2 $\endgroup$
    – Lukas Lang
    Apr 27, 2019 at 10:04

0

Your Answer

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

Browse other questions tagged or ask your own question.