From 9d741c2c762d8b629cef5ac5fbc26ca44c345a77 Mon Sep 17 00:00:00 2001 From: Prefetch Date: Fri, 5 Mar 2021 16:41:32 +0100 Subject: Expand knowledge base --- .../know/concept/curvilinear-coordinates/index.pdc | 350 +++++++++++++++++++++ content/know/concept/lagrange-multiplier/index.pdc | 4 +- .../parabolic-cylindrical-coordinates/index.pdc | 188 +++++++++++ content/know/concept/pulay-mixing/index.pdc | 21 +- .../know/concept/spherical-coordinates/index.pdc | 214 +++++++++++++ 5 files changed, 769 insertions(+), 8 deletions(-) create mode 100644 content/know/concept/curvilinear-coordinates/index.pdc create mode 100644 content/know/concept/parabolic-cylindrical-coordinates/index.pdc create mode 100644 content/know/concept/spherical-coordinates/index.pdc (limited to 'content/know/concept') diff --git a/content/know/concept/curvilinear-coordinates/index.pdc b/content/know/concept/curvilinear-coordinates/index.pdc new file mode 100644 index 0000000..e1c0465 --- /dev/null +++ b/content/know/concept/curvilinear-coordinates/index.pdc @@ -0,0 +1,350 @@ +--- +title: "Curvilinear coordinates" +firstLetter: "C" +publishDate: 2021-03-03 +categories: +- Mathematics +- Physics + +date: 2021-03-03T19:47:34+01:00 +draft: false +markup: pandoc +--- + +# Curvilinear coordinates + +In a 3D coordinate system, the isosurface of a coordinate +(i.e. the surface where that coordinate is constant while the others vary) +is known as a **coordinate surface**, and the intersections of +the surfaces of different coordinates are called **coordinate lines**. + +A **curvilinear** coordinate system is one where at least one of the coordinate surfaces is curved, +e.g. in cylindrical coordinates the line between $r$ and $z$ is a circle. +If the coordinate surfaces are mutually perpendicular, +it is an **orthogonal** system, which is generally desirable. + +A useful attribute of a coordinate system is its **line element** $\dd{\ell}$, +which represents the differential element of a line in any direction. +For an orthogonal system, its square $\dd{\ell}^2$ is calculated +by taking the differential elements of the old Cartesian $(x, y, z)$ system +and writing them out in the new $(x_1, x_2, x_3)$ system. +The resulting expression will be of the form: + +$$\begin{aligned} + \boxed{ + \dd{\ell}^2 + = \dd{x}^2 + \dd{y}^2 + \dd{z}^2 + = h_1^2 \dd{x_1}^2 + h_2^2 \dd{x_2}^2 + h_3^2 \dd{x_3}^2 + } +\end{aligned}$$ + +Where $h_1$, $h_2$, and $h_3$ are called **scale factors**, +and need not be constants. +The equation above only contains quadratic terms +because the coordinate system is orthogonal by assumption. + +Examples of orthogonal curvilinear coordinate systems include +[spherical coordinates](/know/concept/spherical-coordinates/), +cylindrical coordinates, +and [parabolic cylindrical coordinates](/know/concept/parabolic-cylindrical-coordinates/). + +In the following subsections, +we derive general formulae to convert expressions +from Cartesian coordinates in the new orthogonal system $(x_1, x_2, x_3)$. + + +## Basis vectors + +Consider the the vector form of the line element $\dd{\ell}$, +denoted by $\dd{\vu{\ell}}$ and expressed as: + +$$\begin{aligned} + \dd{\vu{\ell}} + = \vu{e}_x \dd{x} + \vu{e}_y \dd{y} + \vu{e}_z \dd{z} +\end{aligned}$$ + +We can expand the Cartesian differential elements, e.g. $\dd{y}$, +in the new basis as follows: + +$$\begin{aligned} + \dd{y} + = \pdv{y}{x_1} \dd{x_1} + \pdv{y}{x_2} \dd{x_2} + \pdv{y}{x_3} \dd{x_3} +\end{aligned}$$ + +If we write this out for $\dd{x}$, $\dd{y}$ and $\dd{z}$, +and group the terms according to $\dd{x}_1$, $\dd{x}_2$ and $\dd{x}_3$, +we can compare it the alternative form of $\dd{\vu{\ell}}$: + +$$\begin{aligned} + \dd{\vu{\ell}} + = \vu{e}_1 \:h_1 \dd{x_1} + \vu{e}_2 \:h_2 \dd{x_2} + \vu{e}_3 \:h_3 \dd{x_4} +\end{aligned}$$ + +From this, we can read off $\vu{e}_1$, $\vu{e}_2$ and $\vu{e}_3$. +Here we only give $\vu{e}_1$, since $\vu{e}_2$ and $\vu{e}_3$ are analogous: + +$$\begin{aligned} + \boxed{ + h_1 \vu{e}_1 + = \vu{e}_x \pdv{x}{x_1} + \vu{e}_y \pdv{y}{x_1} + \vu{e}_z \pdv{y}{x_1} + } +\end{aligned}$$ + + +## Gradient + +For a given direction $\dd{\ell}$, we know that +$\dv*{f}{\ell}$ is the component of $\nabla f$ in that direction: + +$$\begin{aligned} + \dv{f}{\ell} + = \pdv{f}{x} \dv{x}{\ell} + \pdv{f}{y} \dv{y}{\ell} + \pdv{f}{z} \dv{z}{\ell} + = \nabla f \cdot \bigg( \dv{x}{\ell}, \dv{y}{\ell}, \dv{z}{\ell} \bigg) + = \nabla f \cdot \vu{u} +\end{aligned}$$ + +Where $\vu{u}$ is simply a unit vector in the direction of $\dd{\ell}$. +We can thus find an expression for the gradient $\nabla f$ +by choosing $\dd{\ell}$ to be $h_1 \dd{x_1}$, $h_2 \dd{x_2}$ and $h_3 \dd{x_3}$ in turn: + +$$\begin{gathered} + \nabla f + = \vu{e}_1 \dv{x_1}{\ell} \pdv{f}{x_1} + + \vu{e}_2 \dv{x_2}{\ell} \pdv{f}{x_2} + + \vu{e}_3 \dv{x_3}{\ell} \pdv{f}{x_3} + \\ + \boxed{ + \nabla f + = \vu{e}_1 \frac{1}{h_1} \pdv{f}{x_1} + + \vu{e}_2 \frac{1}{h_2} \pdv{f}{x_2} + + \vu{e}_3 \frac{1}{h_3} \pdv{f}{x_3} + } +\end{gathered}$$ + +Where $\vu{e}_1$, $\vu{e}_2$ and $\vu{e}_3$ +are the basis unit vectors respectively corresponding to $x_1$, $x_2$ and $x_3$. + + +## Divergence + +Consider a vector $\vb{V}$ in the target coordinate system +with components $V_1$, $V_2$ and $V_3$: + +$$\begin{aligned} + \vb{V} + &= \vu{e}_1 V_1 + \vu{e}_2 V_2 + \vu{e}_3 V_3 + \\ + &= \vu{e}_1 \frac{1}{h_2 h_3} (h_2 h_3 V_1) + + \vu{e}_2 \frac{1}{h_1 h_3} (h_1 h_3 V_2) + + \vu{e}_3 \frac{1}{h_1 h_2} (h_1 h_2 V_3) +\end{aligned}$$ + +We take only the $\vu{e}_1$-component of this vector, +and expand its divergence using a vector identity, +where $f = h_2 h_3 V_1$ is a scalar +and $\vb{U} = \vu{e}_1 / (h_2 h_3)$ is a vector: + +$$\begin{gathered} + \nabla \cdot (\vb{U} \: f) + = \vb{U} \cdot (\nabla f) + (\nabla \cdot \vb{U}) \: f + \\ + \nabla \cdot \Big( \frac{\vu{e}_1}{h_2 h_3} (h_2 h_3 V_1) \Big) + = \frac{\vu{e}_1}{h_2 h_3} \cdot \Big( \nabla (h_2 h_3 V_1) \Big) + + \Big( \nabla \cdot \frac{\vu{e}_1}{h_2 h_3} \Big) (h_2 h_3 V_1) +\end{gathered}$$ + +The first term is straightforward to calculate +thanks to our preceding expression for the gradient. +Only the $\vu{e}_1$-component survives due to the dot product: + +$$\begin{aligned} + \frac{\vu{e}_1}{h_2 h_3} \cdot \Big( \nabla (h_2 h_3 V_1) \Big) + = \frac{\vu{e}_1}{h_1 h_2 h_3} \pdv{(h_2 h_3 V_1)}{x_1} +\end{aligned}$$ + +The second term is a bit more involved. +To begin with, we use the gradient formula to note that: + +$$\begin{aligned} + \nabla x_1 + = \frac{\vu{e}_1}{h_1} + \qquad \quad + \nabla x_2 + = \frac{\vu{e}_2}{h_2} + \qquad \quad + \nabla x_3 + = \frac{\vu{e}_3}{h_3} +\end{aligned}$$ + +Because $\vu{e}_2 \cross \vu{e}_3 = \vu{e}_1$ in an orthogonal basis, +we can get the vector whose divergence we want: + +$$\begin{aligned} + \nabla x_2 \cross \nabla x_3 + = \frac{\vu{e}_2}{h_2} \cross \frac{\vu{e}_3}{h_3} + = \frac{\vu{e}_1}{h_2 h_3} +\end{aligned}$$ + +We then apply the divergence and expand the expression using a vector identity. +In all cases, the curl of a gradient $\nabla \cross \nabla f$ is zero, so: + +$$\begin{aligned} + \nabla \cdot \frac{\vu{e}_1}{h_2 h_3} + = \nabla \cdot \big( \nabla x_2 \cross \nabla x_3 \big) + = \nabla x_3 \cdot (\nabla \cross \nabla x_2) - \nabla x_2 \cdot (\nabla \cross \nabla x_3) + = 0 +\end{aligned}$$ + +After repeating this procedure for the other components of $\vb{V}$, +we arrive at the following general expression for the divergence $\nabla \cdot \vb{V}$: + +$$\begin{aligned} + \boxed{ + \nabla \cdot \vb{V} + = \frac{1}{h_1 h_2 h_3} + \Big( \pdv{(h_2 h_3 V_1)}{x_1} + \pdv{(h_1 h_3 V_2)}{x_2} + \pdv{(h_1 h_2 V_3)}{x_3} \Big) + } +\end{aligned}$$ + + +## Laplacian + +The Laplacian $\nabla^2 f$ is simply $\nabla \cdot \nabla f$, +so we can find the general formula +by combining the two preceding results +for the gradient and the divergence: + +$$\begin{aligned} + \boxed{ + \nabla^2 f + = \frac{1}{h_1 h_2 h_3} + \bigg( + \pdv{x_1} \Big(\! \frac{h_2 h_3}{h_1} \pdv{f}{x_1} \!\Big) + + \pdv{x_2} \Big(\! \frac{h_1 h_3}{h_2} \pdv{f}{x_2} \!\Big) + + \pdv{x_3} \Big(\! \frac{h_1 h_2}{h_3} \pdv{f}{x_3} \!\Big) + \bigg) + } +\end{aligned}$$ + + +## Curl + +We find the curl in a similar way as the divergence. +Consider an arbitrary vector $\vb{V}$: + +$$\begin{aligned} + \vb{V} + = \vu{e}_1 V_1 + \vu{e}_2 V_2 + \vu{e}_3 V_3 + = \frac{\vu{e}_1}{h_1} (h_1 V_1) + \frac{\vu{e}_2}{h_2} (h_2 V_2) + \frac{\vu{e}_3}{h_3} (h_3 V_3) +\end{aligned}$$ + +We expand the curl of its $\vu{e}_1$-component using a vector identity, +where $f = h_1 V_1$ is a scalar and $\vb{U} = \vu{e}_1 / h_1$ is a vector: + +$$\begin{gathered} + \nabla \cross (\vb{U} \: f) + = (\nabla \cross \vb{U}) \: f - \vb{U} \cross (\nabla f) + \\ + \nabla \cross \Big( \frac{\vu{e}_1}{h_1} (h_1 V_1) \Big) + = \Big( \nabla \cross \frac{\vu{e}_1}{h_1} \Big) (h_1 V_1) - \frac{\vu{e}_1}{h_1} \cross \Big( \nabla (h_1 V_1) \Big) +\end{gathered}$$ + +Previously, when calculating the divergence, +we already showed that $\vu{e}_1 / h_1 = \nabla x_1$. +Because the curl of a gradient is zero, +the first term thus disappears, leaving only the second, +which contains a gradient turning out to be: + +$$\begin{aligned} + \nabla (h_1 V_1) + = \vu{e}_1 \frac{1}{h_1} \pdv{(h_1 V_1)}{x_1} + + \vu{e}_2 \frac{1}{h_2} \pdv{(h_1 V_1)}{x_2} + + \vu{e}_3 \frac{1}{h_3} \pdv{(h_1 V_1)}{x_3} +\end{aligned}$$ + +Consequently, the curl of the first component of $\vb{V}$ is as follows, +using the fact that $\vu{e}_1$, $\vu{e}_2$ and $\vu{e}_3$ +are related to each other by cross products: + +$$\begin{aligned} + \nabla \cross \Big( \frac{\vu{e}_1}{h_1} (h_1 V_1) \Big) + = - \frac{\vu{e}_1}{h_1} \cross \Big( \nabla (h_1 V_1) \Big) + = - \frac{\vu{e}_3}{h_1 h_2} \pdv{(h_1 V_1)}{x_2} + \frac{\vu{e}_2}{h_1 h_3} \pdv{(h_1 V_1)}{x_3} +\end{aligned}$$ + +If we go through the same process for the other components of $\vb{V}$ +and add the results together, we get the following expression for the curl $\nabla \cross \vb{V}$: + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \nabla \times \vb{V} + &= \frac{\vu{e}_1}{h_2 h_3} \Big( \pdv{(h_3 V_3)}{x_2} - \pdv{(h_2 V_2)}{x_3} \Big) + \\ + &+ \frac{\vu{e}_2}{h_1 h_3} \Big( \pdv{(h_1 V_1)}{x_3} - \pdv{(h_3 V_3)}{x_1} \Big) + \\ + &+ \frac{\vu{e}_3}{h_1 h_2} \Big( \pdv{(h_2 V_2)}{x_1} - \pdv{(h_1 V_1)}{x_2} \Big) + \end{aligned} + } +\end{aligned}$$ + + +## Differential elements + +The point of the scale factors $h_1$, $h_2$ and $h_3$, as can seen from their derivation, +is to correct for "distortions" of the coordinates compared to the Cartesian system, +such that the line element $\dd{\ell}$ retains its length. +This property extends to the surface $\dd{S}$ and volume $\dd{V}$. + +When handling a differential volume in curvilinear coordinates, +e.g. for a volume integral, +the size of the box $\dd{V}$ must be corrected by the scale factors: + +$$\begin{aligned} + \boxed{ + \dd{V} + = \dd{x}\dd{y}\dd{z} + = h_1 h_2 h_3 \dd{x_1} \dd{x_2} \dd{x_3} + } +\end{aligned}$$ + +The same is true for the isosurfaces $\dd{S_1}$, $\dd{S_2}$ and $\dd{S_3}$ +where the coordinates $x_1$, $x_2$ and $x_3$ are respectively kept constant: + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \dd{S_1} &= h_2 h_3 \dd{x_2} \dd{x_3} + \\ + \dd{S_2} &= h_1 h_3 \dd{x_1} \dd{x_3} + \\ + \dd{S_3} &= h_1 h_2 \dd{x_1} \dd{x_2} + \end{aligned} + } +\end{aligned}$$ + +Using the same logic, the normal vector element $\dd{\vu{S}}$ +of an arbitrary surface is given by: + +$$\begin{aligned} + \boxed{ + \dd{\vu{S}} + = \vu{e}_1 h_2 h_3 \dd{x_2} \dd{x_3} + \vu{e}_2 h_1 h_3 \dd{x_1} \dd{x_3} + \vu{e}_3 h_1 h_2 \dd{x_1} \dd{x_2} + } +\end{aligned}$$ + +Finally, the tangent vector element $\dd{\vu{\ell}}$ takes the following form: + +$$\begin{aligned} + \boxed{ + \dd{\vu{\ell}} + = \vu{e}_1 h_1 \dd{x_1} + \vu{e}_2 h_2 \dd{x_2} + \vu{e}_3 h_3 \dd{x_3} + } +\end{aligned}$$ + + + +## References +1. M.L. Boas, + *Mathematical methods in the physical sciences*, 2nd edition, + Wiley. diff --git a/content/know/concept/lagrange-multiplier/index.pdc b/content/know/concept/lagrange-multiplier/index.pdc index 2b14897..fffe85f 100644 --- a/content/know/concept/lagrange-multiplier/index.pdc +++ b/content/know/concept/lagrange-multiplier/index.pdc @@ -48,7 +48,9 @@ Solving this directly would be a delicate balancing act of all the partial derivatives. To help us solve this, we introduce a "dummy" parameter $\lambda$, -the so-called **Lagrange multiplier**, and contruct a new function $L$ given by: +the so-called **Lagrange multiplier**, +which need not be constant, +and contruct a new function $L$ given by: $$\begin{aligned} L(x, y, z) = f(x, y, z) + \lambda \phi(x, y, z) diff --git a/content/know/concept/parabolic-cylindrical-coordinates/index.pdc b/content/know/concept/parabolic-cylindrical-coordinates/index.pdc new file mode 100644 index 0000000..56544ae --- /dev/null +++ b/content/know/concept/parabolic-cylindrical-coordinates/index.pdc @@ -0,0 +1,188 @@ +--- +title: "Parabolic cylindrical coordinates" +firstLetter: "P" +publishDate: 2021-03-04 +categories: +- Mathematics +- Physics + +date: 2021-03-04T15:07:46+01:00 +draft: false +markup: pandoc +--- + +# Parabolic cylindrical coordinates + +**Parabolic cylindrical coordinates** are a coordinate system +that describes a point in space using three coordinates $(\sigma, \tau, z)$. +The $z$-axis is unchanged from the Cartesian system, +hence it is called a *cylindrical* system. +In the $z$-isoplane, however, confocal parabolas are used. +These coordinates can be converted to the Cartesian $(x, y, z)$ as follows: + +$$\begin{aligned} + \boxed{ + x = \frac{1}{2} (\tau^2 - \sigma^2 ) + \qquad + y = \sigma \tau + \qquad + z = z + } +\end{aligned}$$ + +Converting the other way is a bit trickier. +It can be done by solving the following equations, +and potentially involves some fiddling with signs: + +$$\begin{aligned} + 2 x + = \frac{y^2}{\sigma^2} - \sigma^2 + \qquad \quad + 2 x + = - \frac{y^2}{\tau^2} + \tau^2 +\end{aligned}$$ + +Parabolic cylindrical coordinates form an orthogonal +[curvilinear](/know/concept/curvilinear-coordinates/) system, +so we would like to find its scale factors $h_\sigma$, $h_\tau$ and $h_z$. +The differentials of the Cartesian coordinates are as follows: + +$$\begin{aligned} + \dd{x} = - \sigma \dd{\sigma} + \tau \dd{\tau} + \qquad + \dd{y} = \tau \dd{\sigma} + \sigma \dd{\tau} + \qquad + \dd{z} = \dd{z} +\end{aligned}$$ + +We calculate the line segment $\dd{\ell}^2$, +skipping many terms thanks to orthogonality: + +$$\begin{aligned} + \dd{\ell}^2 + &= (\sigma^2 + \tau^2) \:\dd{\sigma}^2 + (\tau^2 + \sigma^2) \:\dd{\tau}^2 + \dd{z}^2 +\end{aligned}$$ + +From this, we can directly read off the scale factors $h_\sigma^2$, $h_\tau^2$ and $h_z^2$, +which turn out to be: + +$$\begin{aligned} + \boxed{ + h_\sigma = \sqrt{\sigma^2 + \tau^2} + \qquad + h_\tau = \sqrt{\sigma^2 + \tau^2} + \qquad + h_z = 1 + } +\end{aligned}$$ + +With these scale factors, we can use +the general formulae for orthogonal curvilinear coordinates +to easily to convert things from the Cartesian system. +The basis vectors are: + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \vu{e}_\sigma + &= \frac{- \sigma}{\sqrt{\sigma^2 + \tau^2}} \vu{e}_x + \frac{\tau}{\sqrt{\sigma^2 + \tau^2}} \vu{e}_y + \\ + \vu{e}_\tau + &= \frac{\tau}{\sqrt{\sigma^2 + \tau^2}} \vu{e}_x + \frac{\sigma}{\sqrt{\sigma^2 + \tau^2}} \vu{e}_y + \\ + \vu{e}_z + &= \vu{e}_z + \end{aligned} + } +\end{aligned}$$ + +The basic vector operations (gradient, divergence, Laplacian and curl) are given by: + +$$\begin{aligned} + \boxed{ + \nabla f + = \frac{\mathbf{e}_\sigma}{\sqrt{\sigma^2 + \tau^2}} \pdv{f}{\sigma} + + \frac{\mathbf{e}_\tau}{\sqrt{\sigma^2 + \tau^2}} \pdv{f}{\tau} + + \mathbf{e}_z \pdv{f}{z} + } +\end{aligned}$$ + +$$\begin{aligned} + \boxed{ + \nabla \cdot \mathbf{V} + = \frac{1}{\sigma^2 + \tau^2} + \Big( \pdv{(V_\sigma \sqrt{\sigma^2 + \tau^2})}{d\sigma} + \pdv{(V_\tau \sqrt{\sigma^2 + \tau^2})}{d\tau} \Big) + \pdv{V_z}{z} + } +\end{aligned}$$ + +$$\begin{aligned} + \boxed{ + \nabla^2 f + = \frac{1}{\sigma^2 + \tau^2} \Big( \pdv[2]{f}{\sigma} + \pdv[2]{f}{\tau} \Big) + \pdv[2]{f}{z} + } +\end{aligned}$$ + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \nabla \times \mathbf{V} + &= \mathbf{e}_\sigma \Big( \frac{\mathbf{e}_1}{\sqrt{\sigma^2 + \tau^2}} \pdv{V_z}{\tau} - \pdv{V_\tau}{z} \Big) + \\ + &+ \mathbf{e}_\tau \Big( \pdv{V_\sigma}{z} - \frac{1}{\sqrt{\sigma^2 + \tau^2}} \pdv{V_z}{\sigma} \Big) + \\ + &+ \frac{\mathbf{e}_z}{\sigma^2 + \tau^2} + \Big( \pdv{(V_\tau \sqrt{\sigma^2 + \tau^2})}{\sigma} - \pdv{(V_\sigma \sqrt{\sigma^2 + \tau^2})}{\tau} \Big) + \end{aligned} + } +\end{aligned}$$ + +The differential element of volume $\dd{V}$ +in parabolic cylindrical coordinates is given by: + +$$\begin{aligned} + \boxed{ + \dd{V} = (\sigma^2 + \tau^2) \dd{\sigma} \dd{\tau} \dd{z} + } +\end{aligned}$$ + +The differential elements of the isosurfaces are as follows, +where $\dd{S_\sigma}$ is the $\sigma$-isosurface, etc.: + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \dd{S_\sigma} &= \sqrt{\sigma^2 + \tau^2} \dd{\tau} \dd{z} + \\ + \dd{S_\tau} &= \sqrt{\sigma^2 + \tau^2} \dd{\sigma} \dd{z} + \\ + \dd{S_z} &= (\sigma^2 + \tau^2) \dd{\sigma} \dd{\tau} + \end{aligned} + } +\end{aligned}$$ + +The normal element $\dd{\vu{S}}$ of a surface and +the tangent element $\dd{\vu{\ell}}$ of a curve are respectively: + +$$\begin{aligned} + \boxed{ + \dd{\vu{S}} + = \mathbf{e}_\sigma \sqrt{\sigma^2 + \tau^2} \dd{\tau} \dd{z} + + \mathbf{e}_\tau \sqrt{\sigma^2 + \tau^2} \dd{\sigma} \dd{z} + + \mathbf{e}_z (\sigma^2 + \tau^2) \dd{\sigma} \dd{\tau} + } +\end{aligned}$$ + +$$\begin{aligned} + \boxed{ + \dd{\vu{\ell}} + = \mathbf{e}_\sigma \sqrt{\sigma^2 + \tau^2} \dd{\sigma} + + \mathbf{e}_\tau \sqrt{\sigma^2 + \tau^2} \dd{\tau} + + \mathbf{e}_z \dd{z} + } +\end{aligned}$$ + + +## References +1. M.L. Boas, + *Mathematical methods in the physical sciences*, 2nd edition, + Wiley. diff --git a/content/know/concept/pulay-mixing/index.pdc b/content/know/concept/pulay-mixing/index.pdc index 9102c0e..8daa54f 100644 --- a/content/know/concept/pulay-mixing/index.pdc +++ b/content/know/concept/pulay-mixing/index.pdc @@ -83,13 +83,14 @@ We thus want to minimize the following quantity, where $\lambda$ is a [Lagrange multiplier](/know/concept/lagrange-multiplier/): $$\begin{aligned} - \braket{R_{n+1}}{R_{n+1}} + \lambda \sum_{m = 1}^n \alpha_m - = \sum_{m=1}^n \alpha_m \Big( \sum_{k=1}^n \alpha_k \braket{R_m}{R_k} + \lambda \Big) + \braket{R_{n+1}}{R_{n+1}} + \lambda \sum_{m = 1}^n \alpha_m^* + = \sum_{m=1}^n \alpha_m^* \Big( \sum_{k=1}^n \alpha_k \braket{R_m}{R_k} + \lambda \Big) \end{aligned}$$ -By differentiating the right-hand side with respect to $\alpha_m$, +By differentiating the right-hand side with respect to $\alpha_m^*$ +and demanding that the result is zero, we get a system of equations that we can write in matrix form, -which is relatively cheap to solve numerically: +which is cheap to solve: $$\begin{aligned} \begin{bmatrix} @@ -107,6 +108,11 @@ $$\begin{aligned} \end{bmatrix} \end{aligned}$$ +From this, we can also see that the Lagrange multiplier +$\lambda = - \braket{R_{n+1}}{R_{n+1}}$, +where $R_{n+1}$ is the *predicted* residual of the next iteration, +subject to the two assumptions. + This method is very effective. However, in practice, the earlier inputs $\rho_1$, $\rho_2$, etc. are much further from $\rho_*$ than $\rho_n$, @@ -121,7 +127,7 @@ You might be confused by the absence of all $\rho_m^\mathrm{new}$ in the creation of $\rho_{n+1}$, as if the iteration's outputs are being ignored. This is due to the first assumption, which states that $\rho_n^\mathrm{new}$ are $\rho_n$ are already similar, -such that they are interchangeable. +such that they are basically interchangeable. Speaking of which, about those assumptions: while they will clearly become more accurate as $\rho_n$ approaches $\rho_*$, @@ -147,8 +153,9 @@ $$\begin{aligned} In other words, we end up introducing a small amount of the raw outputs $\rho_m^\mathrm{new}$, while still giving more weight to iterations with smaller residuals. -Pulay mixing is very effective: -it can accelerate convergence by up to one order of magnitude! +Pulay mixing is very effective for certain types of problems, +e.g. density functional theory, +where it can accelerate convergence by up to one order of magnitude! diff --git a/content/know/concept/spherical-coordinates/index.pdc b/content/know/concept/spherical-coordinates/index.pdc new file mode 100644 index 0000000..4338ab4 --- /dev/null +++ b/content/know/concept/spherical-coordinates/index.pdc @@ -0,0 +1,214 @@ +--- +title: "Spherical coordinates" +firstLetter: "S" +publishDate: 2021-03-04 +categories: +- Mathematics +- Physics + +date: 2021-03-04T15:05:21+01:00 +draft: false +markup: pandoc +--- + +# Spherical coordinates + +**Spherical coordinates** are an extension of polar coordinates to 3D. +The position of a given point in space is described by +three coordinates $(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. + +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: + +$$\begin{aligned} + \boxed{ + r = \sqrt{x^2 + y^2 + z^2} + \qquad + \theta = \arccos(z / r) + \qquad + \varphi = \mathtt{atan2}(y, x) + } +\end{aligned}$$ + +The spherical basis vectors $\vu{e}_r$, $\vu{e}_\theta$ and $\vu{e}_\varphi$ +are expressed in the Cartesian basis like so: + +The spherical coordinate system is an orthogonal +[curvilinear](/know/concept/curvilinear-coordinates/) system, +whose scale factors $h_r$, $h_\theta$ and $h_\varphi$ we want to find. +To do so, we calculate the differentials of the Cartesian coordinates: + +$$\begin{aligned} + \dd{x} &= \dd{r} \sin\theta \cos\varphi + \dd{\theta} r \cos\theta \cos\varphi - \dd{\varphi} r \sin\theta \sin\varphi + \\ + \dd{y} &= \dd{r} \sin\theta \sin\varphi + \dd{\theta} r \cos\theta \sin\varphi + \dd{\varphi} r \sin\theta \cos\varphi + \\ + \dd{z} &= \dd{r} \cos\theta - \dd{\theta} r \sin\theta +\end{aligned}$$ + +And then we calculate the line element $\dd{\ell}^2$, +skipping many terms thanks to orthogonality, + +$$\begin{aligned} + \dd{\ell}^2 + &= \:\:\:\: \dd{r}^2 \big( \sin^2(\theta) \cos^2(\varphi) + \sin^2(\theta) \sin^2(\varphi) + \cos^2(\theta) \big) + \\ + &\quad + \dd{\theta}^2 \big( r^2 \cos^2(\theta) \cos^2(\varphi) + r^2 \cos^2(\theta) \sin^2(\varphi) + r^2 \sin^2(\theta) \big) + \\ + &\quad + \dd{\varphi}^2 \big( r^2 \sin^2(\theta) \sin^2(\varphi) + r^2 \sin^2(\theta) \cos^2(\varphi) \big) + \\ + &= \dd{r}^2 + r^2 \: \dd{\theta}^2 + r^2 \sin^2(\theta) \: \dd{\varphi}^2 +\end{aligned}$$ + +Finally, we can simply read off +the squares of the desired scale factors +$h_r^2$, $h_\theta^2$ and $h_\varphi^2$: + +$$\begin{aligned} + \boxed{ + h_r = 1 + \qquad + h_\theta = r + \qquad + h_\varphi = r \sin\theta + } +\end{aligned}$$ + +With to these factors, we can easily convert things from the Cartesian system +using the standard formulae for orthogonal curvilinear coordinates. +The basis vectors are: + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \vu{e}_r + &= \sin\theta \cos\varphi \:\vu{e}_x + \sin\theta \sin\varphi \:\vu{e}_y + \cos\theta \:\vu{e}_z + \\ + \vu{e}_\theta + &= \cos\theta \cos\varphi \:\vu{e}_x + \cos\theta \sin\varphi \:\vu{e}_y - \sin\theta \:\vu{e}_z + \\ + \vu{e}_\varphi + &= - \sin\varphi \:\vu{e}_x + \cos\varphi \:\vu{e}_y + \end{aligned} + } +\end{aligned}$$ + +The basic vector operations (gradient, divergence, Laplacian and curl) 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} + = \frac{1}{r^2} \pdv{(r^2 V_r)}{r} + + \frac{1}{r \sin\theta} \pdv{(\sin\theta V_\theta)}{\theta} + + \frac{1}{r \sin\theta} \pdv{V_\varphi}{\varphi} + } +\end{aligned}$$ + +$$\begin{aligned} + \boxed{ + \nabla^2 f + = \frac{1}{r^2} \pdv{r} \Big( r^2 \pdv{f}{r} \Big) + + \frac{1}{r^2 \sin\theta} \pdv{\theta} \Big( \sin\theta \pdv{f}{\theta} \Big) + + \frac{1}{r^2 \sin^2(\theta)} \pdv[2]{f}{\varphi} + } +\end{aligned}$$ + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \nabla \times \vb{V} + &= \frac{\vu{e}_r}{r \sin\theta} \Big( \pdv{(\sin\theta V_\varphi)}{\theta} - \pdv{V_\theta}{\varphi} \Big) + \\ + &+ \frac{\vu{e}_\theta}{r} \Big( \frac{1}{\sin\theta} \pdv{V_r}{\varphi} - \pdv{(r V_\varphi)}{r} \Big) + \\ + &+ \frac{\vu{e}_\varphi}{r} \Big( \pdv{(r V_\theta)}{r} - \pdv{V_r}{\theta} \Big) + \end{aligned} + } +\end{aligned}$$ + +The differential element of volume $\dd{V}$ +takes the following form: + +$$\begin{aligned} + \boxed{ + \dd{V} + = r^2 \sin\theta \dd{r} \dd{\theta} \dd{\varphi} + } +\end{aligned}$$ + +So, for example, an integral over all of space in Cartesian is converted like so: + +$$\begin{aligned} + \iiint_{-\infty}^\infty f(x, y, z) \dd{V} + = \int_0^{2\pi} \int_0^\pi \int_0^\infty f(r, \theta, \varphi) \: r^2 \sin\theta \dd{r} \dd{\theta} \dd{\varphi} +\end{aligned}$$ + +The isosurface elements are as follows, where $S_r$ is a surface at constant $r$, etc.: + +$$\begin{aligned} + \boxed{ + \begin{aligned} + \dd{S}_r = r^2 \sin\theta \dd{\theta} \dd{\varphi} + \qquad + \dd{S}_\theta = r \sin\theta \dd{r} \dd{\varphi} + \qquad + \dd{S}_\varphi = r \dd{r} \dd{\theta} + \end{aligned} + } +\end{aligned}$$ + +Similarly, the normal vector element $\dd{\vu{S}}$ for an arbitrary surface is given by: + +$$\begin{aligned} + \boxed{ + \dd{\vu{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 finally, the tangent vector element $\dd{\vu{\ell}}$ of a given curve is as follows: + +$$\begin{aligned} + \boxed{ + \dd{\vu{\ell}} + = \vu{e}_r \: \dd{r} + + \vu{e}_\theta \: r \dd{\theta} + + \vu{e}_\varphi \: r \sin\theta \dd{\varphi} + } +\end{aligned}$$ + + +## References +1. M.L. Boas, + *Mathematical methods in the physical sciences*, 2nd edition, + Wiley. -- cgit v1.2.3