Last active
January 24, 2020 19:48
-
-
Save 7shi/713441286a21a625b4ad286fb373547c to your computer and use it in GitHub Desktop.
[Jupyter] generate gamma matrices by octonions
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 IPython.display import display, Math\n", | |
"from sympy import *\n", | |
"from sympy.physics.quantum import TensorProduct\n", | |
"from itertools import combinations" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{array}{r|rrrrrrr}e_0&e_1&e_2&e_3&e_4&e_5&e_6&e_7\\\\\\hline e_1&-e_0&e_3&-e_2&e_5&-e_4&-e_7&e_6\\\\e_2&-e_3&-e_0&e_1&e_6&e_7&-e_4&-e_5\\\\e_3&e_2&-e_1&-e_0&e_7&-e_6&e_5&-e_4\\\\e_4&-e_5&-e_6&-e_7&-e_0&e_1&e_2&e_3\\\\e_5&e_4&-e_7&e_6&-e_1&-e_0&-e_3&e_2\\\\e_6&e_7&e_4&-e_5&-e_2&e_3&-e_0&-e_1\\\\e_7&-e_6&e_5&e_4&-e_3&-e_2&e_1&-e_0\\end{array}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"table = [[(0, 0)] * 8 for i in range(8)]\n", | |
"table[0][0] = (1, 0) # e_0 e_0 = 1 e_0\n", | |
"for i in range(1, 8):\n", | |
" table[0][i] = table[i][0] = (1, i)\n", | |
" table[i][i] = (-1, 0) # e_i e_i = -1 e_0 (i > 0)\n", | |
"def settable(x,y,z):\n", | |
" table[x][y] = (1, z); table[y][x] = (-1, z)\n", | |
" table[y][z] = (1, x); table[z][y] = (-1, x)\n", | |
" table[z][x] = (1, y); table[x][z] = (-1, y)\n", | |
"settable(1,2,3)\n", | |
"settable(1,4,5) # Fano plane\n", | |
"settable(2,4,6) #\n", | |
"settable(3,4,7) # 5\n", | |
"settable(5,3,6) # 342\n", | |
"settable(6,1,7) # 6 1 7\n", | |
"settable(7,2,5)\n", | |
"tablemath = r\"\\begin{array}{r|rrrrrrr}\"\n", | |
"def estr(ne):\n", | |
" return (\"-\" if ne[0] == -1 else \"\") + \"e_\" + str(ne[1])\n", | |
"for i in range(8):\n", | |
" if i > 0: tablemath += r\"\\\\\\hline \" if i == 1 else r\"\\\\\"\n", | |
" tablemath += \"&\".join([estr(table[i][j]) for j in range(8)])\n", | |
"tablemath += r\"\\end{array}\"\n", | |
"display(Math(tablemath))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"f = [[[0] * 8 for i in range(8)] for j in range(8)]\n", | |
"for i in range(8):\n", | |
" for j in range(8):\n", | |
" n, e = table[i][j]\n", | |
" f[i][j][e] = n\n", | |
"l = [-Matrix(f[i]) for i in range(8)]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{1}=\\left(\\begin{array}{rr|rr|rr|rr}0&-1&0&0&0&0&0&0\\\\1&0&0&0&0&0&0&0\\\\\\hline 0&0&0&-1&0&0&0&0\\\\0&0&1&0&0&0&0&0\\\\\\hline 0&0&0&0&0&-1&0&0\\\\0&0&0&0&1&0&0&0\\\\\\hline 0&0&0&0&0&0&0&1\\\\0&0&0&0&0&0&-1&0\\end{array}\\right),\\quad\\lambda_{2}=\\left(\\begin{array}{rr|rr|rr|rr}0&0&-1&0&0&0&0&0\\\\0&0&0&1&0&0&0&0\\\\\\hline 1&0&0&0&0&0&0&0\\\\0&-1&0&0&0&0&0&0\\\\\\hline 0&0&0&0&0&0&-1&0\\\\0&0&0&0&0&0&0&-1\\\\\\hline 0&0&0&0&1&0&0&0\\\\0&0&0&0&0&1&0&0\\end{array}\\right),$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{3}=\\left(\\begin{array}{rr|rr|rr|rr}0&0&0&-1&0&0&0&0\\\\0&0&-1&0&0&0&0&0\\\\\\hline 0&1&0&0&0&0&0&0\\\\1&0&0&0&0&0&0&0\\\\\\hline 0&0&0&0&0&0&0&-1\\\\0&0&0&0&0&0&1&0\\\\\\hline 0&0&0&0&0&-1&0&0\\\\0&0&0&0&1&0&0&0\\end{array}\\right),\\quad\\lambda_{4}=\\left(\\begin{array}{rr|rr|rr|rr}0&0&0&0&-1&0&0&0\\\\0&0&0&0&0&1&0&0\\\\\\hline 0&0&0&0&0&0&1&0\\\\0&0&0&0&0&0&0&1\\\\\\hline 1&0&0&0&0&0&0&0\\\\0&-1&0&0&0&0&0&0\\\\\\hline 0&0&-1&0&0&0&0&0\\\\0&0&0&-1&0&0&0&0\\end{array}\\right),$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{5}=\\left(\\begin{array}{rr|rr|rr|rr}0&0&0&0&0&-1&0&0\\\\0&0&0&0&-1&0&0&0\\\\\\hline 0&0&0&0&0&0&0&1\\\\0&0&0&0&0&0&-1&0\\\\\\hline 0&1&0&0&0&0&0&0\\\\1&0&0&0&0&0&0&0\\\\\\hline 0&0&0&1&0&0&0&0\\\\0&0&-1&0&0&0&0&0\\end{array}\\right),\\quad\\lambda_{6}=\\left(\\begin{array}{rr|rr|rr|rr}0&0&0&0&0&0&-1&0\\\\0&0&0&0&0&0&0&-1\\\\\\hline 0&0&0&0&-1&0&0&0\\\\0&0&0&0&0&1&0&0\\\\\\hline 0&0&1&0&0&0&0&0\\\\0&0&0&-1&0&0&0&0\\\\\\hline 1&0&0&0&0&0&0&0\\\\0&1&0&0&0&0&0&0\\end{array}\\right),$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{7}=\\left(\\begin{array}{rr|rr|rr|rr}0&0&0&0&0&0&0&-1\\\\0&0&0&0&0&0&1&0\\\\\\hline 0&0&0&0&0&-1&0&0\\\\0&0&0&0&-1&0&0&0\\\\\\hline 0&0&0&1&0&0&0&0\\\\0&0&1&0&0&0&0&0\\\\\\hline 0&-1&0&0&0&0&0&0\\\\1&0&0&0&0&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"def mat2math(m):\n", | |
" math = r\"\\left(\\begin{array}{rr|rr|rr|rr}\"\n", | |
" for i in range(8):\n", | |
" if i > 0: math += r\"\\\\\\hline \" if i % 2 == 0 else r\"\\\\\"\n", | |
" math += \"&\".join([str(m[i,j]) for j in range(8)])\n", | |
" return math + r\"\\end{array}\\right)\"\n", | |
"def getlambda(i):\n", | |
" return r\"\\lambda_{%s}=%s\" % (i, mat2math(l[i]))\n", | |
"for i in range(1, 8, 2):\n", | |
" math = getlambda(i)\n", | |
" if i < 7: math += \",\\quad\" + getlambda(i + 1) + \",\"\n", | |
" display(Math(math))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 1: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 2: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 3: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 4: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 5: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'1 7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2 2: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2 3: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2 4: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2 5: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2 6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2 7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'3 3: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'3 4: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'3 5: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'3 6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'3 7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'4 4: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'4 5: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'4 6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'4 7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'5 5: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'5 6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'5 7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'6 6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'6 7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"for i in range(1, 7):\n", | |
" for j in range(i, 8):\n", | |
" if i == j:\n", | |
" display(\"%d %d: %s\" % (i, j, l[i] ** 2 == -eye(8)))\n", | |
" else:\n", | |
" display(\"%d %d: %s\" % (i, j, l[i] * l[j] == -l[j] * l[i]))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'1: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'2: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'3: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'4: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'5: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'6: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"'7: True'" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"for i in range(1, 8):\n", | |
" display(\"%d: %s\" % (i, l[i].T == -l[i]))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle 1=\\left[\\begin{matrix}1 & 0\\\\0 & 1\\end{matrix}\\right],\\quad i=\\left[\\begin{matrix}0 & -1\\\\1 & 0\\end{matrix}\\right],\\quad j=\\left[\\begin{matrix}0 & 1\\\\1 & 0\\end{matrix}\\right],\\quad k=\\left[\\begin{matrix}-1 & 0\\\\0 & 1\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"spqi = Matrix([[0,-1],[1,0]])\n", | |
"spqj = Matrix([[0,1],[1,0]])\n", | |
"spqk = spqi*spqj\n", | |
"spq = [eye(2), spqi, spqj, spqk]\n", | |
"spqs = list(symbols(\"1 i j k\"))\n", | |
"def latex1(s):\n", | |
" return latex(s.subs(spqs[0], 1))\n", | |
"display(Math(\",\\quad \".join([latex1(spqs[i]) + \"=\" + latex(spq[i]) for i in range(4)])))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{1}=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&- i\\end{array}\\right),\\quad\\lambda_{2}=\\left(\\begin{array}{rr|rr}0&k&0&0\\\\- k&0&0&0\\\\\\hline 0&0&0&-1\\\\0&0&1&0\\end{array}\\right),$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{3}=\\left(\\begin{array}{rr|rr}0&- j&0&0\\\\j&0&0&0\\\\\\hline 0&0&0&i\\\\0&0&i&0\\end{array}\\right),\\quad\\lambda_{4}=\\left(\\begin{array}{rr|rr}0&0&k&0\\\\0&0&0&1\\\\\\hline - k&0&0&0\\\\0&-1&0&0\\end{array}\\right),$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{5}=\\left(\\begin{array}{rr|rr}0&0&- j&0\\\\0&0&0&- i\\\\\\hline j&0&0&0\\\\0&- i&0&0\\end{array}\\right),\\quad\\lambda_{6}=\\left(\\begin{array}{rr|rr}0&0&0&-1\\\\0&0&k&0\\\\\\hline 0&- k&0&0\\\\1&0&0&0\\end{array}\\right),$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{7}=\\left(\\begin{array}{rr|rr}0&0&0&i\\\\0&0&- j&0\\\\\\hline 0&j&0&0\\\\i&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"def getspq(m):\n", | |
" a, b, c, d = m.reshape(1, 4)\n", | |
" elems = [(a+d)/2, (c-b)/2, (b+c)/2, (d-a)/2]\n", | |
" return sum([elems[i] * spqs[i] for i in range(4)])\n", | |
"def convspq(m):\n", | |
" return [[getspq(m[i:i+2, j:j+2]) for j in range(0,m.cols,2)] for i in range(0,m.rows,2)]\n", | |
"def mat2math2(m):\n", | |
" l = convspq(m)\n", | |
" if len(l) < 3:\n", | |
" math = r\"\\begin{pmatrix}%s\\end{pmatrix}\" % r\"\\\\\".join([\"&\".join(map(latex1, l1)) for l1 in l])\n", | |
" else:\n", | |
" math = r\"\\left(\\begin{array}{rr|rr}\"\n", | |
" for i in range(len(l)):\n", | |
" if i > 0: math += r\"\\\\\\hline \" if i % 2 == 0 else r\"\\\\\"\n", | |
" math += \"&\".join(map(latex1, l[i]))\n", | |
" math += r\"\\end{array}\\right)\"\n", | |
" return math\n", | |
"def getlambdaspq(i):\n", | |
" return r\"\\lambda_{%s}=%s\" % (i, mat2math2(l[i]))\n", | |
"for i in range(1, 8, 2):\n", | |
" math = getlambdaspq(i)\n", | |
" if i < 7: math += \",\\quad\" + getlambdaspq(i + 1) + \",\"\n", | |
" display(Math(math))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_1 \\lambda_2=\\left(\\begin{array}{rr|rr}0&- j&0&0\\\\j&0&0&0\\\\\\hline 0&0&0&- i\\\\0&0&- i&0\\end{array}\\right),\\quad \\lambda_3=\\left(\\begin{array}{rr|rr}0&- j&0&0\\\\j&0&0&0\\\\\\hline 0&0&0&i\\\\0&0&i&0\\end{array}\\right),\\quad \\lambda_1 \\lambda_2-\\lambda_3=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&0&0\\\\\\hline 0&0&0&- 2 i\\\\0&0&- 2 i&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_1 \\lambda_3=\\left(\\begin{array}{rr|rr}0&- k&0&0\\\\k&0&0&0\\\\\\hline 0&0&0&-1\\\\0&0&1&0\\end{array}\\right),\\quad -\\lambda_2=\\left(\\begin{array}{rr|rr}0&- k&0&0\\\\k&0&0&0\\\\\\hline 0&0&0&1\\\\0&0&-1&0\\end{array}\\right),\\quad \\lambda_1 \\lambda_3+\\lambda_2=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&0&0\\\\\\hline 0&0&0&-2\\\\0&0&2&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_1 \\lambda_4=\\left(\\begin{array}{rr|rr}0&0&- j&0\\\\0&0&0&i\\\\\\hline j&0&0&0\\\\0&i&0&0\\end{array}\\right),\\quad \\lambda_5=\\left(\\begin{array}{rr|rr}0&0&- j&0\\\\0&0&0&- i\\\\\\hline j&0&0&0\\\\0&- i&0&0\\end{array}\\right),\\quad \\lambda_1 \\lambda_4-\\lambda_5=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&0&2 i\\\\\\hline 0&0&0&0\\\\0&2 i&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_1 \\lambda_5=\\left(\\begin{array}{rr|rr}0&0&- k&0\\\\0&0&0&1\\\\\\hline k&0&0&0\\\\0&-1&0&0\\end{array}\\right),\\quad -\\lambda_4=\\left(\\begin{array}{rr|rr}0&0&- k&0\\\\0&0&0&-1\\\\\\hline k&0&0&0\\\\0&1&0&0\\end{array}\\right),\\quad \\lambda_1 \\lambda_5+\\lambda_4=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&0&2\\\\\\hline 0&0&0&0\\\\0&-2&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_1 \\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&- i\\\\0&0&- j&0\\\\\\hline 0&j&0&0\\\\- i&0&0&0\\end{array}\\right),\\quad -\\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&- i\\\\0&0&j&0\\\\\\hline 0&- j&0&0\\\\- i&0&0&0\\end{array}\\right),\\quad \\lambda_1 \\lambda_6+\\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&- 2 j&0\\\\\\hline 0&2 j&0&0\\\\0&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_1 \\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&-1\\\\0&0&- k&0\\\\\\hline 0&k&0&0\\\\1&0&0&0\\end{array}\\right),\\quad \\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&-1\\\\0&0&k&0\\\\\\hline 0&- k&0&0\\\\1&0&0&0\\end{array}\\right),\\quad \\lambda_1 \\lambda_7-\\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&- 2 k&0\\\\\\hline 0&2 k&0&0\\\\0&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_2 \\lambda_3=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&- i&0\\\\0&0&0&i\\end{array}\\right),\\quad \\lambda_1=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&- i\\end{array}\\right),\\quad \\lambda_2 \\lambda_3-\\lambda_1=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&0&0&0\\\\\\hline 0&0&- 2 i&0\\\\0&0&0&2 i\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_2 \\lambda_4=\\left(\\begin{array}{rr|rr}0&0&0&k\\\\0&0&-1&0\\\\\\hline 0&1&0&0\\\\- k&0&0&0\\end{array}\\right),\\quad \\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&-1\\\\0&0&k&0\\\\\\hline 0&- k&0&0\\\\1&0&0&0\\end{array}\\right),\\quad \\lambda_2 \\lambda_4-\\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&k + 1\\\\0&0&- k - 1&0\\\\\\hline 0&k + 1&0&0\\\\- k - 1&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_2 \\lambda_5=\\left(\\begin{array}{rr|rr}0&0&0&- j\\\\0&0&i&0\\\\\\hline 0&i&0&0\\\\j&0&0&0\\end{array}\\right),\\quad \\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&i\\\\0&0&- j&0\\\\\\hline 0&j&0&0\\\\i&0&0&0\\end{array}\\right),\\quad \\lambda_2 \\lambda_5-\\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&- i - j\\\\0&0&i + j&0\\\\\\hline 0&i - j&0&0\\\\- i + j&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_2 \\lambda_6=\\left(\\begin{array}{rr|rr}0&0&1&0\\\\0&0&0&k\\\\\\hline -1&0&0&0\\\\0&- k&0&0\\end{array}\\right),\\quad -\\lambda_4=\\left(\\begin{array}{rr|rr}0&0&- k&0\\\\0&0&0&-1\\\\\\hline k&0&0&0\\\\0&1&0&0\\end{array}\\right),\\quad \\lambda_2 \\lambda_6+\\lambda_4=\\left(\\begin{array}{rr|rr}0&0&k + 1&0\\\\0&0&0&k + 1\\\\\\hline - k - 1&0&0&0\\\\0&- k - 1&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_2 \\lambda_7=\\left(\\begin{array}{rr|rr}0&0&- i&0\\\\0&0&0&- j\\\\\\hline - i&0&0&0\\\\0&j&0&0\\end{array}\\right),\\quad -\\lambda_5=\\left(\\begin{array}{rr|rr}0&0&j&0\\\\0&0&0&i\\\\\\hline - j&0&0&0\\\\0&i&0&0\\end{array}\\right),\\quad \\lambda_2 \\lambda_7+\\lambda_5=\\left(\\begin{array}{rr|rr}0&0&- i - j&0\\\\0&0&0&- i - j\\\\\\hline - i + j&0&0&0\\\\0&- i + j&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_3 \\lambda_4=\\left(\\begin{array}{rr|rr}0&0&0&- j\\\\0&0&- i&0\\\\\\hline 0&- i&0&0\\\\j&0&0&0\\end{array}\\right),\\quad \\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&i\\\\0&0&- j&0\\\\\\hline 0&j&0&0\\\\i&0&0&0\\end{array}\\right),\\quad \\lambda_3 \\lambda_4-\\lambda_7=\\left(\\begin{array}{rr|rr}0&0&0&- i - j\\\\0&0&- i + j&0\\\\\\hline 0&- i - j&0&0\\\\- i + j&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_3 \\lambda_5=\\left(\\begin{array}{rr|rr}0&0&0&- k\\\\0&0&-1&0\\\\\\hline 0&1&0&0\\\\k&0&0&0\\end{array}\\right),\\quad -\\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&1\\\\0&0&- k&0\\\\\\hline 0&k&0&0\\\\-1&0&0&0\\end{array}\\right),\\quad \\lambda_3 \\lambda_5+\\lambda_6=\\left(\\begin{array}{rr|rr}0&0&0&- k - 1\\\\0&0&k - 1&0\\\\\\hline 0&1 - k&0&0\\\\k + 1&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_3 \\lambda_6=\\left(\\begin{array}{rr|rr}0&0&i&0\\\\0&0&0&- j\\\\\\hline i&0&0&0\\\\0&j&0&0\\end{array}\\right),\\quad \\lambda_5=\\left(\\begin{array}{rr|rr}0&0&- j&0\\\\0&0&0&- i\\\\\\hline j&0&0&0\\\\0&- i&0&0\\end{array}\\right),\\quad \\lambda_3 \\lambda_6-\\lambda_5=\\left(\\begin{array}{rr|rr}0&0&i + j&0\\\\0&0&0&i - j\\\\\\hline i - j&0&0&0\\\\0&i + j&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_3 \\lambda_7=\\left(\\begin{array}{rr|rr}0&0&1&0\\\\0&0&0&- k\\\\\\hline -1&0&0&0\\\\0&k&0&0\\end{array}\\right),\\quad -\\lambda_4=\\left(\\begin{array}{rr|rr}0&0&- k&0\\\\0&0&0&-1\\\\\\hline k&0&0&0\\\\0&1&0&0\\end{array}\\right),\\quad \\lambda_3 \\lambda_7+\\lambda_4=\\left(\\begin{array}{rr|rr}0&0&k + 1&0\\\\0&0&0&1 - k\\\\\\hline - k - 1&0&0&0\\\\0&k - 1&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_4 \\lambda_5=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&- i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&i\\end{array}\\right),\\quad \\lambda_1=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&- i\\end{array}\\right),\\quad \\lambda_4 \\lambda_5-\\lambda_1=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&- 2 i&0&0\\\\\\hline 0&0&0&0\\\\0&0&0&2 i\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_4 \\lambda_6=\\left(\\begin{array}{rr|rr}0&-1&0&0\\\\1&0&0&0\\\\\\hline 0&0&0&k\\\\0&0&- k&0\\end{array}\\right),\\quad \\lambda_2=\\left(\\begin{array}{rr|rr}0&k&0&0\\\\- k&0&0&0\\\\\\hline 0&0&0&-1\\\\0&0&1&0\\end{array}\\right),\\quad \\lambda_4 \\lambda_6-\\lambda_2=\\left(\\begin{array}{rr|rr}0&- k - 1&0&0\\\\k + 1&0&0&0\\\\\\hline 0&0&0&k + 1\\\\0&0&- k - 1&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_4 \\lambda_7=\\left(\\begin{array}{rr|rr}0&i&0&0\\\\i&0&0&0\\\\\\hline 0&0&0&- j\\\\0&0&j&0\\end{array}\\right),\\quad \\lambda_3=\\left(\\begin{array}{rr|rr}0&- j&0&0\\\\j&0&0&0\\\\\\hline 0&0&0&i\\\\0&0&i&0\\end{array}\\right),\\quad \\lambda_4 \\lambda_7-\\lambda_3=\\left(\\begin{array}{rr|rr}0&i + j&0&0\\\\i - j&0&0&0\\\\\\hline 0&0&0&- i - j\\\\0&0&- i + j&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_5 \\lambda_6=\\left(\\begin{array}{rr|rr}0&- i&0&0\\\\- i&0&0&0\\\\\\hline 0&0&0&- j\\\\0&0&j&0\\end{array}\\right),\\quad -\\lambda_3=\\left(\\begin{array}{rr|rr}0&j&0&0\\\\- j&0&0&0\\\\\\hline 0&0&0&- i\\\\0&0&- i&0\\end{array}\\right),\\quad \\lambda_5 \\lambda_6+\\lambda_3=\\left(\\begin{array}{rr|rr}0&- i - j&0&0\\\\- i + j&0&0&0\\\\\\hline 0&0&0&i - j\\\\0&0&i + j&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_5 \\lambda_7=\\left(\\begin{array}{rr|rr}0&-1&0&0\\\\1&0&0&0\\\\\\hline 0&0&0&- k\\\\0&0&k&0\\end{array}\\right),\\quad \\lambda_2=\\left(\\begin{array}{rr|rr}0&k&0&0\\\\- k&0&0&0\\\\\\hline 0&0&0&-1\\\\0&0&1&0\\end{array}\\right),\\quad \\lambda_5 \\lambda_7-\\lambda_2=\\left(\\begin{array}{rr|rr}0&- k - 1&0&0\\\\k + 1&0&0&0\\\\\\hline 0&0&0&1 - k\\\\0&0&k - 1&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_6 \\lambda_7=\\left(\\begin{array}{rr|rr}- i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&i\\end{array}\\right),\\quad -\\lambda_1=\\left(\\begin{array}{rr|rr}- i&0&0&0\\\\0&- i&0&0\\\\\\hline 0&0&- i&0\\\\0&0&0&i\\end{array}\\right),\\quad \\lambda_6 \\lambda_7+\\lambda_1=\\left(\\begin{array}{rr|rr}0&0&0&0\\\\0&2 i&0&0\\\\\\hline 0&0&2 i&0\\\\0&0&0&0\\end{array}\\right)$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"for i in range(1, 7):\n", | |
" for j in range(i+1, 8):\n", | |
" n, e = table[i][j]\n", | |
" m1 = l[i] * l[j]\n", | |
" m2 = n * l[e]\n", | |
" display(Math(r\"\\lambda_%d \\lambda_%d=%s,\\quad %s\\lambda_%d=%s,\\quad \\lambda_%d \\lambda_%d%s\\lambda_%d=%s\" % (\n", | |
" i, j, mat2math2(m1),\n", | |
" (\"-\" if n == -1 else \"\"), e, mat2math2(m2),\n", | |
" i, j, ((\"-\" if n == 1 else \"+\")), e, mat2math2(m1 - m2)\n", | |
" )))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{aligned}1⊗1&=\\begin{pmatrix}1&0\\\\0&1\\end{pmatrix}&1⊗i&=\\begin{pmatrix}i&0\\\\0&i\\end{pmatrix}&1⊗j&=\\begin{pmatrix}j&0\\\\0&j\\end{pmatrix}&1⊗k&=\\begin{pmatrix}k&0\\\\0&k\\end{pmatrix}&\\\\i⊗1&=\\begin{pmatrix}0&-1\\\\1&0\\end{pmatrix}&i⊗i&=\\begin{pmatrix}0&- i\\\\i&0\\end{pmatrix}&i⊗j&=\\begin{pmatrix}0&- j\\\\j&0\\end{pmatrix}&i⊗k&=\\begin{pmatrix}0&- k\\\\k&0\\end{pmatrix}&\\\\j⊗1&=\\begin{pmatrix}0&1\\\\1&0\\end{pmatrix}&j⊗i&=\\begin{pmatrix}0&i\\\\i&0\\end{pmatrix}&j⊗j&=\\begin{pmatrix}0&j\\\\j&0\\end{pmatrix}&j⊗k&=\\begin{pmatrix}0&k\\\\k&0\\end{pmatrix}&\\\\k⊗1&=\\begin{pmatrix}-1&0\\\\0&1\\end{pmatrix}&k⊗i&=\\begin{pmatrix}- i&0\\\\0&i\\end{pmatrix}&k⊗j&=\\begin{pmatrix}- j&0\\\\0&j\\end{pmatrix}&k⊗k&=\\begin{pmatrix}- k&0\\\\0&k\\end{pmatrix}&\\end{aligned}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"def tensorspq(i):\n", | |
" return \"%s⊗%s\" % (\"1ijk\"[int(i / 4)], \"1ijk\"[i % 4])\n", | |
"spq2 = []\n", | |
"spq2s = []\n", | |
"math = r\"\\begin{aligned}\"\n", | |
"for i in range(4):\n", | |
" for j in range(4):\n", | |
" m = TensorProduct(spq[i], spq[j])\n", | |
" n = tensorspq(i * 4 + j)\n", | |
" spq2 += [m]\n", | |
" spq2s += [Symbol(n)]\n", | |
" math += \"%s&=%s&\" % (n, mat2math2(m))\n", | |
" if i < 3: math += r\"\\\\\"\n", | |
"display(Math(math + r\"\\end{aligned}\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{aligned}\\frac{1⊗1 - k⊗1}2&=\\begin{pmatrix}1&0\\\\0&0\\end{pmatrix}&\\frac{1⊗i - k⊗i}2&=\\begin{pmatrix}i&0\\\\0&0\\end{pmatrix}&\\frac{1⊗j - k⊗j}2&=\\begin{pmatrix}j&0\\\\0&0\\end{pmatrix}&\\frac{1⊗k - k⊗k}2&=\\begin{pmatrix}k&0\\\\0&0\\end{pmatrix}&\\\\\\frac{-i⊗1 + j⊗1}2&=\\begin{pmatrix}0&1\\\\0&0\\end{pmatrix}&\\frac{-i⊗i + j⊗i}2&=\\begin{pmatrix}0&i\\\\0&0\\end{pmatrix}&\\frac{-i⊗j + j⊗j}2&=\\begin{pmatrix}0&j\\\\0&0\\end{pmatrix}&\\frac{-i⊗k + j⊗k}2&=\\begin{pmatrix}0&k\\\\0&0\\end{pmatrix}&\\\\\\frac{i⊗1 + j⊗1}2&=\\begin{pmatrix}0&0\\\\1&0\\end{pmatrix}&\\frac{i⊗i + j⊗i}2&=\\begin{pmatrix}0&0\\\\i&0\\end{pmatrix}&\\frac{i⊗j + j⊗j}2&=\\begin{pmatrix}0&0\\\\j&0\\end{pmatrix}&\\frac{i⊗k + j⊗k}2&=\\begin{pmatrix}0&0\\\\k&0\\end{pmatrix}&\\\\\\frac{1⊗1 + k⊗1}2&=\\begin{pmatrix}0&0\\\\0&1\\end{pmatrix}&\\frac{1⊗i + k⊗i}2&=\\begin{pmatrix}0&0\\\\0&i\\end{pmatrix}&\\frac{1⊗j + k⊗j}2&=\\begin{pmatrix}0&0\\\\0&j\\end{pmatrix}&\\frac{1⊗k + k⊗k}2&=\\begin{pmatrix}0&0\\\\0&k\\end{pmatrix}&\\end{aligned}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"tsb = [[None] * 4 for i in range(4)]\n", | |
"tsbs = [[None] * 4 for i in range(4)]\n", | |
"for i in range(16):\n", | |
" for j in range(16):\n", | |
" for k in [1, -1] if i < j else [-1]:\n", | |
" m = (spq2[i] + k * spq2[j]) / 2\n", | |
" s = (spq2s[i] + k * spq2s[j]) / 2\n", | |
" elems = (lambda t: t[0] + t[1])(convspq(m))\n", | |
" p = -1\n", | |
" for index in range(4):\n", | |
" if elems[index] == 0:\n", | |
" continue\n", | |
" if p != -1:\n", | |
" p = -1\n", | |
" break\n", | |
" p = index\n", | |
" if p != -1:\n", | |
" elem = latex(elems[p])\n", | |
" if elem[0] != '-':\n", | |
" b = \"1ijk\".index(elem)\n", | |
" tsb [p][b] = m\n", | |
" tsbs[p][b] = s\n", | |
"math = r\"\\begin{aligned}\"\n", | |
"for i in range(4):\n", | |
" for j in range(4):\n", | |
" math += r\"\\frac{%s}2&=%s&\" % (tsbs[i][j] * 2, mat2math2(tsb[i][j]))\n", | |
" if i < 3: math += r\"\\\\\"\n", | |
"display(Math(math + r\"\\end{aligned}\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{1}=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&- i\\end{array}\\right)=\\left[\\begin{matrix}1⊗i & 0\\\\0 & - k⊗i\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{2}=\\left(\\begin{array}{rr|rr}0&k&0&0\\\\- k&0&0&0\\\\\\hline 0&0&0&-1\\\\0&0&1&0\\end{array}\\right)=\\left[\\begin{matrix}- i⊗k & 0\\\\0 & i⊗1\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{3}=\\left(\\begin{array}{rr|rr}0&- j&0&0\\\\j&0&0&0\\\\\\hline 0&0&0&i\\\\0&0&i&0\\end{array}\\right)=\\left[\\begin{matrix}i⊗j & 0\\\\0 & j⊗i\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{4}=\\left(\\begin{array}{rr|rr}0&0&k&0\\\\0&0&0&1\\\\\\hline - k&0&0&0\\\\0&-1&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & \\frac{1⊗1}{2} + \\frac{1⊗k}{2} + \\frac{k⊗1}{2} - \\frac{k⊗k}{2}\\\\- \\frac{1⊗1}{2} - \\frac{1⊗k}{2} - \\frac{k⊗1}{2} + \\frac{k⊗k}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{5}=\\left(\\begin{array}{rr|rr}0&0&- j&0\\\\0&0&0&- i\\\\\\hline j&0&0&0\\\\0&- i&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & - \\frac{1⊗i}{2} - \\frac{1⊗j}{2} - \\frac{k⊗i}{2} + \\frac{k⊗j}{2}\\\\- \\frac{1⊗i}{2} + \\frac{1⊗j}{2} - \\frac{k⊗i}{2} - \\frac{k⊗j}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{6}=\\left(\\begin{array}{rr|rr}0&0&0&-1\\\\0&0&k&0\\\\\\hline 0&- k&0&0\\\\1&0&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & \\frac{i⊗1}{2} + \\frac{i⊗k}{2} - \\frac{j⊗1}{2} + \\frac{j⊗k}{2}\\\\\\frac{i⊗1}{2} + \\frac{i⊗k}{2} + \\frac{j⊗1}{2} - \\frac{j⊗k}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{7}=\\left(\\begin{array}{rr|rr}0&0&0&i\\\\0&0&- j&0\\\\\\hline 0&j&0&0\\\\i&0&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & - \\frac{i⊗i}{2} - \\frac{i⊗j}{2} + \\frac{j⊗i}{2} - \\frac{j⊗j}{2}\\\\\\frac{i⊗i}{2} - \\frac{i⊗j}{2} + \\frac{j⊗i}{2} + \\frac{j⊗j}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"def gettsb(m):\n", | |
" ret = 0\n", | |
" for i in range(2):\n", | |
" for j in range(2):\n", | |
" p = i * 2 + j\n", | |
" b = [(spqs[k], tsbs[p][k]) for k in range(4)]\n", | |
" ret += getspq(m[i*2:i*2+2,j*2:j*2+2]).subs(b)\n", | |
" return ret\n", | |
"def convtsb(m):\n", | |
" return Matrix([[gettsb(m[i:i+4, j:j+4]) for j in range(0,m.cols,4)] for i in range(0,m.rows,4)])\n", | |
"for i in range(1, 8):\n", | |
" display(Math(getlambdaspq(i) + \"=\" + latex(convtsb(l[i]))))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{aligned}1&=\\begin{pmatrix}1&0\\\\0&1\\end{pmatrix}=1⊗1&γ_{1}&=\\begin{pmatrix}0&j\\\\j&0\\end{pmatrix}=j⊗j&γ_{1}γ_{2}&=\\begin{pmatrix}i&0\\\\0&i\\end{pmatrix}=1⊗i&γ_{1}γ_{2}γ_{3}&=\\begin{pmatrix}i&0\\\\0&- i\\end{pmatrix}=- k⊗i&γ_{1}γ_{2}γ_{3}γ_{4}&=\\begin{pmatrix}0&i\\\\i&0\\end{pmatrix}=j⊗i&\\\\&&γ_{2}&=\\begin{pmatrix}0&- k\\\\- k&0\\end{pmatrix}=- j⊗k&γ_{1}γ_{3}&=\\begin{pmatrix}0&- j\\\\j&0\\end{pmatrix}=i⊗j&γ_{1}γ_{2}γ_{4}&=\\begin{pmatrix}0&i\\\\- i&0\\end{pmatrix}=- i⊗i&&&\\\\&&γ_{3}&=\\begin{pmatrix}1&0\\\\0&-1\\end{pmatrix}=- k⊗1&γ_{1}γ_{4}&=\\begin{pmatrix}- j&0\\\\0&j\\end{pmatrix}=k⊗j&γ_{1}γ_{3}γ_{4}&=\\begin{pmatrix}j&0\\\\0&j\\end{pmatrix}=1⊗j&&&\\\\&&γ_{4}&=\\begin{pmatrix}0&1\\\\-1&0\\end{pmatrix}=- i⊗1&γ_{2}γ_{3}&=\\begin{pmatrix}0&k\\\\- k&0\\end{pmatrix}=- i⊗k&γ_{2}γ_{3}γ_{4}&=\\begin{pmatrix}- k&0\\\\0&- k\\end{pmatrix}=- 1⊗k&&&\\\\&&&&γ_{2}γ_{4}&=\\begin{pmatrix}k&0\\\\0&- k\\end{pmatrix}=- k⊗k&&&&&\\\\&&&&γ_{3}γ_{4}&=\\begin{pmatrix}0&1\\\\1&0\\end{pmatrix}=j⊗1&&&&&\\end{aligned}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"# K. Scharnhorst; A special irreducible matrix representationof the real Clifford algebra C(3,1)\n", | |
"# https://cds.cern.ch/record/340609/files/9712113.pdf\n", | |
"g = [eye(4)] + list(map(Matrix, [\n", | |
" [[0,0,0,1],[0,0,1,0],[0,1,0,0],[1,0,0,0]],\n", | |
" [[0,0,1,0],[0,0,0,-1],[1,0,0,0],[0,-1,0,0]],\n", | |
" [[1,0,0,0],[0,1,0,0],[0,0,-1,0],[0,0,0,-1]],\n", | |
" [[0,0,1,0],[0,0,0,1],[-1,0,0,0],[0,-1,0,0]]\n", | |
"]))\n", | |
"stab = [[[0]]] + [list(combinations([1, 2, 3, 4], i)) for i in range(1, 5)]\n", | |
"sta = []\n", | |
"stas = []\n", | |
"def staname(b):\n", | |
" return \"1\" if cmb == [0] else \"\".join([\"γ_{%d}\" % i for i in cmb])\n", | |
"for grade in stab:\n", | |
" for cmb in grade:\n", | |
" m = prod([g[i] for i in cmb])\n", | |
" sta += [m]\n", | |
" stas += [Symbol(staname(cmb))]\n", | |
"math = r\"\\begin{aligned}\"\n", | |
"for i in range(0, 6):\n", | |
" for j in range(0, 5):\n", | |
" if len(stab[j]) <= i:\n", | |
" math += \"&&\"\n", | |
" else:\n", | |
" cmb = stab[j][i]\n", | |
" n = staname(cmb)\n", | |
" m = prod([g[i] for i in cmb])\n", | |
" math += \"%s&=%s=%s&\" % (n, mat2math2(m), latex(gettsb(m)))\n", | |
" if i < 5: math += r\"\\\\\"\n", | |
"display(Math(math + r\"\\end{aligned}\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\begin{aligned}\\frac{1 + γ_{3}}2&=\\begin{pmatrix}1&0\\\\0&0\\end{pmatrix}&\\frac{γ_{1}γ_{2} + γ_{1}γ_{2}γ_{3}}2&=\\begin{pmatrix}i&0\\\\0&0\\end{pmatrix}&\\frac{γ_{1}γ_{3}γ_{4} - γ_{1}γ_{4}}2&=\\begin{pmatrix}j&0\\\\0&0\\end{pmatrix}&\\frac{-γ_{2}γ_{3}γ_{4} + γ_{2}γ_{4}}2&=\\begin{pmatrix}k&0\\\\0&0\\end{pmatrix}&\\\\\\frac{γ_{3}γ_{4} + γ_{4}}2&=\\begin{pmatrix}0&1\\\\0&0\\end{pmatrix}&\\frac{γ_{1}γ_{2}γ_{3}γ_{4} + γ_{1}γ_{2}γ_{4}}2&=\\begin{pmatrix}0&i\\\\0&0\\end{pmatrix}&\\frac{γ_{1} - γ_{1}γ_{3}}2&=\\begin{pmatrix}0&j\\\\0&0\\end{pmatrix}&\\frac{-γ_{2} + γ_{2}γ_{3}}2&=\\begin{pmatrix}0&k\\\\0&0\\end{pmatrix}&\\\\\\frac{γ_{3}γ_{4} - γ_{4}}2&=\\begin{pmatrix}0&0\\\\1&0\\end{pmatrix}&\\frac{γ_{1}γ_{2}γ_{3}γ_{4} - γ_{1}γ_{2}γ_{4}}2&=\\begin{pmatrix}0&0\\\\i&0\\end{pmatrix}&\\frac{γ_{1} + γ_{1}γ_{3}}2&=\\begin{pmatrix}0&0\\\\j&0\\end{pmatrix}&\\frac{-γ_{2} - γ_{2}γ_{3}}2&=\\begin{pmatrix}0&0\\\\k&0\\end{pmatrix}&\\\\\\frac{1 - γ_{3}}2&=\\begin{pmatrix}0&0\\\\0&1\\end{pmatrix}&\\frac{γ_{1}γ_{2} - γ_{1}γ_{2}γ_{3}}2&=\\begin{pmatrix}0&0\\\\0&i\\end{pmatrix}&\\frac{γ_{1}γ_{3}γ_{4} + γ_{1}γ_{4}}2&=\\begin{pmatrix}0&0\\\\0&j\\end{pmatrix}&\\frac{-γ_{2}γ_{3}γ_{4} - γ_{2}γ_{4}}2&=\\begin{pmatrix}0&0\\\\0&k\\end{pmatrix}&\\end{aligned}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"stb = [[None] * 4 for i in range(4)]\n", | |
"stbs = [[None] * 4 for i in range(4)]\n", | |
"for i in range(16):\n", | |
" for j in range(16):\n", | |
" for k1, k2 in [(1, 1), (-1, -1), (1, -1)] if i < j else [(1, -1)]:\n", | |
" m = (k1 * sta[i] + k2 * sta[j]) / 2\n", | |
" s = (k1 * stas[i] + k2 * stas[j]) / 2\n", | |
" elems = (lambda t: t[0] + t[1])(convspq(m))\n", | |
" p = -1\n", | |
" for index in range(4):\n", | |
" if elems[index] == 0:\n", | |
" continue\n", | |
" if p != -1:\n", | |
" p = -1\n", | |
" break\n", | |
" p = index\n", | |
" if p != -1:\n", | |
" elem = latex(elems[p])\n", | |
" if elem[0] != '-':\n", | |
" b = \"1ijk\".index(elem)\n", | |
" stb [p][b] = m\n", | |
" stbs[p][b] = s\n", | |
"math = r\"\\begin{aligned}\"\n", | |
"for i in range(4):\n", | |
" for j in range(4):\n", | |
" math += r\"\\frac{%s}2&=%s&\" % (stbs[i][j] * 2, mat2math2(stb[i][j]))\n", | |
" if i < 3: math += r\"\\\\\"\n", | |
"display(Math(math + r\"\\end{aligned}\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{1}=\\left(\\begin{array}{rr|rr}i&0&0&0\\\\0&i&0&0\\\\\\hline 0&0&i&0\\\\0&0&0&- i\\end{array}\\right)=\\left[\\begin{matrix}γ_{1}γ_{2} & 0\\\\0 & γ_{1}γ_{2}γ_{3}\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{2}=\\left(\\begin{array}{rr|rr}0&k&0&0\\\\- k&0&0&0\\\\\\hline 0&0&0&-1\\\\0&0&1&0\\end{array}\\right)=\\left[\\begin{matrix}γ_{2}γ_{3} & 0\\\\0 & - γ_{4}\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{3}=\\left(\\begin{array}{rr|rr}0&- j&0&0\\\\j&0&0&0\\\\\\hline 0&0&0&i\\\\0&0&i&0\\end{array}\\right)=\\left[\\begin{matrix}γ_{1}γ_{3} & 0\\\\0 & γ_{1}γ_{2}γ_{3}γ_{4}\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{4}=\\left(\\begin{array}{rr|rr}0&0&k&0\\\\0&0&0&1\\\\\\hline - k&0&0&0\\\\0&-1&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & \\frac{1}{2} - \\frac{γ_{2}γ_{3}γ_{4}}{2} + \\frac{γ_{2}γ_{4}}{2} - \\frac{γ_{3}}{2}\\\\- \\frac{1}{2} + \\frac{γ_{2}γ_{3}γ_{4}}{2} - \\frac{γ_{2}γ_{4}}{2} + \\frac{γ_{3}}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{5}=\\left(\\begin{array}{rr|rr}0&0&- j&0\\\\0&0&0&- i\\\\\\hline j&0&0&0\\\\0&- i&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & - \\frac{γ_{1}γ_{2}}{2} + \\frac{γ_{1}γ_{2}γ_{3}}{2} - \\frac{γ_{1}γ_{3}γ_{4}}{2} + \\frac{γ_{1}γ_{4}}{2}\\\\- \\frac{γ_{1}γ_{2}}{2} + \\frac{γ_{1}γ_{2}γ_{3}}{2} + \\frac{γ_{1}γ_{3}γ_{4}}{2} - \\frac{γ_{1}γ_{4}}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{6}=\\left(\\begin{array}{rr|rr}0&0&0&-1\\\\0&0&k&0\\\\\\hline 0&- k&0&0\\\\1&0&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & - \\frac{γ_{2}}{2} - \\frac{γ_{2}γ_{3}}{2} - \\frac{γ_{3}γ_{4}}{2} - \\frac{γ_{4}}{2}\\\\\\frac{γ_{2}}{2} - \\frac{γ_{2}γ_{3}}{2} + \\frac{γ_{3}γ_{4}}{2} - \\frac{γ_{4}}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\lambda_{7}=\\left(\\begin{array}{rr|rr}0&0&0&i\\\\0&0&- j&0\\\\\\hline 0&j&0&0\\\\i&0&0&0\\end{array}\\right)=\\left[\\begin{matrix}0 & - \\frac{γ_{1}}{2} + \\frac{γ_{1}γ_{2}γ_{3}γ_{4}}{2} + \\frac{γ_{1}γ_{2}γ_{4}}{2} - \\frac{γ_{1}γ_{3}}{2}\\\\\\frac{γ_{1}}{2} + \\frac{γ_{1}γ_{2}γ_{3}γ_{4}}{2} - \\frac{γ_{1}γ_{2}γ_{4}}{2} - \\frac{γ_{1}γ_{3}}{2} & 0\\end{matrix}\\right]$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"def getstb(m):\n", | |
" ret = 0\n", | |
" for i in range(2):\n", | |
" for j in range(2):\n", | |
" p = i * 2 + j\n", | |
" b = [(spqs[k], stbs[p][k]) for k in range(4)]\n", | |
" ret += getspq(m[i*2:i*2+2,j*2:j*2+2]).subs(b)\n", | |
" return ret\n", | |
"def convstb(m):\n", | |
" return Matrix([[getstb(m[i:i+4, j:j+4]) for j in range(0,m.cols,4)] for i in range(0,m.rows,4)])\n", | |
"for i in range(1, 8):\n", | |
" display(Math(getlambdaspq(i) + \"=\" + latex(convstb(l[i]))))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"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