# How do I get actual values from a Jacobian matrix?

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}})

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

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

f[0.3, 0.5] // MatrixForm 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...