Reduced density matrix and partial trace

Reduced density matrix

Suppose we have two quantum systems \(a, b\), with dimension \(N_a, N_b\) respectively. Then the Hilbert space of \(a+b\) is of dimension \(N=N_aN_b\). Suppose we have a density matrix

$$\hat\rho=\sum_{i,j}\rho_{ij}\lvert i\rangle \langle j\rvert=\sum_{i,j,k,l}\rho_{ijkl}\lvert i\rangle_a\lvert j\rangle_b \langle k\rvert_a\langle l\rvert_b$$

Then the reduced density matrix of \(a\) is defined as

$$\hat\rho_a=\mathrm{tr}_b\hat\rho=\sum_i \langle i\rvert_b\hat\rho\lvert i\rangle_b$$

i.e. reduced density matrix problem is equivalent to partial trace problem.

Tensor

In fact, if we take \(\hat\rho\) as a 4-tensor \(\rho_{ijkl}\), then the reduced density matrix is

$$\rho^{(a)}_{ij}=\delta^{\mu\nu}\rho_{i\mu k\nu}$$

For simple density matrix \(\rho=\lvert \psi\rangle \langle \psi\rvert\), the reduced matrix is

$$\rho^{(a)}_{ik}=\delta^{jl}\rho_{ijkl}=\delta^{jl}\psi_{ij}\psi^+_{lk}=\sum_i |\langle i_b\lvert \psi\rangle|^2=[\psi\psi^+]_{ik}$$

Here we are taking \(\psi\) as an \(N_a\times N_b\) matrix.

For general case, if we find decomposition

$$\rho=\sum_c \lambda_c\lvert \psi_c\rangle \langle \psi_c\rvert,\quad \sum_c \lambda_c=1$$

then we have

$$\rho^{(a)}_{ik}=\left[\sum_c\lambda_c\psi_c\psi^+_c\right]_{ik}$$
more ...

ipynb2pelican Plugin released!

Yet another Pelican Plugin for blogging with Jupyter Notebooks using MetaCell to store metadata.

Thanks to super cow power of python, we can finally publish ipynb easily! Below is the README.md from the project at this time.

more ...

24 Game Solver

24 game is an arithmetic game with a simple rule: Given 4 numbers and use + - * / to get 24.

  • A simple example is 1, 2, 3, 4, and you find 1*2*3*4=24
  • A more difficult one is 5, 5, 5, 1, the answer is 5*(5-(1/5))=24, which includes fractions.

24game project provides a powerful C++ solver for the 24 game. And you can play with the PyQt5 based graphical front end.

more ...

Jupyter Notebook的配置

默认目录

jupyter notebook --generate-config
vim /home/zpj/.jupyter/jupyter_notebook_config.py#查找dir设定notebook根目录

找到c.NotebookApp.notebook_dir条目,修改为启动jupyter后打开的目录,如/home/zpj/code

more ...


NaCl离子晶体晶格能的研究

这是我的大一化学原理小论文

离子晶体晶格能,主要成分为静电势能,计算出每个离子的电势能后就可以估算出其晶格能。由于晶体结构是无限延伸的,所以必然要求一些无穷级数的和。这个级数难以求出精确值。由实际意义知其必然收敛,因此可以用计算机进行相应计算。对于NaCl晶体,设相邻异性离子产生的电势能为\(E_0\)\(E_1\)是某个离子和其他离子作用的电势能。定义Madelung常数\(k=E_1/E_0\)。编写C语言程序计算出

$$k=1.74756459463, \quad E_1=kE_0=-8.95\rm{eV}$$

设晶体有\(2N\)个离子,则总能量为\(NE_1\)

#include <stdio.h>
#include <math.h>
#define N 1000//计算的层数
int main(){
    double a=0.,b=0.,c=0.,s=0.,t=0.;
    int m, i, j;
    for(m=1; m<N+1; m++){
        a=(1-(m%2)*2)/(double)m;//*6 面
        b=(1-(m%2)*2)/sqrt(3*m*m);//*8 点
        c=1/sqrt(2*m*m);//*12 边
        for(i=1;i<m;i++){
            for(j=0;j<m;j++){
                a+=4*(1-((m+i+j)%2)*2)/sqrt(m*m+i*i+j*j);//*24
            }
            c+=2*(1-(i%2)*2)/sqrt(2*m*m+i*i);
        }
        t=a*6+b*8+c*12;
        if (m%10 == 0){
            printf("t[%4d]=%9lf\t\ts=%.15lf\t\ts2=%lf\n",m,t,s+a*3+b+c*3,s+t);
        }
        s+=t;
    }
    s=s-t+a*3+b+c*3;
    printf("s[%4d]=%.15lf\n", N, s);
    return 0;
}
more ...