2
$\begingroup$

With x, y, z all positive, how can one simplify the following expression:

    f[x_,y_,z_]=(Sqrt[1 + x - y - 
  Sqrt[(-1 + x + y)^2 + 4 z^2]] (-1 + x + y - 
   Sqrt[(-1 + x + y)^2 + 4 z^2]))/(2 Sqrt[2] z Sqrt[
 2 - (2 (-1 + x + y))/(-1 + x + y + Sqrt[(-1 + x + y)^2 + 4 z^2])])
$\endgroup$
5
$\begingroup$

You might add rationalization to the transformation functions:

xfs = {
   # /. a_ - Sqrt[b_] :> Simplify[(a^2 - b)/(a + Sqrt[b])] &,
   # /. a_ + Sqrt[b_] :> Simplify[(a^2 - b)/(a - Sqrt[b])] &
   };
ClearSystemCache[]; (* this is for testing, since simplification
                       results are chached; may be removed *)
Assuming[{x > 0, y > 0, z > 0},
 FullSimplify[f[x, y, z], 
  TransformationFunctions -> Prepend[xfs, Automatic]]
 ]
% // LeafCount

$$-\frac{z \sqrt{\frac{2 x}{\sqrt{(x+y-1)^2+4 z^2}+x+y-1}-1}}{\sqrt[4]{(x+y-1)^2+4 z^2}}$$

(* 50 *)

Addendum: Discussion of simplification

Simplification in Mathematica is treated as a discrete optimization problem. Certain tranformations are tried on some (but not all) parts of an expression with the objective of minimizing a complexity function. The some-not-all-parts and the list of transformations are a compromise between speed and quality. The default complexity function (Simplify`SimplifyCount is a slightly tweaked version of LeafCount) does not always measure complexity in the way a user wishes it would on a particular problem.

The complexity is allowed to increase a little before a sequence of transformations is rejected, and FullSimplify seems to allow the search to continue a little longer than Simplify. Sometimes the minimizing expression is unreachable because the path to it is too long or the intermediate expressions too complex. Using Simplify[] in a transformation function as above is a way to try to get over larger humps, although it can backfire if it undoes your transformation.

Aside from working harder, FullSimplify has a longer list of transformation functions than Simplify, especially ones for transcendental functions. Neither seems to try rationalization.

$\endgroup$
3
$\begingroup$

Try the following:

Step 1:

red = Reduce[
  1 + x - y - Sqrt[(-1 + x + y)^2 + 4 z^2] > 0 && 
   2 - (2 (-1 + x + y))/(-1 + x + y + Sqrt[(-1 + x + y)^2 + 4 z^2]) > 
    0]

(*  y < 1 && ((0 < x <= 
      1 - y && (-Sqrt[x - x y] < z < 0 || 
       0 < z < Sqrt[x - x y])) || (x > 1 - y && -Sqrt[x - x y] < z < 
      Sqrt[x - x y]))  *)

Step 2:

expr=Simplify[f[x, y, z], red]

(*  ((-1 + x + y - 
   Sqrt[(-1 + x + y)^2 + 
    4 z^2]) Sqrt[-((-1 - x + y + Sqrt[(-1 + x + y)^2 + 4 z^2]) (-1 + 
      x + y + Sqrt[(-1 + x + y)^2 + 4 z^2]))])/(4 z ((-1 + x + y)^2 + 
   4 z^2)^(1/4))  *)

Let us now visualize the result to better see it:

 expr// TraditionalForm

enter image description here

One can also apply PowerExpand to transform it further, if this helps:

expr//PowerExpand
(*   (I (-1 + x + y - Sqrt[(-1 + x + y)^2 + 4 z^2]) Sqrt[-1 - x + y + 
  Sqrt[(-1 + x + y)^2 + 4 z^2]] Sqrt[-1 + x + y + 
  Sqrt[(-1 + x + y)^2 + 4 z^2]])/(4 z ((-1 + x + y)^2 + 4 z^2)^(1/4))  *)
%//TraditionalForm

enter image description here

Let me comment that I have arbitrarily chosen what expressions to assume to be positive. In fact, it depends upon the nature of the problem and, therefore, it is up to you to choose the correct condition. Whatever conditions you choose to be correct, you can further act the same way I did.

Have fun!

$\endgroup$
0
$\begingroup$

try to include the one that x, y, z are greater than zero inside the expression and to finish write at the end // FullSimplify

Edit that was my original intention, but it did not produce the desired results, it was out of MMA's reach at the time I responded.

 Assuming[x > 0 && y > 0 && z > 0 ,  f[x_, y_, z_] = (Sqrt[
   1 + x - y - Sqrt[(-1 + x + y)^2 + 4 z^2]] (-1 + x + y - 
    Sqrt[(-1 + x + y)^2 + 4 z^2]))/(2 Sqrt[2] z Sqrt[
   2 - (2 (-1 + x + y))/(-1 + x + y + 
       Sqrt[(-1 + x + y)^2 + 4 z^2])])] // RootReduce
$\endgroup$
2
  • 1
    $\begingroup$ I've been wondering if you intended to complete this answer, or maybe it should have been a comment left as hint to others. Right now it's incomplete and probably wrong. I don't know how "to include...that x, y, z are greater than zero inside the expression," and until I see it, I don't think it can be done inside the expression. And the way I know how to do it cannot be combined with // FullSimplify at the end. $\endgroup$
    – Michael E2
    Sep 18 at 14:36
  • $\begingroup$ @Michael E2 ,I only tried to help, here is what I thought, but there are more optimal ways. $\endgroup$
    – zeros
    Sep 18 at 18:42

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.