## Thursday, 31 January 2019

### Commentary 2.9 Hodge star operator - in Euclidean space

 Swapping axes same as reversing an axis.
Carroll introduces Hodge duality and the Hodge star operator. The Hodge star operator is a map from $p$-forms on an $n$-dimensional manifold on to ($n-p)$ forms on the manifold. Thus: (his equation 2.82)
\begin{align}\large
{\left(*A\right)}_{{\mu }_1\dots {\mu }_{n-p}}=\frac{1}{p!}{\epsilon }^{{\nu }_1\dots {\nu }_p}_{\ \ \ \ \ \ \ \ \ \ \ \ \ \ {\mu }_1\dots {\mu }_{n-p}}A_{{\nu }_1\dots {\nu }_p} & \phantom {10000}(1) \\
\end{align}
which maps $A$ to "$A$ dual".

We have also used the Levi-Civita tensor which is, as the name suggests, a tensor not a mere number, defined as (Carroll's 2.69)
\begin{align}\large
{\epsilon }_{{\mu }_1{\mu }_2\dots {\mu }_n}=\sqrt{\left|g\right|}{\widehat{\epsilon }}_{{\mu }_1{\mu }_2\dots {\mu }_n} & \phantom {10000}(2) \\
\end{align}
where  $\widehat{\epsilon }$  is the Levi-Civita number and $g$ (also not a tensor) is the determinant of the metric.

Then at his 2.84 Carroll writes. "In three-dimensional Euclidean space the Hodge dual of the wedge product of two 1-forms gives another 1-form:
\begin{align}
*{\left(U\wedge V\right)}_i={\epsilon }^{\ \ jk}_iU_jV_k & \phantom {10000}(7) \\
\end{align}
(All of the prefactors cancel.) Since 1-forms in Euclidean space are just like vectors, we have a map from two vectors to a single vector. You should convince yourself that this is just the conventional cross product, and that the appearance of the Levi-Civita tensor explains why the cross product changes sign under parity (interchange of two coordinates or equivalently basis vectors.)"

Proving (7) itself was quite hard and the first step was to prove that the Levi-Civita tensor is completely antisymmetric, even when indices are up and down. Carroll had not mentioned this - he probably thought it was obvious. It was vital to the proof which followed with some tricky index swapping. The prefactors cancelling was easy.

The next part to show that (7) was the same as the cross product was very easy, including showing the dependence on the parity of the coordinate system which involves a lady flying over the north pole (diagram above) and the vexed question of fingering or screwing.

Read all four pages and 25 beautifully numbered equations in
Commentary 2.9 Hodge star operator - in Euclidean space.pdf

## Sunday, 27 January 2019

### GrindEQ, MS-Word macros for equations and more

I have spent a couple of weeks enhancing my equation handling so that I fully mastered equation numbers, and, using GrindEQ, I could fairly easily get from an MS-Word document containing equations to publishing the equations on this blogger blog or on physics forums. This is an update of older posts in Tools, here and here. I will recap and add in new stuff.

This post has three main sections
1) Equations in MS-Word
2) Converting GrindEQ To Web
3) Getting the macros

## 1) Equations in MS-Word

I have been copying and pasting tables and equations in MS-Word for far too long. At last I have written some word macros to speed things up, so I can more easily produce correctly aligned equations like
 Fig 1: Aligning equation numbers neatly using 2 x 1 tables
and
 Fig 2: LHS of equations unchanged and aligning equation numbers
So I now have a "Quick access toolbar" like this

