summaryrefslogtreecommitdiff
path: root/source/know/concept/spherical-coordinates/index.md
blob: 01c5a61a34f66827440e55ba0d6b8be98bdc386a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
---
title: "Spherical coordinates"
sort_title: "Spherical coordinates"
date: 2021-03-04
categories:
- Mathematics
- Physics
layout: "concept"
---

**Spherical coordinates** are an extension of polar coordinates $$(r, \varphi)$$ to 3D.
The position of a given point in space is described by
three variables $$(r, \theta, \varphi)$$, defined as:

*   $$r$$: the **radius** or **radial distance**: distance to the origin.
*   $$\theta$$: the **elevation**, **polar angle** or **colatitude**:
    angle to the positive $$z$$-axis, or **zenith**, i.e. the "north pole".
*   $$\varphi$$: the **azimuth**, **azimuthal angle** or **longitude**:
    angle from the positive $$x$$-axis, typically in the counter-clockwise sense.

Note that this is the standard notation among physicists,
but mathematicians often switch the definitions of $$\theta$$ and $$\varphi$$,
while still writing $$(r, \theta, \varphi)$$.

Cartesian coordinates $$(x, y, z)$$ and the spherical system
$$(r, \theta, \varphi)$$ are related by:

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            x &= r \sin\theta \cos\varphi \\
            y &= r \sin\theta \sin\varphi \\
            z &= r \cos\theta
        \end{aligned}
    }
\end{aligned}$$

Conversely, a point given in $$(x, y, z)$$
can be converted to $$(r, \theta, \varphi)$$ using these formulae,
where $$\mathtt{atan2}$$ is the 2-argument arctangent,
which is needed to handle the signs correctly:

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            r
            &= \sqrt{x^2 + y^2 + z^2}
            \\
            \theta
            &= \arccos(z / r)
            \\
            \varphi
            &= \mathtt{atan2}(y, x)
        \end{aligned}
    }
\end{aligned}$$

Spherical coordinates form
an [orthogonal curvilinear system](/know/concept/orthogonal-curvilinear-coordinates/),
whose **scale factors** $$h_r$$, $$h_\theta$$ and $$h_\varphi$$ we need.
To get those, we calculate the unnormalized local basis:

$$\begin{aligned}
    h_r \vu{e}_r
    &= \vu{e}_x \pdv{x}{r} + \vu{e}_y \pdv{y}{r} + \vu{e}_z \pdv{z}{r}
    \\
    &= \vu{e}_x \sin{\theta} \cos{\varphi} + \vu{e}_y \sin{\theta} \sin{\varphi} + \vu{e}_z \cos{\theta}
    \\
    h_\theta \vu{e}_\theta
    &= \vu{e}_x \pdv{x}{\theta} + \vu{e}_y \pdv{y}{\theta} + \vu{e}_z \pdv{z}{\theta}
    \\
    &= \vu{e}_x \: r \cos{\theta} \cos{\varphi} + \vu{e}_y \: r \cos{\theta} \sin{\varphi} - \vu{e}_z \: r \sin{\theta}
    \\
    h_\varphi \vu{e}_\varphi
    &= \vu{e}_x \pdv{x}{\varphi} + \vu{e}_y \pdv{y}{\varphi} + \vu{e}_z \pdv{z}{\varphi}
    \\
    &= - \vu{e}_x \: r \sin{\theta} \sin{\varphi} + \vu{e}_y \: r \sin{\theta} \cos{\varphi}
\end{aligned}$$

By normalizing the **local basis vectors**
$$\vu{e}_r$$, $$\vu{e}_\theta$$ and $$\vu{e}_\varphi$$,
we arrive at these expressions:

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            h_r
            &= 1
            \\
            h_\theta
            &= r
            \\
            h_\varphi
            &= r \sin{\theta}
        \end{aligned}
    }
    \qquad\qquad
    \boxed{
        \begin{aligned}
            \vu{e}_r
            &= \vu{e}_x \sin{\theta} \cos{\varphi} + \vu{e}_y \sin{\theta} \sin{\varphi} + \vu{e}_z \cos{\theta}
            \\
            \vu{e}_\theta
            &= \vu{e}_x \cos{\theta} \cos{\varphi} + \vu{e}_y \cos{\theta} \sin{\varphi} - \vu{e}_z \sin{\theta}
            \\
            \vu{e}_\varphi
            &= - \vu{e}_x \sin{\varphi} + \vu{e}_y \cos{\varphi}
        \end{aligned}
    }
