I have a Jacobian function:

D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}]

It gives me a matrix with the formulas I need for my transposition matrix:

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

How do I turn this into a formula that will give me values (the basis vectors) at a given value of $r$ and $\theta$? (e.g. f[{0.3,0.5}] = {{0.514496, 0.857493}, {-1.47059, 0.882353}})

  • $\begingroup$ As an aside: CoordinateTransformData["Cartesian" -> "Polar", "MappingJacobian"] returns a pure function you can evaluate on vector arguments. $\endgroup$ Nov 15, 2019 at 0:08
  • $\begingroup$ This is a teach-a-man-to-fish kind of question. But thanks for the fish! $\endgroup$
    – Quarkly
    Nov 15, 2019 at 0:19
  • $\begingroup$ Yes, that's why it's a comment and not an answer. ;) $\endgroup$ Nov 15, 2019 at 0:27
  • $\begingroup$ See, that's funny because that was the last thing the dolphins said before they left Earth. $\endgroup$
    – Quarkly
    Nov 15, 2019 at 0:57

2 Answers 2

f[x0_, y0_] := D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}] /. {x -> x0, y -> y0}

f[0.3, 0.5] // MatrixForm

enter image description here

I would caution you against using MatrixForm in the definition, as that would leave you with results that cannot be easily used in further computation.


You can write something like

f[{r_, θ_}] := 
 Module[{M = D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}]}, 
  Block[{x = r Cos[θ], y = r Sin[θ]}, M]]

I wouldn't be surprised if this has a slightly simpler formulation. The symbolic result agrees with what I expect:

Assuming[r > 0, Simplify[f[{r, θ}]]]
(* {{Cos[θ], Sin[θ]}, {-(Sin[θ]/r), Cos[θ]/r}} *)

Numerically, it doesn't agree with your expectation.

f[{0.3, 0.5}]
(* {{0.877583, 0.479426}, {-1.59809, 2.92528}} *)

I might have misunderstood...


Your Answer

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

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