0
$\begingroup$

I have noticed some odd behavior when converting from Polar < -- > Cartesian.

For example; https://math.stackexchange.com/questions/290209/diff-eq-transformation-polar-coordinates

We want to convert to polar and then back to Cartesian:

$$(x',y')=(x-y-x(x^2+y^2)+\frac{xy}{\sqrt{x^2+y^2}},x+y-y(x^2+y^2)-\frac{x^2}{\sqrt{x^2+y^2}} )$$

If we do:

  field={x-y-x(x^2+y^2)+x y/Sqrt[x^2+y^2],x+y-y(x^2+y^2)-x^2/Sqrt[x^2+y^2]}

  TransformedField[
   "Cartesian" -> "Polar", field, {x, y} -> {r, \[Theta]}]

This produces, after FullSimplify[%, Trig -> True]:

$$\left\{r-r^3,r-\sqrt{r^2} \cos (\theta )\right\}$$

Not the same result ($r'$ looks good, $\theta'$ looks odd). Question 1: Why?

When we convert this expression back (I have noticed this odd behavior with every example I have done and am trying to understand why MMA is doing this), we do:

  field = {r-r^3,r-Sqrt[r^2] Cos[\[Theta]]};

  TransformedField["Polar"->"Cartesian",field,{r,\[Theta]}->{x,y}]

This produces:

$$\left\{\frac{x \left(\sqrt{x^2+y^2}-\left(x^2+y^2\right)^{3/2}\right)}{\sqrt{x^2+y^2}}-\frac{y \left(\sqrt{x^2+y^2}-x\right)}{\sqrt{x^2+y^2}},\frac{y \left(\sqrt{x^2+y^2}-\left(x^2+y^2\right)^{3/2}\right)}{\sqrt{x^2+y^2}}+\frac{x \left(\sqrt{x^2+y^2}-x\right)}{\sqrt{x^2+y^2}}\right\}$$

Compare this to the original. Question 2: Why are those $\sqrt{x^2 + y^2}$ terms there?

$\endgroup$
  • $\begingroup$ Answer for the second question: you've made a simple mistake, what you need is TransformedField["Polar" -> "Cartesian", field, {r, \[Theta]} -> {x, y}] $\endgroup$ – xzczd Aug 29 '16 at 5:15
  • $\begingroup$ @xzczd: Sorry, that was just a copy error (corrected) - the result has the issue (or my confusion) as described. Thanks. $\endgroup$ – Moo Aug 29 '16 at 5:28
  • $\begingroup$ Since r is non-negative, you can simplify your expression in polar coordinates. $\endgroup$ – mikado Aug 29 '16 at 5:47
  • $\begingroup$ Why do we need to say $r$ is non-negative? $r = \dfrac{x}{\cos t}$, seems like it should take on any value, positive and negative. $\endgroup$ – Moo Aug 29 '16 at 5:50
  • $\begingroup$ Well, generally it's not rare to see those symbolic transformation functions not producing the simplest form of the results. As to the question in the comment: just compare the result of TransformedField["Cartesian" -> "Polar", field, {x, y} -> {r, \[Theta]}] /. r -> -1 // Simplify and Simplify[TransformedField["Cartesian" -> "Polar", field, {x, y} -> {r, \[Theta]}], r > 0] /. r -> -1 $\endgroup$ – xzczd Aug 29 '16 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.