After the AB icon, they have the following effects
1. Select table
2. Add bars on table
3. Remove bars from table
4. Make table a box.
5. ($\pi$) Insert left justified equation (font size 12). Macro: InsertEquationInLine
6. Insert unbarred 2 x 1 table with centred justified equation in column 1, (nn) in column 2 (Fig 1). Macro: EquationTable2
7. Insert unbarred 3 x 1 with right justified equation in column 1, left justified equation in column 2 and (nn) in column 3 (Fig 2) Macro: EquationTable3
The first four are very useful for quickly sorting problems with tables and tidying them. They are all linked directly to MS-Word commands. 5-7 are linked to the macros. The equation number (nn) is one bigger than the last one up the document. The one line tables are inserted according to customary MS-Word rules. There are three constants in the macros which may be adjusted to suit your taste:
• EquationFontSize - default 12 points
• TableHeight - height of new equation rows in cm, default 1.29
• EquationColumnWidth - column width in cm of equation number column, default 1.38
It often happens that you need to insert a few extra equations in the middle of a document. Here's a tip: Insert the first equation which will probably have the same number as the equation below. Change its number to 100 (or another large number). Following equations will be numbered 101, 102, ... When you have finished adding the group, renumber all equations. Which brings us to the next macro.

### aaRenumberEquations

Obviously after a bit of copying and pasting or writing things out of order equation numbers can become a mess. For this we have the aaRenumberEquations macro which just renumbers all the equations from 1-n. It also adjusts all the references to said equations. Equation numbers such as a, b, b123,  2.5 will be renumbered.

I have tested it on the .docx which produced Commentary 1.1 Tensors matrices and indexes.pdf . It contains 213 equations numbers and 154 references to them. It took 112 seconds. The macro estimates the time that will be taken at the beginning (92 seconds in this case) and gives suitable warnings if it is more than 40 seconds. Clearly the overall time will depend on the machine.

#### aaRenumberEquations detects two kinds of error:

1) There is a reference to an equation that does not exist and the reference number would become a new equation number. In this case you get an error like
Equation (4) is referenced. It does not exist.
2) Equations are numbered with the same number twice or more and that number is used as an equation reference. (It does not matter if duplicate equation numbers are used but they are not referenced). In this case you get an error like
Equation (33) is defined 3 times and referenced one or more times.
Progress, and all errors found are displayed in another window.

I now activate this macro from the Quick access tool bar because it is robust and I use it often. I used to only activate it from the Developer / Macros button which explains the aa in the name. Which brings us to the final macro.

## 2) aConvertGrindEQToWeb

So I paid 49€ for GrindEQ and got to work on converting their peculiar .tex file output into something that was digestible by my blogger blog and Physics Forums (PF). It took about eight days which was somewhat longer than I expected.

