I am doing some evaluations which return functions of three variables similar to the following:
Q[x_,y_,z_] = 1/2 (1 - (-1 + 2 y z + 2 x (y + z)) Abs[(
1 + 4 x^2 + 2 y (-2 + 2 y + z) + 2 x (-2 + 3 y + z))/(-1 +
2 y z + 2 x (y + z))] + (x y + (x + y) z) Abs[
2 - (4 x y)/(y z + x (y + z))])
I want to create a RegionPlot3D
of $Q-\frac{1}{2}>0$ in the region with $x,y,z \in[0,1]$, along with another constraint $x+y+z\leq1$, but notice that this function $Q$, as it is currently written, will encounter some infinity problems. For example, the point $x=y=z=0$, will lead to an infinity inside the second Abs
term, due to the xy+yz+zx
in the denominator. In practice, however, this term is premultiplied with xy+yz+zx
, so that should not actually cause an issue. For this simple example, I can just manually simplify both of the Abs
terms by taking the premultiplying factor inside the Abs
and cancel the corresponding term (also making sure I keep a Sign[]
of the term moved inside the absolute value). As an example, the first absolute value term should be
(-1 + 2 y z + 2 x (y + z)) Abs[(1 + 4 x^2 + 2 y (-2 + 2 y + z)
+ 2 x (-2 + 3 y + z))/(-1 + 2 y z + 2 x (y + z))]
= Sign[-1 + 2 y z + 2 x (y + z)] Abs[1 + 4 x^2 + 2 y (-2 + 2 y + z) + 2 x (-2 + 3 y + z)]
With these simplification, when I make a RegionPlot3D
I get no error. However, in practice the functions I am looking at have many terms of this form and it is becoming impractical to do these simplifications by hand. So, my question is, how can I tell Mathematica to do that? I have tried both Simplify
and FullSimplify
and both fail to make that simplification. Thanks!