I have a function f[x,y,z] that has a piecewise definition, i.e., its values depends on the ranges of the arguments. Now suppose I have a coordinate transformation {X[x,y,z],Y[x,y,z],Z[x,y,z]}. As a function of the new variables the ranges will be different. How can I use Mathematica to give me the ranges in the new variables?

For example, let

f[x_,y_,z_] := a HeavisideTheta[x] + b HeavisideTheta[-x].

Now consider

X[x_,y_,z_] = z(x-y)
Y[x_,y_,z_] = z(x+y)
Z[x_,y_,z_] = z

Clearly in the new variables the ranges will be different. Indeed the inverse is $(x,y,z)=\left(\frac{X+Y}{2Z},\frac{Y-X}{2Z},Z\right)$ and it is clear that $x<0$ and $x>0$ now depend on whether $Y<X$, $Y>X$ and $Z<0$ and $Z>0$.

I want a systematic way of obtaining these regions in the new coordinates using Mathematica.


1 Answer 1


You can use UnitSpet instead of HeavisideTheta and PiecewiseExpand which converts nested piecewise functions into a single piecewise function:

f[x_, y_, z_] := a UnitStep[x] + b UnitStep[-x] // PiecewiseExpand

Then you can use it like this:

f[x, y, z] /. {x -> (x + y)/(2 z), y -> (y - x)/(2 z), z -> z} // FullSimplify


f[(x + y)/(2 z), (y - x)/(2 z), z] // FullSimplify

enter image description here

You can see the new conditions in the definition: (x + y) z > 0...


Your Answer

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

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