I modified the MathJax script on my website to use for free and $for inline Latex equation delimiters. That is the same as PF. The script is at MathJaxSnippet.txt. My Macro aConvertGrindEQToWeb takes GrindEQ output, usually in a .tex file, and Converts it to Latex which is can be copied and pasted into the PF editor or Blogger when it has the MathJax script installed. So: 1. You create a .tex file from a Word document with GrindEQ. This is still displayed in Word. 2. Convert that with aConvertGrindEQToWeb (my Word macro.) 3. Copy and paste the resulting text (text only) into PF or Blogger. There are uncountable options when generating the .tex file. My macro would certainly not work if some were selected. So all the options that I use are shown in Word Macros for GrindEQ.pdf. ### Converting GrindEQ files Here are a few notable points, which also may only be valid with options shown below. GrindEQ automatic equation numbers are almost unusable. Therefore I have disregarded them and assume that all equation numbers are manually inserted. Free equation delimiters$ {\backslash}[ … {\backslash}]$are converted to$\\ … \\$Inline delimiters … are converted to$ \#\# …\#\# $Multiple and # in text are difficult or impossible to display, therefore we replace them all by £ and #£. (The multiple and # above are in inline 'equations'). We replace all ' by {'} in equations, because a single ' in a superscript crashes MathJax and PF. My macro assumes that everything in a table is an equation. This makes sense because tables need special treatment anyway when putting them into a web editor. GrindEQ converts Word tables into a${\backslash}$begin{tabular} …${\backslash}$end{tabular} structure. This fairly conveniently converts to${\backslash}begin{align} …{\backslash}end{align} structures for Latex, no further equation delimiters are need in such a region. Alpha numeric equation numbers have the alpha part in italics because they are treated as an equation. (I have not seen {tabular} in any Latex documentation and MathJax does not like it.) There are many other expressions like \noindent in .tex files. They are removed. Latex equations contain many expressions like \mathrm{cosh}. The characters \{ } are given special treatment as are # and others. In particular my macro uses Cyrillic characters л and м as intermediaries. Do not use them in your document! As a result the order in which everything is translated is delicately balanced. A warning if you want to modify the macro. GrindEQ produces \mathrm{\alphaup } etc for non-italic (upright) Greek letters. Mathjax does not like it. They are all converted to \alpha etc. They become italic. The macro is quite good, but not perfect! ## 3) Getting the macros The macros are in VBA which is a bit amateurish, but that is what the Word macro recorder writes. If you would like to use these macros click here to see every version. Open the most recent then copy and paste into the Visual Basic editor on the Developer tab. (If you can't see the developer tab in the 'Ribbon', search for developer in your Word help. It's version dependent.) To run the macros you may also need to 'Trust access to the VBA project object model' in the Word Trust Center Settings. If you have any questions, just leave a comment. ### References Screenshots of GrindEQ options Word Macros for GrindEQ.pdf. ## Thursday, 10 January 2019 ### Exercise 2.08 Exterior derivative and modified Leibniz rule This exercise started in section 2.9 on which I wrote a seven page commentary before accepting Carroll's challenge to prove the modified Leibniz rule for the exterior derivative. Carroll introduces differential forms: "A differential p-form is a completely antisymmetric (0,p) tensor. Thus scalars are automatically 0-forms and dual vectors (downstairs index) are one-forms. We also have the 4-form{\epsilon }_{\mu \nu \rho \sigma }$, the Levi-Civita tensor." I had a slight problem with 0- and 1-forms but this was resolved on Physics Forums. First we meet the wedge product: Given a$\ p$-form$A$and a$q$-form$B$we can form a$(p+q)$-form known as the wedge product$A\wedge B$by taking the antisymmetrised tensor product: {\left(A\wedge B\right)}_{{\mu }_1\dots {\mu }_{p+q}}=\frac{\left(p+q\right)!}{p!q!}A_{[{\mu }_1\dots {\mu }_p}B_{{\mu }_{p+1}\dots {\mu }_{p+q}]} I prove that the wedge product of an n-dimensional 2-form and 1-form is completely antisymmetric in any number of dimensions n$\mathrm{\ge}$2 and therefore a 3-form. Then we meet the exterior derivative {\left(\mathrm{d}A\right)}_{{\mu }_1\dots {\mu }_{p+1}}=\left(p+1\right){\partial }_{[{\mu }_1}A_{{\mu }_2\dots {\mu }_{p+1}]}They both involve the ghastly total antisymmetrisation operation [] on indices. It is defined back in his equation (1.80) as T_{[{\mu }_1\dots {\mu }_n]}=\frac{1}{n!}\left(T_{{\mu }_1\dots {\mu }_n}\pm \mathrm{sum\ over\ permutations\ of}\ {\mu }_1\dots {\mu }_n\right) This led on to Exercise 2.08 ## Question Verify (2.78): For an exterior derivative of a product of a p-form ω and a q-form η, we have the modified Leibnitz rule: \mathrm{d}\left(\omega \wedge \eta \right)=\left(\mathrm{d}\omega \right)\wedge \eta +{\left(-1\right)}^p\omega \wedge \left(\mathrm{d}\eta \right) ## Answer Here we have the ghastly total antisymmetrisation operation [] again and nested in itself. I had to invent a new notation \sum_{\mp \mathrm{\circlearrowleft }}{A_{{\mu }_1\dots {\mu }_n}}\equiv \left(A_{{\mu }_1\dots {\mu }_n}\pm \mathrm{sum\ over\ permuta}\mathrm{tions\ of}\ {\mu }_1\dots {\mu }_n\ where\ we\ use\ -\ for\ odd\ permutations\ and\ +\ for\ even.\right) because writing the stuff about the permutations every time would be stupid and does not fit on a line. I expanded each term in the question equation and reached expressions like \frac{{\left(-1\right)}^{p\left(q+1\right)}}{\left(q+1\right)!p!q!}\sum_{\mp \mathrm{\circlearrowleft }}{\left(\sum_{\mp \mathrm{\circlearrowleft }}{{\mathrm{\partial }}_{{\mu }_1}{\eta }_{{\mu }_2\dots {\mu }_{q+1}}}\right){\omega }_{{\mu }_{q+2}\dots {\mu }_{p+q+1}}} where you can see the nested expansions explicitly. Each term had a different variant of the nesting so the nesting had to be removed and I proved, for example and avoiding too many subscripts, that \sum_{\mp \mathrm{\circlearrowleft }}{\left(\sum_{\mp \mathrm{\circlearrowleft }}{{\mathrm{\partial }}_a{\eta }_{c_1\dots c_q}}\right){\omega }_{b_1\dots b_p}}\mathrm{=}\left(q+1\right)!{\left(-1\right)}^{q(p+q)}\sum_{\mp \mathrm{\circlearrowleft }}{{\mathrm{\partial }}_a{\omega }_{b_1\dots b_p}{\eta }_{c_1\dots c_q}} factorials cancelled beautifully but I was left with {\mathrm{d}\left(\omega \wedge \eta \right)}_{\ }=\left(\mathrm{d}\omega \right)\wedge \eta ={\left(-1\right)}^{\left(q+p\right)}\omega \wedge \left(\mathrm{d}\eta \right) which is not the same as the modified Leibnitz rule, in other words, junk. I also show that the equation does not work for two 1-forms. In fact I get2\mathrm{d}\left(\omega \wedge \eta \right)=\left(\mathrm{d}\omega \right)\wedge \eta +{\left(-1\right)}^p\omega \wedge \left(\mathrm{d}\eta \right)which agrees with my wrong answer. I am within spitting distance of the correct proof! I hope to come back to this problem. Read the full account Commentary 2.9 Differential forms.pdf (7 pages) Ex 2.08 Exterior derivative and modified Leibnitz rule.pdf (8 pages - I have long thought that he was Leibnitz. That is acceptable, but Leibniz is better.) There is also an answer here from University of California, Santa Barbara (UCSB). It starts from$\mathrm{d}\left(\omega \wedge \eta \right)$and uses the ordinary Leibnitz rule to split that in two. It then manipulates the two parts to convert them into the RHS of the question equation. There are some rather 'hand-waving' steps such as the first line of text "We drop the inner set of antisymmetrization brackets in the second line because the terms are antisymmetrized in all of their indices". It works in the opposite direction to what I did. ### Commentary 2.8 Tensor Densities The opening sentence of section 2.8 starts "Tensors possess a compelling beauty and simplicity". That fills me with fear. We are told that the Levi-Civita symbol, which is not a tensor, is defined as{\widetilde{\epsilon }}_{{\mu }_1{\mu }_2\dots {\mu }_n}=\left\{ \begin{array}{ll} +1 & \mathrm{if}\mathrm{\ }{\mu }_1{\mu }_2\dots {\mu }_n\mathrm{\ is\ an\ even\ permitation\ of}\ 01..(n-1)\ \\ -1 & \mathrm{if\ }{\mu }_1{\mu }_2\dots {\mu }_n\mathrm{\ is\ an\ odd\ permitation\ of}\ 01..\left(n-1\right) \\ 0 & \mathrm{otherwise} \end{array} \right.and (Carroll's (2.66)) that given any$n\times n$matrix$M^{\mu }_{\ \ \ \mu '\ }$, the determinant$\left|M\right|$obeys {\widetilde{\epsilon }}_{{\mu '}_1{\mu '}_2\dots {\mu '}_n}\left|M\right|={\widetilde{\epsilon }}_{{\mu }_1{\mu }_2\dots {\mu }_n}M^{{\mu }_1}_{\ \ \ \ \ {\mu '}_1}M^{{\mu }_2}_{\ \ \ \ \ {\mu '}_2}\dots M^{{\mu }_n}_{\ \ \ \ \ {\mu '}_n}We are invited to check this for 2×2 and 3×3 matrices which we do and do discover some beauty comparing traditional methods for calculating the determinant of a matrix using cofactors or using the Levi-Civita symbol. Setting${\mu '}_1{\mu '}_2\dots {\mu '}_n=01\dots (n-1)$we get the even simpler\left|M\right|={\widetilde{\epsilon }}_{{\mu }_1{\mu }_2\dots {\mu }_n}M^{{\mu }_1}_{\ \ \ \ \ 0}M^{{\mu }_2}_1\dots M^{{\mu }_n}_{\ \ \ \ \ (n-1)}Other combinations of${\mu '}_1{\mu '}_2\dots {\mu '}_n$either give$0=0$or the same as$01\dots (n-1)$or other cofactor expansions of the determinant. However if the equation had been simplified the next equation (2.67) would not work and (2.67) is the punch line. We also prove that the determinant of the metric under a coordinate transformation is given by g\left(x^{\mu '}\right)={\left|\frac{\partial x^{\mu '}}{\partial x^{\mu }}\right|}^{-2}g\left(x^{\mu }\right) See the details at ## Tuesday, 1 January 2019 ### Exercise 2.07 Prolate spheroidal coordinates (Kepler problem) ## Question Prolate spheroidal coordinates can be used to simplify the Kepler problem in celestial mechanics. They are related to the usual Cartesian coordinates$(x,y,z)$of Euclidean three-space by x={\mathrm{sinh} \chi \ }{\mathrm{sin} \theta \ }{\mathrm{cos} \phi \ } y={\mathrm{sinh} \chi \ }{\mathrm{sin} \theta \ }{\mathrm{sin} \phi \ } z={\mathrm{cosh} \chi \ }{\mathrm{cos} \theta \ } Restrict your attention to the plane$y=0$and answer the following questions. (a) What is the coordinate transformation matrix${\partial x^{\mu }}/{\partial x^{\nu'}}$relating$(x,z)$to$(\chi ,\theta )$? (b) What does the line element${ds}^2$look like in prolate spheroidal coordinates? ## Answer  why${{\mathrm{sinh}}^{\mathrm{2}} \chi \ }{{\mathrm{cos}}^{\mathrm{2}} \theta \ }+{{\mathrm{cosh}}^{\mathrm{2}} \chi \ }{{\mathrm{sin}}^{\mathrm{2}} \theta \ }$=${{\mathrm{sinh}}^{\mathrm{2}} \chi \ }+{{\mathrm{sin}}^{\mathrm{2}} \theta \ }$The answer to the first part was tricksy. Should you find$\chi,\theta$in terms of$x,z$? That is very hard and differentiating the expression would also be. After circling a bit I decided that the prime in${\partial x^{\mu }}/{\partial x^{\nu'}}$was for the$\chi,\theta$system and the 'coordinate transformation matrix' would be found from the general tensor coordinate transformation law. I was justified when I could use that in part (b).${ds}^2$is the metric and the 'coordinate transformation matrix' can be reused to calculate it in the$\chi,\theta$. I also found a sample answer at the University of Utah. They have it in assignments 2 and 3. Maybe none of the students could do it before Feb 7. Their solutions agreed with mine (give or take a$\pm ##) but did not explicitly use the great general tensor coordinate transformation law. They use more informal methods. It also contains a few typos. The solution to part (b) is{ds}^2=\left({{\mathrm{s}\mathrm{i}\mathrm{n}\mathrm{h}}^{\mathrm{2}} \chi \ }{{\mathrm{cos}}^{\mathrm{2}} \theta \ }+{{\mathrm{cosh}}^{\mathrm{2}} \chi \ }{{\mathrm{sin}}^{\mathrm{2}} \theta \ }\right)\left({\mathrm{d}\chi }^2+{\mathrm{d}\theta }^2\right)$$which is their second last line. Their last line is$$\Rightarrow {ds}^2=\left({{\mathrm{sinh}}^{\mathrm{2}} \chi \ }+{{\mathrm{sin}}^{\mathrm{2}} \theta \ }\right)\left({\mathrm{d}\chi }^2+{\mathrm{d}\theta }^2\right)It remained a mystery [until Feb 2019] to me how to prove they are the same, but I could show it numerically with Desmos or in the graphic above.

 Comparison of Utah and my solutions.
Read the full story (3 pages) at Ex 2.07 Kepler problem.pdf.