\end{aligned}$$

Thanks to these scale factors, we can easily convert calculus from the Cartesian system
using the standard formulae for orthogonal curvilinear coordinates.





## Differential elements

For line integrals,
the tangent vector element $$\dd{\vb{\ell}}$$ for a curve is as follows:

$$\begin{aligned}
    \boxed{
        \dd{\vb{\ell}}
        = \vu{e}_r \dd{r}
        + \: \vu{e}_\theta \: r \dd{\theta}
        + \: \vu{e}_\varphi \: r \sin{\theta} \dd{\varphi}
    }
\end{aligned}$$

For surface integrals,
the normal vector element $$\dd{\vb{S}}$$ for a surface is given by:

$$\begin{aligned}
    \boxed{
        \dd{\vb{S}}
        = \vu{e}_r \: r^2 \sin{\theta} \dd{\theta} \dd{\varphi}
        + \: \vu{e}_\theta \: r \sin{\theta} \dd{r} \dd{\varphi}
        + \: \vu{e}_\varphi \: r \dd{r} \dd{\theta}
    }
\end{aligned}$$

And for volume integrals,
the infinitesimal volume $$\dd{V}$$ takes the following form:

$$\begin{aligned}
    \boxed{
        \dd{V}
        = r^2 \sin{\theta} \dd{r} \dd{\theta} \dd{\varphi}
    }
\end{aligned}$$



## Common operations

The basic vector operations (gradient, divergence, curl and Laplacian) are given by:

$$\begin{aligned}
    \boxed{
        \nabla f
        = \vu{e}_r \pdv{f}{r}
        + \vu{e}_\theta \frac{1}{r} \pdv{f}{\theta} + \mathbf{e}_\varphi \frac{1}{r \sin{\theta}} \pdv{f}{\varphi}
    }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \nabla \cdot \vb{V}
        = \pdv{V_r}{r} + \frac{2}{r} V_r
        + \frac{1}{r} \pdv{V_\theta}{\theta} + \frac{\cot{\theta}}{r} V_\theta
        + \frac{1}{r \sin\theta} \pdv{V_\varphi}{\varphi}
    }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            \nabla \times \vb{V}
            &= \quad \vu{e}_r \bigg( \frac{1}{r} \pdv{V_\varphi}{\theta} + \frac{\cot{\theta}}{r} V_\varphi
            - \frac{1}{r \sin{\theta}} \pdv{V_\theta}{\varphi} \bigg)
            \\
            &\quad\: + \vu{e}_\theta \bigg( \frac{1}{r \sin{\theta}} \pdv{V_r}{\varphi}
            - \pdv{V_\varphi}{r} - \frac{V_\varphi}{r} \bigg)
            \\
            &\quad\: + \vu{e}_\varphi \bigg( \pdv{V_\theta}{r} + \frac{V_\theta}{r}
            - \frac{1}{r} \pdv{V_r}{\theta} \bigg)
        \end{aligned}
    }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \nabla^2 f
        = \pdvn{2}{f}{r} + \frac{2}{r} \pdv{f}{r}
        + \frac{1}{r^2} \pdvn{2}{f}{\theta} + \frac{\cot{\theta}}{r^2} \pdv{f}{\theta}
        + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{f}{\varphi}
    }
\end{aligned}$$



## Uncommon operations

