I have the following problem. Consider expression
f=Sqrt[(x-2y)^2]
There is an obvious ambiguity in the definition of f
related to multivaluedness of the square root. Two possible interpretations for f
are $x-2y$ or $2y-x$.
My needs require to work with power series expansions of expressions like f
. When asked to perform a series expansion Mathematica automatically chooses a branch
Series[f, {x, 0, 1}, {y, 0, 1}] // Normal
(* -x + 2 y *)
I'm OK with that since I can adjust the sign of the square root manually and use -f
instead of f
if needed. The problem is that Mathematica is not consistent in her choice. For example, evaluate
Series[f, {y, 0, 1}, {x, 0, 1}] // Normal
(* x - 2 y *)
now it's the other branch!
In a real task I have a quite complicated function depending on many parameters under the square root. When I work with its series expansions naively, as described above, things just go wrong. How can the problem be handled?
Any help is appreciated!