This is a random collection of tools for doing research. Not organized. Navigate with the table of content for what you need.

# How to do GR in Mathematica?

There are in general two ways to do GR in Mathematica:

Use explicit indices, like $ a_0 b^0 + a_1 b^1 + a_2 b^2 + a_3 b^3 $. The implementation is very simple and the code can be understood at a glance. See, for example, Hartle. However, the disadvantage is that, the output result is very long in realistic calculations. And one has to rewrite the long output into abstract indices form by oneself.

Use abstract indices, like $ a_\mu b^\mu $. The code is more technical. My implementation can be found at MathGR. A more powerful, and also much more complicated system is xAct.

See also here for a long list of packages.

# Order bibitem citations in $\mathrm{\LaTeX}$

Python version, Mathematica version.

# How to plot a contour using Planck data

- Download Planck chains from Planck Legacy Archive, at the section
`COSMOLOGY`

. For example, to use BKP to plot $n_s$-$r$, download`Bicep-Keck-Planck fiducial B mode likelihood`

. Unzip the file. - Choose the right subfolder (for example,
`base_r/plikHM_TT_lowTEB_BKP`

). The chain files are the`.txt`

files with large size (typically between 1MB and 100MB). - Download ChainStat. Make sure the package can be loaded (either install the package, or put the
`ChainStat.m`

to the same folder as the chain files and`SetDirectory`

to`NotebookDirectory`

in your Mathematica file). - Follow the examples in the
`examples.nb`

to plot.

# Installation notes: healpy with Planck map

Assuming `Archlinux`

or `Manjaro`

. Otherwise replace `pacman`

with `apt-get`

, `yum`

, etc with proper arguments.

## Download map

From Maps/Snigle-frequency of Planck Legacy Archive. Setup the directory:

```
mkdir PublicCode
cd PublicCode
mv ../Downloads/HFI_SkyMap_353_2048_R2.02_full.fits .
```

## Install `healpy`

(Python 3 of HEALPix)

```
sudo pacman -Ss python-pip
pip install --user healpy
```

## Install and run `ipython`

```
sudo pacman -S ipython jupyter jupyter-notebook mathjax pandoc jupyter notebook
```

## Test the `HEALPix`

python

Ref: tutorial. In the pop-up ipython window, for example:

```
import matplotlib.pyplot as plt
import numpy as np
import healpy as hp
NSIDE = 32
m = np.arange(hp.nside2npix(NSIDE))
hp.mollview(m, title="Mollview image RING")
plt.show()
```

As another example:

```
wmap_map_I = hp.read_map('/home/wangyi/PublicCode/HFI_SkyMap_353_2048_R2.02_full.fits')
hp.mollview(wmap_map_I, coord=['G','E'], title='Histogram equalized Ecliptic', unit='mK', norm='hist', min=-1,max=1, xsize=2000)
hp.graticule()
plt.show()
```