Least Action

Nontrivializing triviality..and vice versa.

Archive for the ‘Uncategorized’ Category

Fun with Homology

leave a comment »

There is a theorem (currently being attributed to Wikipedia, but I’m sure I can do better given more time) which states that

All closed surfaces can be produced by gluing the sides of some polygon and all even-sided polygons (2n-gons) can be glued to make different manifolds.

Conversely, a closed surface with n non-zero classes can be cut into a 2n-gon.

Two interesting cases of this are:

  1. Gluing opposite sides of a hexagon produces a torus T^2.
  2. Gluing opposite sides of an octagon produces a surface with two holes, topologically equivalent to a torus with two holes.

I had trouble visualizing this on a piece of paper, so I found two videos which are fascinating and instructive, respectively.

The two-torus from a hexagon

The genus-2 Riemann surface from an octagon

I would like to figure out how one can make such animations, and generalizations of these, using Mathematica or Sagemath.

There are a bunch of other very cool examples on the Youtube channels of these users. Kudos to them for making such instructive videos!

PS – I see that $\LaTeX$ on WordPress has become (or is still?) very sloppy! 😦


Written by Vivek

October 20, 2016 at 21:57

If I were a Springer-Verlag Graduate Text in Mathematics….

leave a comment »

If I were a Springer-Verlag Graduate Text in Mathematics, I would be William S. Massey’s A Basic Course in Algebraic Topology.

I am intended to serve as a textbook for a course in algebraic topology at the beginning graduate level. The main topics covered are the classification of compact 2-manifolds, the fundamental group, covering spaces, singular homology theory, and singular cohomology theory. These topics are developed systematically, avoiding all unecessary definitions, terminology, and technical machinery. Wherever possible, the geometric motivation behind the various concepts is emphasized.

Which Springer GTM would you be? The Springer GTM Test

Written by Vivek

October 10, 2014 at 17:52

Posted in Uncategorized

An evolving .vimrc – VIM with Python

leave a comment »

I’ve switched almost completely to Python for my Master’s thesis. The question that comes up when you use Python is…what IDE to use? There seem to be a whole bunch of them but none of them worked for me, for one reason or another. So for now, I am using vim, and will explore different ways of customizing it for use with Python. For now here is a minimalist ~/.vimrc.

filetype off

set nu
filetype plugin indent on
syntax on
set modeline
set background=dark
autocmd FileType python set complete+=k~/.vim/syntax/python.vim isk+=.,(

map <buffer> <S-e> :w<CR>: !/usr/bin/env python % <CR>

I’ll explain and elaborate in due course of time.

For now, you might want to ignore the line containing autocmd (just put a # before it). Also, for starters ~/ refers to your home directory. And files beginning with a dot (.) are hidden by default so an “ls -l” won’t show them, but an “ls -aCF” will. So just use your favorite editor and copy paste the above text into a file called “.vimrc” which is placed in your home directory (~/.)

Written by Vivek

April 29, 2013 at 15:18

Posted in Uncategorized

Tagged with , , , ,

Gnuplot with C/C++

leave a comment »

Sometimes, it is convenient to call gnuplot from within your own C/C++ code rather than having the code create a data file, and manually execute gnuplot every time to re-plot using the contents of the file. This is easy if you use Linux: just use a pipe. For instance:

#include <iostream>
#include <stdio.h>
#include <cstdlib>

using namespace std;

int main(){
// Code for gnuplot pipe
FILE *pipe = popen("gnuplot -persist", "w");
fprintf(pipe, "\n");

// Your code goes here

// Don't forget to close the pipe
return 0;

Note that we have had to use C routines to call gnuplot. But there’s a problem with this code: gnuplot will generate the plot only when the pipe is closed. So if you have multiple plot statements, or if you want to refresh the same plot (as for instance, in an animation scenario) you will find that the above approach will result in the plots getting asynchronously updated right at the end.

So how does one ensure that after every plot command, a plot is actually generated (or an existing one refreshed) Immediately? The key is to flush the buffer using fflush. Simply insert


below every plot call to gnuplot. If you have an animation, then in order to make the transitions smoother, you might want to include a delay subroutine. A simple one can be built using the clock routines in time.h. For an example, click here.

Thanks to Vidushi Sharma for bringing these issues to my attention.

Written by Vivek

June 22, 2012 at 14:13

Constructing a vector from a spinor

leave a comment »

The purpose of this post is to examine why the quantity

\chi^\dagger \sigma_i \chi

transforms like a vector under rotations. Here, \chi is a 2 component spinor, and \sigma_i is one of the 3 Pauli matrices. The explanation follows essentially the arguments put forth by Sakurai in chapter 3 of his book on quantum mechanics.


An arbitrary state ket in spin space can be written as

|\alpha\rangle = |+\rangle\langle +|\alpha\rangle + |-\rangle\langle -|\alpha\rangle = \left(\begin{array}{c}\langle +|\alpha\rangle\\ \langle -|\alpha\rangle\end{array}\right) = \left(\begin{array}{c}c_{+}\\c_{-}\end{array}\right)

where \chi_{+} = |+ \rangle = \left(\begin{array}{c}1 \\ 0 \end{array}\right) and \chi_{-} = |-\rangle = \left(\begin{array}{c}0\\1\end{array}\right) are the base “kets” (actually they are spinors, for the spin-1/2 case). This identification suggests that we can specify a general two component spinor as

\chi = c_{+}\chi_{+} + \chi_{-}\chi_{-}

Further, from Sakurai’s equations 3.2.30,

\langle \pm|S_{k}|+\rangle = \frac{\hbar}{2}(\sigma_{k})_{\pm, +}

\langle \pm|S_{k}|-\rangle = \frac{\hbar}{2}(\sigma_{k})_{\pm, -}

Therefore, we get the most important result:

\langle S_k\rangle = \frac{\hbar}{2}\chi^{\dagger}\sigma_k\chi

Physically, this equation implies that the right hand side equals the expectation value of the spin operator S_k in spinor-space (or in more precise terms, in the basis generated by the set of all possible \chi‘s). So, the quantity that we are examining is just the expectation value of the operator S_k (modulo a constant factor of \hbar/2).

The argument..

Now, Sakurai has shown that under a rotation of the state kets, the expectation value of \langle S_k\rangle transforms like the component of a classical vector. That is,

\langle S_k\rangle \longrightarrow \sum_{l}R_{kl}\langle S_l\rangle

(This is equation 3.2.11 of Sakurai)

where R_{kl} are the elements of the 3 x 3 orthogonal matrix R that specifies this rotation.

The corresponding rotation of the state kets is carried out by the operator \mathcal{D}(R) = \exp{(i\frac{\phi}{2\hbar}\hat{n}\cdot\boldsymbol{S})}.

Therefore, \langle S_k\rangle transforms like a vector, and hence so does \chi^\dagger \sigma_i \chi.

Thanks to David Angelaszek for a long, patient and extremely useful discussion, which led to the resolution of this argument. And of course, thanks to JJ Sakurai for forcing us to read between the lines 🙂

Written by Vivek

November 13, 2010 at 16:13

Posted in Uncategorized

Coulomb’s Law in (1+2) dimensions

with 2 comments

The idea for this post came from an unsolved problem in Tony Zee’s book on QFT. We begin with the ‘mutual’ energy:

E = -\frac{1}{2}\int \frac{d^2 k}{(2\pi)^2}\frac{e^{i\vec{k}\cdot(\vec{x}_1-\vec{x}_2)}}{k^2 + m^2}

Define \boldsymbol{r} = \boldsymbol{x}_1-\boldsymbol{x}_2. Transforming to cylindrical polar coordinates, this is

E = -\frac{1}{2(2\pi)^2}\int_{0}^{\infty}\frac{k\,dk}{k^2 + m^2}\int_{0}^{2\pi}d\theta\,e^{ikr\cos\theta}

The \theta integral produces a Bessel Function of order 0, i.e. 2\pi J_{0}(kr), so that

E = -\frac{1}{4\pi}\int_{0}^{\infty}\frac{k J_{0}(kr)}{k^2 + m^2}dk

I’m lazy, so I used Mathematica to get the final result, which is

E = -\frac{1}{4\pi}K_{0}(mr)

where K_{0} denotes the modified Bessel function of the second kind, of order 0. A plot of K_{0}(mr) as a function of mr is shown below.

The graph in red is that of the usual 1/r potential. So, in 2 spatial dimensions, the potential energy actually falls off faster than 1/r.

Written by Vivek

October 18, 2010 at 23:29

Posted in Uncategorized

Scalar Propagator

leave a comment »

In this post, I want to discuss various aspects of the scalar field propagator. This is the first propagator one encounters in quantum field theory. In canonical quantization, there is quite a bit of spadework that goes into deriving the expression. However, as the more astute student will recognize, the expression is encountered well before one actually writes it. Those familiar with the theory of Fourier transforms will recognize that the propagator as normally written, is just the Green’s function of the wave equation, expressed as an integral over momentum space which is nothing but the inverse Fourier transform of the momentum space propagator. So, one should recognize straight out that a propagator is just a Green’s function. This doesn’t undermine the importance of the propagator of course (what would one do without it in field theory), but is merely meant to emphasize the crucial role played by Green’s functions in physics. Capturing the essence of the propagator, even if it means doing a lot of similar looking calculations repeatedly, is important in understanding both Feynman diagrams as well as Cluster Expansions.

Nevertheless, my reason for writing this post is that most of the ‘obvious’ calculational steps leading to the important expressions are often left to the imagination of readers in books, and sometimes its the steps and not the final result (as much) which give insight into the physics.

So, without further ado, let us begin with the expression for the propagator:

D(x-y) = \int \frac{d^{4}p}{(2\pi)^4}\frac{e^{ip\cdot(x-y)}}{p^2-m^2 + i\epsilon}

The i\epsilon has been added to make the expression sensible at p^2 = m^2 (which is the “on-shell” condition, if you’re familiar with special relativity). Note that we have not imposed this condition in this integral, so p can actually run free over all possible values. Remember that the restriction comes into place only if we put in a “hand-made” delta function inside with its argument equal to p^2 - m^2. Actually the “i\epsilon prescription” (as it is referred to in most QFT books) goes a bit deeper than this:- it is required for the path integral of the scalar field to converge at large values of the scalar field. That the same \epsilon should help us regularize the denominator from blowing up on shell is not unexpected.

For simplicity, let me consider the case y = 0. In any event, I can always obtain D(x-y) given a general expression for the propagator.


D(x) = \int \frac{d^{4}p}{(2\pi)^4}\frac{e^{i(p^0x^0-\vec{p}\cdot\vec{x})}}{p^2-m^2 + i\epsilon}

which I write as

D(x) = \int \frac{d^{3}p}{(2\pi)^3}e^{-i\vec{p}\cdot\vec{x}}\frac{1}{2\pi}\int dp^0\frac{e^{i p^0x^0}}{p^2-m^2 + i\epsilon}

Also p^2 = (p^0)^2-\vec{p}^2, so

p^2-m^2 + i\epsilon = (p^0)^2-\vec{p}^2-m^2 + i\epsilon

The poles are located at

\pm \sqrt{\vec{p}^2+m^2-i\epsilon} = \pm\sqrt{\omega_{p}^2-i\epsilon} where \omega_{p} = \sqrt{\vec{p}^2+m^2}

So, in the \epsilon \rightarrow 0 limit, the poles are at

\omega_{p} - i\epsilon
-\omega_{p} + i\epsilon

So the poles are in the second and fourth quadrant. This is important (why? If you loved the joke about why the mathematician named his dog Cauchy, you probably know why).

The integral

I = \int dp^0\frac{e^{i p^0x^0}}{p^2-m^2 + i\epsilon} = \int dp^0\frac{e^{i p^0x^0}}{(p^0-(\omega_p - i\epsilon))(p^0-(-\omega_p+i\epsilon))}

can be easily computed using the Residue Theorem. There are two cases to consider, depending on whether x^0 > 0 or x^0 < 0.

Case I: x^0 > 0

In this case, we must have Im(x^0) > 0 on the contour of integration, for the integrand to be bounded (a necessary condition for the indefinite integral to converge). This is most easily seen if one expresses p^0 as a complex number:

p^0 = a + ib

Now, ip^0 = ia - b, so e^{ip^0 x^0} = e^{-bx^0} e^{ia x^0}. So, if x^0 > 0, we must have b > 0 or else the integrand will blow up at large p^0. I know that this is just the nifty trick known to contour integrators as Jordan’s lemma, and I probably don’t need to go into it in so much detail here, but the reason I do it is that it is easy to make sign errors subconsciously. So at least for the first few attempts, one must go through each and every step in detail before becoming an “expert propagator” 😉

Anyway, so much for that. The upper half plane contribution comes from the pole in the second quadrant, and the residue is simple to compute. It turns out to be

\frac{e^{ip^0(-\omega_{p} + i\epsilon)}}{(-\omega_{p} + i\epsilon)-(\omega_{p} - i\epsilon)} = \frac{e^{-i\omega_p t}}{-2\omega_p}

where t = x^0.


I = 2\pi i \frac{e^{-i\omega_p t}}{-2\omega_p}

Case II: x^0 < 0

Obviously, I have to pick out the contribution from the pole in the 4th quadrant now. The residue is

\frac{e^{ip^0(\omega_{p} - i\epsilon)}}{(\omega_{p} - i\epsilon)-(-\omega_{p} + i\epsilon)} = \frac{e^{i\omega_p t}}{2\omega_p}

So that

I = 2\pi i \frac{e^{i\omega_p t}}{2\omega_p}

Plugging the results back into the original expression for D(x), one gets

D(x) = \int \frac{d^3 p}{(2\pi)^3} e^{-i\vec{p}\cdot\vec{x}}\left[-i\frac{e^{-i\omega_p t}}{2\omega_p}\theta(p^0) + i \frac{e^{i\omega_p t}}{2\omega_p}\theta(-p^0)\right]

Now, the volume integral over the “3-momentum” variables is invariant under inversion in the 3-momentum space: \vec{p} \rightarrow -\vec{p}. So, I can write this as

D(x) = \int \frac{d^3 p}{(2\pi)^3} \left[-i\frac{e^{-i\omega_p t}e^{i\vec{p}\cdot\vec{x}}}{2\omega_p}\theta(p^0) + i  \frac{e^{i\omega_p t}e^{-i\vec{p}\cdot\vec{x}}}{2\omega_p}\theta(-p^0)\right]

where I’ve performed the invariance operation of inversion in the first term. This is just

D(x) = \int \frac{d^3 p}{(2\pi)^3} \left[-i\frac{e^{-i(\omega_p  t-\vec{p}\cdot\vec{x})}}{2\omega_p}\theta(p^0) + i  \frac{e^{i(\omega_p  t-\vec{p}\cdot\vec{x})}}{2\omega_p}\theta(-p^0)\right]

Under Construction

Written by Vivek

October 16, 2010 at 20:01

Posted in Uncategorized