# How to calculate matrix divergence in polar coordinates

How to calculate the divergence of the following matrices in polar coordinates:

$$\left( \begin{array}{cc} \sigma \rho (r,\varphi ) & \tau (r,\varphi ) \\ \tau (r,\varphi ) & \sigma \varphi (r,\varphi ) \\ \end{array} \right)$$

I know that his calculation results in Mathematica are as follows:

But I don't know how to get the above results manually. Can you help me solve this problem or provide relevant references ?

I have a similar question here.

I have seen similar questions in this post, but his answer is too abstract, I want to specifically solve the divergence of my stress function matrix. It is best to give a complete and detailed process.


A similar argument can be made to show that the components of a vector $$\vv$$ in the different bases are related by \begin{align*} \vv' &= \MM \vv, \tag{2} \end{align*} where $$\vv$$ and $$\vv'$$ are the vectors whose components are in the natural and primed bases, respectively. (We assume that $$\MM=\MM(x',y')$$.)

We write the divergence in the primed basis as $$[\dv\ms]'$$. Note that this quantity is a vector, and so transforms as indicated in (2). Thus, \begin{align*} [\dv\ms]' &= \MM[\dv\ms]_{(x,y)\ra(x',y')} \\ &= \MM[\dv(\MM^T\ms' \MM)_{(x',y')\ra(x,y)}]_{(x,y)\ra(x',y')}. \end{align*}

For this problem we have \begin{align*} [\dv\ms]' &= \MM[\dv(\MM^T\ms' \MM)_{(\r,\f)\ra(x,y)}]_{(x,y)\ra(\r,\f)}.\tag{3} \end{align*} Note that \begin{align*} \ve_\r &= \cos\f \,\ve_x + \sin\f \,\ve_y \\ \ve_\f &= -\sin\f \,\ve_x + \cos\f \,\ve_y. \end{align*} (This basis is orthonormal by inspection.) This implies, for example, that $$M_{\r x} = \ve_\r^T \ve_x = \cvc{\cos\f}{\sin\f} \vc{1}{0} = \cos\f.$$ Calculating the other components, one finds $$\MM = \mt{\cos\f}{\sin\f}{-\sin\f}{\cos\f}$$ or $$\MM_{(\r,\f)\ra(x,y)} = \frac{1}{\sqrt{x^2+y^2}} \mt{x}{y}{-y}{x}.$$ Note also that $$[\ms'(\r,\f)]_{(\r,\f)\ra(x,y)} = \ms'(\sqrt{x^2+y^2},\arctan y/x).$$ It is now a straightforward, if tedious, task to work out the correct form for $$[\dv\ms]'$$.

(* mma code to check (3) *)

fs[foo_] := FullSimplify[foo, {r > 0, -Pi < f < Pi}];
rpc = {r -> Sqrt[x^2 + y^2], f -> ArcTan[x, y]};
rcp = {x -> r Cos[f], y -> r Sin[f]};
Apolar = {{srr[r, f], srf[r, f]}, {sfr[r, f], sff[r, f]}};
M = {{Cos[f], Sin[f]}, {-Sin[f], Cos[f]}};
Mt = Transpose[M];

M //. rpc // fs
Apolar[[1]][[1]] //. rpc
(* out: [a check on some relations above] *)

ansmma = Div[Apolar, {r, f}, "Polar"] // fs
(* out: [divergence according to mma] *)

ans = M.Div[Mt.Apolar.M //. rpc, {x, y}, "Cartesian"] //. rcp // fs
(* out: [divergence using (3)] *)

ans == ansmma // fs
(* out: True *)

• Thank you very much. Can you continue to write down the whole process of getting the divergence of $\left( \begin{array}{cc} \sigma \rho (r,\varphi ) & \tau (r,\varphi ) \\ \tau (r,\varphi ) & \sigma \varphi (r,\varphi ) \\ \end{array} \right)$ in polar coordinates? – Please correct GrammarMistakes Jul 27 '20 at 1:48
• I am glad to help. I should have some time tomorrow to add some more details. – user26872 Jul 27 '20 at 2:00
• Thank you very much for your help. – Please correct GrammarMistakes Jul 27 '20 at 23:47
• And thank you for the interesting question! – user26872 Jul 28 '20 at 1:05