Uncommon operations include:
the gradient of a divergence $$\nabla (\nabla \cdot \vb{V})$$,
the gradient of a vector $$\nabla \vb{V}$$,
the advection of a vector $$(\vb{U} \cdot \nabla) \vb{V}$$ with respect to $$\vb{U}$$,
the Laplacian of a vector $$\nabla^2 \vb{V}$$,
and the divergence of a 2nd-order tensor $$\nabla \cdot \overline{\overline{\vb{T}}}$$:

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            \nabla (\nabla \cdot \vb{V})
            &= \quad \vu{e}_r \bigg( \pdvn{2}{V_r}{r} + \frac{1}{r} \mpdv{V_\theta}{r}{\theta} + \frac{1}{r \sin{\theta}} \mpdv{V_\varphi}{\varphi}{r}
            + \frac{2}{r} \pdv{V_r}{r} - \frac{1}{r^2} \pdv{V_\theta}{\theta}
            \\
            &\qquad\qquad - \frac{1}{r^2 \sin{\theta}} \pdv{V_\varphi}{\varphi}
            + \frac{\cot{\theta}}{r} \pdv{V_\theta}{r} - \frac{2}{r^2} V_r - \frac{\cot{\theta}}{r^2} V_\theta \bigg)
            \\
            &\quad\: + \vu{e}_\theta \bigg( \frac{1}{r} \mpdv{V_r}{\theta}{r} + \frac{1}{r^2} \pdvn{2}{V_\theta}{\theta}
            + \frac{1}{r^2 \sin{\theta}} \mpdv{V_\varphi}{\theta}{\varphi} + \frac{2}{r^2} \pdv{V_r}{\theta}
            \\
            &\qquad\qquad + \frac{\cot{\theta}}{r^2} \pdv{V_\theta}{\theta}
            - \frac{\cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\varphi}{\varphi} - \frac{V_\theta}{r^2 \sin^2{\theta}} \bigg)
            \\
            &\quad\: + \vu{e}_\varphi \bigg( \frac{1}{r \sin{\theta}} \mpdv{V_r}{\varphi}{r} + \frac{1}{r^2 \sin{\theta}} \mpdv{V_\theta}{\varphi}{\theta}
            + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_\varphi}{\varphi}
            \\
            &\qquad\qquad + \frac{2}{r^2 \sin{\theta}} \pdv{V_r}{\varphi} + \frac{\cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\theta}{\varphi} \bigg)
        \end{aligned}
    }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            \nabla \vb{V}
            &= \quad \vu{e}_r \vu{e}_r \pdv{V_r}{r} + \vu{e}_r \vu{e}_\theta \pdv{V_\theta}{r} + \vu{e}_r \vu{e}_\varphi \pdv{V_\varphi}{r}
            \\
            &\quad\: + \vu{e}_\theta \vu{e}_r \bigg( \frac{1}{r} \pdv{V_r}{\theta} - \frac{V_\theta}{r} \bigg)
            + \vu{e}_\theta \vu{e}_\theta \bigg( \frac{1}{r} \pdv{V_\theta}{\theta} + \frac{V_r}{r} \bigg)
            + \vu{e}_\theta \vu{e}_\varphi \frac{1}{r} \pdv{V_\varphi}{\theta}
            \\
            &\quad\: + \vu{e}_\varphi \vu{e}_r \bigg( \frac{1}{r \sin{\theta}} \pdv{V_r}{\varphi} - \frac{V_\varphi}{r} \bigg)
            + \vu{e}_\varphi \vu{e}_\theta \bigg( \frac{1}{r \sin{\theta}} \pdv{V_\theta}{\varphi} - \frac{\cot{\theta}}{r} V_\varphi \bigg)
            \\
            &\quad\: + \vu{e}_\varphi \vu{e}_\varphi
            \bigg( \frac{1}{r \sin{\theta}} \pdv{V_\varphi}{\varphi} + \frac{V_r}{r} + \frac{\cot{\theta}}{r} V_\theta \bigg)
        \end{aligned}
        }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            (\vb{U} \cdot \nabla) \vb{V}
            &= \quad \vu{e}_r \bigg( U_r \pdv{V_r}{r} + \frac{U_\theta}{r} \pdv{V_r}{\theta}
            + \frac{U_\varphi}{r \sin{\theta}} \pdv{V_r}{\varphi} - \frac{U_\theta V_\theta}{r} - \frac{U_\varphi V_\varphi}{r} \bigg)
            \\
            &\quad\: + \vu{e}_\theta \bigg( U_r \pdv{V_\theta}{r} + \frac{U_\theta}{r} \pdv{V_\theta}{\theta}
            + \frac{U_\varphi}{r \sin{\theta}} \pdv{V_\theta}{\varphi} + \frac{U_\theta V_r}{r} - \frac{\cot{\theta}}{r} U_\varphi V_\varphi \bigg)
            \\
            &\quad\: + \vu{e}_\varphi \bigg( U_r \pdv{V_\varphi}{r} + \frac{U_\theta}{r} \pdv{V_\varphi}{\theta}
            + \frac{U_\varphi}{r \sin{\theta}} \pdv{V_\varphi}{\varphi} + \frac{U_\varphi V_r}{r} + \frac{\cot{\theta}}{r} U_\varphi V_\theta \bigg)
        \end{aligned}
    }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            \nabla^2 \vb{V}
            &= \quad\: \vu{e}_r \bigg( \pdvn{2}{V_r}{r} + \frac{1}{r^2} \pdvn{2}{V_r}{\theta} + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_r}{\varphi}
            + \frac{2}{r} \pdv{V_r}{r} + \frac{\cot{\theta}}{r^2} \pdv{V_r}{\theta}
            \\
            &\qquad\qquad - \frac{2}{r^2} \pdv{V_\theta}{\theta} - \frac{2}{r^2 \sin{\theta}} \pdv{V_\varphi}{\varphi}
            - \frac{2}{r^2} V_r - \frac{2 \cot{\theta}}{r^2} V_\theta \bigg)
            \\
            &\quad\: + \vu{e}_\theta \bigg( \pdvn{2}{V_\theta}{r} + \frac{1}{r^2} \pdvn{2}{V_\theta}{\theta}
            + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_\theta}{\varphi} + \frac{2}{r^2} \pdv{V_r}{\theta} + \frac{2}{r} \pdv{V_\theta}{r}
            \\
            &\qquad\qquad + \frac{\cot{\theta}}{r^2} \pdv{V_\theta}{\theta}
            - \frac{2 \cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\varphi}{\varphi} - \frac{V_\theta}{r^2 \sin^2{\theta}} \bigg)
            \\
            &\quad\: + \vu{e}_\varphi \bigg( \pdvn{2}{V_\varphi}{r} + \frac{1}{r^2} \pdvn{2}{V_\varphi}{\theta}
            + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_\varphi}{\varphi} + \frac{2}{r^2 \sin{\theta}} \pdv{V_r}{\varphi}
            \\
            &\qquad\qquad + \frac{2 \cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\theta}{\varphi}
            + \frac{2}{r} \pdv{V_\varphi}{r} + \frac{\cot{\theta}}{r^2} \pdv{V_\varphi}{\theta}
            - \frac{V_\varphi}{r^2 \sin^2{\theta}} \bigg)
        \end{aligned}
    }
