Created
September 5, 2020 07:11
-
-
Save 7shi/a70574ca3f1f25dd9dad037dfb5c0df9 to your computer and use it in GitHub Desktop.
[Jupyter] Generalized Gell-Mann matrices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from sympy import *\n", | |
"from IPython.display import display, Math" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def range1(n):\n", | |
" return range(1, n + 1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices\n", | |
"\n", | |
"## Generalized Gell-Mann matrices (Hermitian)\n", | |
"\n", | |
"### Construction\n", | |
"\n", | |
"Let $E_{jk}$ be the matrix with $1$ in the $jk$-th entry and $0$ elsewhere. Consider the space of $d×d$ complex matrices, $ℂ^{d×d}$, for a fixed $d$.\n", | |
"\n", | |
"Define the following matrices, \n", | |
"\n", | |
"$f_{k,j}^d =$<br>\n", | |
" $E_{kj} + E_{jk}$, for $k < j$.<br>\n", | |
" $−i (E_{jk} − E_{kj})$, for $k > j$.\n", | |
"\n", | |
"$h_k^d =$<br>\n", | |
" $I_d$, the identity matrix, for $k = 1$.<br>\n", | |
" $h_k^{d−1} ⊕ 0$, for $1 < k < d$.<br>\n", | |
" $\\displaystyle {\\sqrt {\\tfrac {2}{d(d-1)}}}\\left(h_{1}^{d-1}\\oplus (1-d)\\right)={\\sqrt {\\tfrac {2}{d(d-1)}}}\\left(I_{d-1}\\oplus (1-d)\\right)$, for $k = d$." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def E(j, k, d):\n", | |
" return Matrix([[1 if (j, k) == (y, x) else 0 for x in range1(d)] for y in range1(d)])\n", | |
"def f(k, j, d):\n", | |
" if k < j:\n", | |
" return E(k, j, d) + E(j, k, d)\n", | |
" if k > j:\n", | |
" return -I * (E(j, k, d) - E(k, j, d))\n", | |
"def h(k, d):\n", | |
" if k == 1:\n", | |
" return 1, eye(d)\n", | |
" if 1 < k < d:\n", | |
" n, m = h(k, d - 1)\n", | |
" return n, diag(m, 0)\n", | |
" if k == d:\n", | |
" return int(d * (d - 1) / 2), diag(eye(d - 1), 1 - d)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def generate(d):\n", | |
" def g():\n", | |
" for k in range1(d):\n", | |
" for j in range1(d):\n", | |
" if j == k:\n", | |
" yield \"h_{%d}^{%d}\" % (k, d), h(k, d)\n", | |
" else:\n", | |
" yield \"f_{%d,%d}^{%d}\" % (k, j, d), (1, f(k, j, d))\n", | |
" s = r\"\\begin{alignedat}{%d}\" % (d * 2)\n", | |
" for i, (fn, (n, m)) in enumerate(g()):\n", | |
" if i % d > 0:\n", | |
" s += r\",&\\ \"\n", | |
" elif i > 0:\n", | |
" s += r\"\\\\\"\n", | |
" s += f\"{fn}&=\"\n", | |
" if n != 1:\n", | |
" s += r\"\\frac1{\\sqrt{%s}}\" % latex(n)\n", | |
" s += \"&&\" + latex(m)\n", | |
" display(Math(s + r\"\\end{alignedat}\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{alignedat}{4}h_{1}^{2}&=&&\\left[\\begin{matrix}1 & 0\\\\0 & 1\\end{matrix}\\right],&\\ f_{1,2}^{2}&=&&\\left[\\begin{matrix}0 & 1\\\\1 & 0\\end{matrix}\\right]\\\\f_{2,1}^{2}&=&&\\left[\\begin{matrix}0 & - i\\\\i & 0\\end{matrix}\\right],&\\ h_{2}^{2}&=&&\\left[\\begin{matrix}1 & 0\\\\0 & -1\\end{matrix}\\right]\\end{alignedat}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"generate(2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{alignedat}{6}h_{1}^{3}&=&&\\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & 0\\\\0 & 0 & 1\\end{matrix}\\right],&\\ f_{1,2}^{3}&=&&\\left[\\begin{matrix}0 & 1 & 0\\\\1 & 0 & 0\\\\0 & 0 & 0\\end{matrix}\\right],&\\ f_{1,3}^{3}&=&&\\left[\\begin{matrix}0 & 0 & 1\\\\0 & 0 & 0\\\\1 & 0 & 0\\end{matrix}\\right]\\\\f_{2,1}^{3}&=&&\\left[\\begin{matrix}0 & - i & 0\\\\i & 0 & 0\\\\0 & 0 & 0\\end{matrix}\\right],&\\ h_{2}^{3}&=&&\\left[\\begin{matrix}1 & 0 & 0\\\\0 & -1 & 0\\\\0 & 0 & 0\\end{matrix}\\right],&\\ f_{2,3}^{3}&=&&\\left[\\begin{matrix}0 & 0 & 0\\\\0 & 0 & 1\\\\0 & 1 & 0\\end{matrix}\\right]\\\\f_{3,1}^{3}&=&&\\left[\\begin{matrix}0 & 0 & - i\\\\0 & 0 & 0\\\\i & 0 & 0\\end{matrix}\\right],&\\ f_{3,2}^{3}&=&&\\left[\\begin{matrix}0 & 0 & 0\\\\0 & 0 & - i\\\\0 & i & 0\\end{matrix}\\right],&\\ h_{3}^{3}&=\\frac1{\\sqrt{3}}&&\\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & 0\\\\0 & 0 & -2\\end{matrix}\\right]\\end{alignedat}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"generate(3)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{alignedat}{8}h_{1}^{4}&=&&\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right],&\\ f_{1,2}^{4}&=&&\\left[\\begin{matrix}0 & 1 & 0 & 0\\\\1 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{1,3}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 1 & 0\\\\0 & 0 & 0 & 0\\\\1 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{1,4}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 1\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\1 & 0 & 0 & 0\\end{matrix}\\right]\\\\f_{2,1}^{4}&=&&\\left[\\begin{matrix}0 & - i & 0 & 0\\\\i & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ h_{2}^{4}&=&&\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & -1 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{2,3}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{2,4}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 1\\\\0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\end{matrix}\\right]\\\\f_{3,1}^{4}&=&&\\left[\\begin{matrix}0 & 0 & - i & 0\\\\0 & 0 & 0 & 0\\\\i & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{3,2}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & - i & 0\\\\0 & i & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ h_{3}^{4}&=\\frac1{\\sqrt{3}}&&\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & -2 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{3,4}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 1\\\\0 & 0 & 1 & 0\\end{matrix}\\right]\\\\f_{4,1}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & - i\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\i & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{4,2}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & - i\\\\0 & 0 & 0 & 0\\\\0 & i & 0 & 0\\end{matrix}\\right],&\\ f_{4,3}^{4}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & - i\\\\0 & 0 & i & 0\\end{matrix}\\right],&\\ h_{4}^{4}&=\\frac1{\\sqrt{6}}&&\\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & -3\\end{matrix}\\right]\\end{alignedat}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"generate(4)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{alignedat}{10}h_{1}^{5}&=&&\\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & 1 & 0 & 0\\\\0 & 0 & 0 & 1 & 0\\\\0 & 0 & 0 & 0 & 1\\end{matrix}\\right],&\\ f_{1,2}^{5}&=&&\\left[\\begin{matrix}0 & 1 & 0 & 0 & 0\\\\1 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{1,3}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 1 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\1 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{1,4}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 1 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\1 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{1,5}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 1\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\1 & 0 & 0 & 0 & 0\\end{matrix}\\right]\\\\f_{2,1}^{5}&=&&\\left[\\begin{matrix}0 & - i & 0 & 0 & 0\\\\i & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ h_{2}^{5}&=&&\\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\0 & -1 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{2,3}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 1 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{2,4}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 1 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{2,5}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 1\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\end{matrix}\\right]\\\\f_{3,1}^{5}&=&&\\left[\\begin{matrix}0 & 0 & - i & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\i & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{3,2}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & - i & 0 & 0\\\\0 & i & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ h_{3}^{5}&=\\frac1{\\sqrt{3}}&&\\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & -2 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{3,4}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 1 & 0\\\\0 & 0 & 1 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{3,5}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 1\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 1 & 0 & 0\\end{matrix}\\right]\\\\f_{4,1}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & - i & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\i & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{4,2}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & - i & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & i & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{4,3}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & - i & 0\\\\0 & 0 & i & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ h_{4}^{5}&=\\frac1{\\sqrt{6}}&&\\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & 1 & 0 & 0\\\\0 & 0 & 0 & -3 & 0\\\\0 & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{4,5}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 1\\\\0 & 0 & 0 & 1 & 0\\end{matrix}\\right]\\\\f_{5,1}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & - i\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\i & 0 & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{5,2}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & - i\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & i & 0 & 0 & 0\\end{matrix}\\right],&\\ f_{5,3}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & - i\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & i & 0 & 0\\end{matrix}\\right],&\\ f_{5,4}^{5}&=&&\\left[\\begin{matrix}0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & - i\\\\0 & 0 & 0 & i & 0\\end{matrix}\\right],&\\ h_{5}^{5}&=\\frac1{\\sqrt{10}}&&\\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\0 & 1 & 0 & 0 & 0\\\\0 & 0 & 1 & 0 & 0\\\\0 & 0 & 0 & 1 & 0\\\\0 & 0 & 0 & 0 & -4\\end{matrix}\\right]\\end{alignedat}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"generate(5)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment