## Archive for the ‘**Uncategorized**’ Category

## Colored terminal on the Mac

~/.bash_profile

export

CLICOLOR=1

exportLSCOLORS=gxBxhxDxfxhxhxhxhxcxcx

#export LSCOLORS=”ExGxBxDxCxEgEdxbxgxcxd”

## Fun with Homology

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 non-zero classes can be cut into a 2n-gon.*

Two interesting cases of this are:

- Gluing opposite sides of a hexagon produces a torus .
- 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! ðŸ˜¦

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

If I were a Springer-Verlag Graduate Text in Mathematics, I would be William S. Massey’s .
A Basic Course in Algebraic TopologyI 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 |

## An evolving .vimrc – VIM with Python

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 (~/.)

## Gnuplot with C/C++

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`

fclose(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

fflush(pipe);

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.

## Constructing a vector from a spinor

The purpose of this post is to examine why the quantity

transforms like a vector under rotations. Here, is a 2 component spinor, and 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.

**Spadework**

An arbitrary state ket in spin space can be written as

where and 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

Further, from Sakurai’s equations 3.2.30,

Therefore, we get the most important result:

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

**The argument..**

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

(This is equation 3.2.11 of Sakurai)

where 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 .

Therefore, transforms like a vector, and hence so does .

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 ðŸ™‚

## Coulomb’s Law in (1+2) dimensions

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

Define . Transforming to cylindrical polar coordinates, this is

The integral produces a Bessel Function of order 0, i.e. , so that

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

where denotes the modified Bessel function of the second kind, of order 0. A plot of as a function of 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.