\end{aligned}$$

$$\begin{aligned}
    \boxed{
        \begin{aligned}
            \nabla \cdot \overline{\overline{\mathbf{T}}}
            &= \quad \vu{e}_r \bigg( \pdv{T_{rr}}{r} + \frac{1}{r} \pdv{T_{\theta r}}{\theta} + \frac{1}{r \sin{\theta}} \pdv{T_{\varphi r}}{\varphi}
            \\
            &\qquad\qquad + \frac{2}{r} T_{rr} + \frac{\cot{\theta}}{r} T_{\theta r} - \frac{T_{\theta \theta}}{r} - \frac{T_{\varphi \varphi}}{r} \bigg)
            \\
            &\quad\: + \vu{e}_\theta \bigg(\pdv{T_{r \theta}}{r} + \frac{1}{r} \pdv{T_{\theta \theta}}{\theta}
            + \frac{1}{r \sin{\theta}} \pdv{T_{\varphi \theta}}{\varphi}
            \\
            &\qquad\qquad + \frac{2}{r} T_{r \theta} + \frac{T_{\theta r}}{r}
            + \frac{\cot{\theta}}{r} T_{\theta \theta} - \frac{\cot{\theta}}{r} T_{\varphi \varphi} \bigg)
            \\
            &\quad\: + \vu{e}_\varphi \bigg( \pdv{T_{r \varphi}}{r} + \frac{1}{r} \pdv{T_{\theta \varphi}}{\theta}
            + \frac{1}{r \sin{\theta}} \pdv{T_{\varphi \varphi}}{\varphi}
            \\
            &\qquad\qquad + \frac{2}{r} T_{r \varphi} + \frac{\cot{\theta}}{r} T_{\theta \varphi}
            + \frac{T_{\varphi r}}{r} + \frac{\cot{\theta}}{r} T_{\varphi \theta} \bigg)
        \end{aligned}
    }
\end{aligned}$$



## References
1.  M.L. Boas,
    *Mathematical methods in the physical sciences*, 2nd edition,
    Wiley.
2.  B. Lautrup,
    *Physics of continuous matter: exotic and everyday phenomena in the macroscopic world*, 2nd edition,
    CRC Press.