## calculus and analysis – Transformedfield fails on a large Piecewise function

I have the following radial form of u:

``````u(r_, phi_) :=
Piecewise({{BesselJ(1.5 r, 5)*Exp(I 5 phi),
0 < r < 1/2}, {(BesselJ(3 r, 5) + BesselY(3 r, 5))*Exp(I 5 phi),
1/2 < r < 1}, {HankelH1(r, 5)*Exp(I 5 phi), r > 1}})
``````

When I convert it to Cartesian form by

``````FullSimplify(
TransformedField("Polar" -> "Cartesian",
u(r, phi), {r, phi} -> {x, y}))
``````

I simply get a nonsense function, which I am not going to outline here.

Trying to get around this, I decompose it into parts and have:

``````uA(r_, phi_) := {BesselJ(1.5 r, 5)*Exp(I 5 phi), 0 < r < 1/2};
uB(r_, phi_) := {(BesselJ(3 r, 5) + BesselY(3 r, 5))*Exp(I 5 phi),
1/2 < r < 1};
uC(r_, phi_) := {HankelH1(r, 5)*Exp(I 5 phi), r > 1};
``````

Converting these 3 components of u in Cartesian form :

``````FullSimplify(
TransformedField("Polar" -> "Cartesian",
uA(r, phi), {r, phi} -> {x, y}))
``````

and

``````FullSimplify(
TransformedField("Polar" -> "Cartesian",
uB(r, phi), {r, phi} -> {x, y}))
``````

and

``````FullSimplify(
TransformedField("Polar" -> "Cartesian",
uC(r, phi), {r, phi} -> {x, y}))
``````

I get three outputs which have no apparent Cartesian form of the boundaries uA: 0 < r < 1/2; uB: 1/2 < r < 1 and uC:r > 1.

uA results as: $$left{frac{-y left(0

uB results as: $$left{frac{-y left(0

and uC as : $$left{frac{-y left(sqrt{x^2+y^2}>1right)+x H_{sqrt{x^2+y^2}}^{(1)}(5) e^{5 i tan ^{-1}(x,y)}}{sqrt{x^2+y^2}},frac{x left(sqrt{x^2+y^2}>1right)+y H_{sqrt{x^2+y^2}}^{(1)}(5) e^{5 i tan ^{-1}(x,y)}}{sqrt{x^2+y^2}}right}$$

The boundary is either gone or it is packed inside the function as variables, seemingly. Does anyone see an alternative? Wolfram reference has not examples on how to use boundaries of the domain inside the function for Transformation, and seemingly Transformedfield does not transform the domain definition as a one-to-one transformation.

What can be done to get this Cartesian form correctly?

Thanks

## coordinate transformation – How to troubleshoot TransformedField functionality in Mathematica?

I list up this method to transform a complex function to Cartestian form, which can be used on virtually any function:

such as:

``````u0(r_, phi_) := Sum(I^(-n) BesselJ(n, r) Exp(I n phi), {n, -5, 5});

TransformedField("Polar" -> "Cartesian",  u0(r, phi), {r, phi} -> {x, y})
``````

which yields:

``````  u0(x_, y_) :=
BesselJ(0, Sqrt(x^2 + y^2)) +
1/(x^2 + y^2)^(5/2)
2 (-I x (x^2 + y^2)^2 BesselJ(1, Sqrt(x^2 + y^2)) +
Sqrt(x^2 + y^2) (-x^4 + y^4) BesselJ(2, Sqrt(x^2 + y^2)) +
I x^5 BesselJ(3, Sqrt(x^2 + y^2)) -
2 I x^3 y^2 BesselJ(3, Sqrt(x^2 + y^2)) -
3 I x y^4 BesselJ(3, Sqrt(x^2 + y^2)) +
x^4 Sqrt(x^2 + y^2) BesselJ(4, Sqrt(x^2 + y^2)) -
6 x^2 y^2 Sqrt(x^2 + y^2) BesselJ(4, Sqrt(x^2 + y^2)) +
y^4 Sqrt(x^2 + y^2) BesselJ(4, Sqrt(x^2 + y^2)) -
I x^5 BesselJ(5, Sqrt(x^2 + y^2)) +
10 I x^3 y^2 BesselJ(5, Sqrt(x^2 + y^2)) -
5 I x y^4 BesselJ(5, Sqrt(x^2 + y^2)))
``````

or

a Hankel and Bessel function together:

``````u(r_, phi_) :=  Piecewise({{BesselJ(1.5 r, 5)*Exp(I 5 phi),
0 < r < 1/2}, {(BesselJ(3 r, 5) + BesselY(3 r, 5))*Exp(I 5 phi),
1/2 < r < 1}, {HankelH1(r, 5)*Exp(I 5 phi), r > 1}})
``````

which yields:

which yields the respective given plots, when plotted:

and

However, my supervisor thinks these plots look “strange”.

How can I verify that the TransformedField command did the right job – for such extended functions?

In other words, how to trobleshoot TransformedField?