Skip to content

Instantly share code, notes, and snippets.

@GM3D
Last active January 9, 2023 00:55
Show Gist options
  • Save GM3D/a401e5a09b543f11d54ca593e9a08ade to your computer and use it in GitHub Desktop.
Save GM3D/a401e5a09b543f11d54ca593e9a08ade to your computer and use it in GitHub Desktop.
Documents/Papers/2212.12372 H5C check.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"id": "7f622568",
"cell_type": "code",
"source": "using PolynomialRings",
"execution_count": 5,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"id": "1dfb9214",
"cell_type": "code",
"source": "# since all the quantities in the hamlitonian are commuting, we can do the caluculation in a commutative polynomial ring.\n\nR = @ring! ℚ[σ₁, σ₂, σ₃, σ₄, σ₅, σ₆, σ₇, σ₈, σ₉, σ₁₀]\npaulis = (σ₁, σ₂, σ₃, σ₄, σ₅, σ₆, σ₇, σ₈, σ₉, σ₁₀)",
"execution_count": 8,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 8,
"data": {
"text/plain": "(σ₁, σ₂, σ₃, σ₄, σ₅, σ₆, σ₇, σ₈, σ₉, σ₁₀)"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# this function renders all squares of paulis into 1.\n\nfunction square_of_pauli_is_one(f)\n for z in (σ₁, σ₂, σ₃, σ₄, σ₅, σ₆, σ₇, σ₈, σ₉, σ₁₀)\n f = divrem(f, z^2-1)[2]\n end\n return f\nend\n\nsquare_of_pauli_is_one(σ₇^4 + 1)\n# x^4 + 1 = x^4 - 1 + 2 = (x^2 - 1) * (x^2 + 1) + 2 = 2 mod (x^2 - 1)",
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 9,
"data": {
"text/plain": "2//1"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "cd782540",
"cell_type": "code",
"source": "# n = 3 case gives the correct result.\nx1, x2, x3 = (σ₁-1)/2, (σ₂-1)/2, (σ₃-1)/2\nh31 = (x1 -4*x2 -3*x3)^2\nh32 = (-2*x1 +x2 + 2*x3 + 4)^2\nh33 = (2*x1 + 2*x2 + 4)^2\nh34 = (3*x1 -2*x2 +4*x3 + 2)^2\nHC30 = h31 + h32 + h33 + h34\nHC3 = square_of_pauli_is_one(HC30)\n# HM3 matches with (S51)",
"execution_count": 12,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 12,
"data": {
"text/plain": "-4//1*σ₁*σ₂ + 5//2*σ₁*σ₃ + 3//1*σ₂*σ₃ + -3//2*σ₁ + -7//2*σ₂ + -4//1*σ₃ + 87//2"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "0c3169a8",
"cell_type": "code",
"source": "# n = 5.\n# definition of x_i is read from table S2.\nx1, x2, x3, x4, x5 = (1-σ₁)/2, (σ₂-1)/2, (σ₃-1)/2, (σ₄-1)/2, (σ₅-1)/2",
"execution_count": 13,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 13,
"data": {
"text/plain": "(-1//2*σ₁ + 1//2, 1//2*σ₂ + -1//2, 1//2*σ₃ + -1//2, 1//2*σ₄ + -1//2, 1//2*σ₅ + -1//2)"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "0375efbb",
"cell_type": "code",
"source": "h51 = (6x1 -8x2 + 2x3 -4x4 -4x5 + 2)^2\nh52 = (-4x1 -3x2 + 11x3 -5x4 -3x5 +4)^2\nh53 = (6x1 + 6x2 + 3x3 -0*x4 -3x5 + 9)^2\nh54 = (4x1 -2x2 +0*x3 +12x4 + 4x5 + 8)^2\nh55 = (-2x1 + 2x2 -6x3 -2x4 +x5)^2\nh56 = (-3x1 + 5x2 -3x3 + 4x4 -17x5 + 8)^2",
"execution_count": 14,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 14,
"data": {
"text/plain": "9//4*σ₁^2 + 15//2*σ₁*σ₂ + 25//4*σ₂^2 + -9//2*σ₁*σ₃ + -15//2*σ₂*σ₃ + 9//4*σ₃^2 + 6//1*σ₁*σ₄ + 10//1*σ₂*σ₄ + -6//1*σ₃*σ₄ + 4//1*σ₄^2 + -51//2*σ₁*σ₅ + -85//2*σ₂*σ₅ + 51//2*σ₃*σ₅ + -34//1*σ₄*σ₅ + 289//4*σ₅^2 + 36//1*σ₁ + 60//1*σ₂ + -36//1*σ₃ + 48//1*σ₄ + -204//1*σ₅ + 144//1"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "e5abee6b",
"cell_type": "code",
"source": "HC50 = h51 + h52 + h53 + h54 + h55 + h56\nHC5 = square_of_pauli_is_one(HC50)",
"execution_count": 15,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 15,
"data": {
"text/plain": "27//2*σ₁*σ₂ + -7//2*σ₁*σ₃ + -29//1*σ₂*σ₃ + -18//1*σ₁*σ₄ + 39//2*σ₂*σ₄ + -63//2*σ₃*σ₄ + -35//2*σ₁*σ₅ + -34//1*σ₂*σ₅ + -5//2*σ₃*σ₅ + 9//2*σ₄*σ₅ + -91//1*σ₁ + 9//1*σ₂ + 28//1*σ₃ + 23//1*σ₄ + -543//2*σ₅ + 630//1"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# n = 10\nsigns = (1, 1, -1, -1, 1, -1, 1, -1, 1, -1)\nxs = signs.*[(1-z)/2 for z in paulis]\nD₁₀ = [0 0 3 0 0 0 3 0 -3 -3;0 0 2 0 4 -4 0 4 -2 4; -3 0 0 0 0 0 -3 0 0 0; 1 2 1 4 -4 -2 -2 0 -1 0; 2 0 2 -2 0 0 1 -1 0 4; 0 0 -3 -3 0 0 0 0 -3 3; -3 3 -1 0 1 2 1 2 -2 -1; 0 -2 0 1 2 -1 1 -3 3 -3; 0 -2 -2 0 -2 0 0 0 2 2; 2 -2 0 -2 0 2 -2 2 0 0; 0 -2 -2 0 1 3 1 -2 -2 -1]",
"execution_count": 16,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 16,
"data": {
"text/plain": "11×10 Matrix{Int64}:\n 0 0 3 0 0 0 3 0 -3 -3\n 0 0 2 0 4 -4 0 4 -2 4\n -3 0 0 0 0 0 -3 0 0 0\n 1 2 1 4 -4 -2 -2 0 -1 0\n 2 0 2 -2 0 0 1 -1 0 4\n 0 0 -3 -3 0 0 0 0 -3 3\n -3 3 -1 0 1 2 1 2 -2 -1\n 0 -2 0 1 2 -1 1 -3 3 -3\n 0 -2 -2 0 -2 0 0 0 2 2\n 2 -2 0 -2 0 2 -2 2 0 0\n 0 -2 -2 0 1 3 1 -2 -2 -1"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "t̄₁₀ = [3 4 0 1 2 3 2 3 2 2 0]'",
"execution_count": 17,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 17,
"data": {
"text/plain": "11×1 adjoint(::Matrix{Int64}) with eltype Int64:\n 3\n 4\n 0\n 1\n 2\n 3\n 2\n 3\n 2\n 2\n 0"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "s0 = D₁₀*xs + t̄₁₀",
"execution_count": 18,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 18,
"data": {
"text/plain": "11×1 Matrix{@ring(ℚ[σ₁,σ₂,σ₃,σ₄,σ₅,σ₆,σ₇,σ₈,σ₉,σ₁₀])}:\n 3//2*σ₃ + -3//2*σ₇ + 3//2*σ₉ + -3//2*σ₁₀ + 3//1\n σ₃ + -2//1*σ₅ + -2//1*σ₆ + 2//1*σ₈ + σ₉ + 2//1*σ₁₀ + 2//1\n 3//2*σ₁ + 3//2*σ₇ + -3//1\n -1//2*σ₁ + -σ₂ + 1//2*σ₃ + 2//1*σ₄ + 2//1*σ₅ + -σ₆ + σ₇ + 1//2*σ₉ + -5//2\n -σ₁ + σ₃ + -σ₄ + -1//2*σ₇ + -1//2*σ₈ + 2//1*σ₁₀ + 2//1\n -3//2*σ₃ + -3//2*σ₄ + 3//2*σ₉ + 3//2*σ₁₀ + 3//1\n 3//2*σ₁ + -3//2*σ₂ + -1//2*σ₃ + -1//2*σ₅ + σ₆ + -1//2*σ₇ + σ₈ + σ₉ + -1//2*σ₁₀ + 1//1\n σ₂ + 1//2*σ₄ + -σ₅ + -1//2*σ₆ + -1//2*σ₇ + -3//2*σ₈ + -3//2*σ₉ + -3//2*σ₁₀ + 8//1\n σ₂ + -σ₃ + σ₅ + -σ₉ + σ₁₀ + 1//1\n -σ₁ + σ₂ + -σ₄ + σ₆ + σ₇ + σ₈\n σ₂ + -σ₃ + -1//2*σ₅ + 3//2*σ₆ + -1//2*σ₇ + -σ₈ + σ₉ + -1//2*σ₁₀"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "HC0_10 = sum([s*s for s in s0])",
"execution_count": 19,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 19,
"data": {
"text/plain": "27//4*σ₁^2 + -11//2*σ₁*σ₂ + 29//4*σ₂^2 + -4//1*σ₁*σ₃ + -7//2*σ₂*σ₃ + 9//1*σ₃^2 + 2//1*σ₁*σ₄ + -5//1*σ₂*σ₄ + 9//2*σ₃*σ₄ + 17//2*σ₄^2 + -7//2*σ₁*σ₅ + -7//2*σ₂*σ₅ + -5//2*σ₃*σ₅ + 7//1*σ₄*σ₅ + 21//2*σ₅^2 + 2//1*σ₁*σ₆ + 3//1*σ₂*σ₆ + -9//1*σ₃*σ₆ + -13//2*σ₄*σ₆ + 5//2*σ₅*σ₆ + 19//2*σ₆^2 + σ₁*σ₇ + -1//2*σ₂*σ₇ + -3//1*σ₃*σ₇ + 5//2*σ₄*σ₇ + 6//1*σ₅*σ₇ + -2//1*σ₆*σ₇ + 15//2*σ₇^2 + 2//1*σ₁*σ₈ + -6//1*σ₂*σ₈ + 4//1*σ₃*σ₈ + -5//2*σ₄*σ₈ + -5//1*σ₅*σ₈ + -11//2*σ₆*σ₈ + 4//1*σ₇*σ₈ + 19//2*σ₈^2 + 5//2*σ₁*σ₉ + -7//1*σ₂*σ₉ + 3//2*σ₃*σ₉ + -4//1*σ₄*σ₉ + -3//1*σ₅*σ₉ + 3//2*σ₆*σ₉ + -4//1*σ₇*σ₉ + 17//2*σ₈*σ₉ + 11//1*σ₉^2 + -11//2*σ₁*σ₁₀ + -1//2*σ₂*σ₁₀ + -3//2*σ₃*σ₁₀ + -10//1*σ₄*σ₁₀ + -2//1*σ₅*σ₁₀ + -9//1*σ₆*σ₁₀ + 5//1*σ₇*σ₁₀ + 21//2*σ₈*σ₁₀ + 9//2*σ₉*σ₁₀ + 65//4*σ₁₀^2 + -15//2*σ₁ + 20//1*σ₂ + 5//2*σ₃ + -15//1*σ₄ + -33//1*σ₅ + -9//1*σ₆ + -34//1*σ₇ + -16//1*σ₈ + -9//2*σ₉ + -7//1*σ₁₀ + 429//4"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "HC_10 = square_of_pauli_is_one(HC0_10)",
"execution_count": 20,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 20,
"data": {
"text/plain": "-11//2*σ₁*σ₂ + -4//1*σ₁*σ₃ + -7//2*σ₂*σ₃ + 2//1*σ₁*σ₄ + -5//1*σ₂*σ₄ + 9//2*σ₃*σ₄ + -7//2*σ₁*σ₅ + -7//2*σ₂*σ₅ + -5//2*σ₃*σ₅ + 7//1*σ₄*σ₅ + 2//1*σ₁*σ₆ + 3//1*σ₂*σ₆ + -9//1*σ₃*σ₆ + -13//2*σ₄*σ₆ + 5//2*σ₅*σ₆ + σ₁*σ₇ + -1//2*σ₂*σ₇ + -3//1*σ₃*σ₇ + 5//2*σ₄*σ₇ + 6//1*σ₅*σ₇ + -2//1*σ₆*σ₇ + 2//1*σ₁*σ₈ + -6//1*σ₂*σ₈ + 4//1*σ₃*σ₈ + -5//2*σ₄*σ₈ + -5//1*σ₅*σ₈ + -11//2*σ₆*σ₈ + 4//1*σ₇*σ₈ + 5//2*σ₁*σ₉ + -7//1*σ₂*σ₉ + 3//2*σ₃*σ₉ + -4//1*σ₄*σ₉ + -3//1*σ₅*σ₉ + 3//2*σ₆*σ₉ + -4//1*σ₇*σ₉ + 17//2*σ₈*σ₉ + -11//2*σ₁*σ₁₀ + -1//2*σ₂*σ₁₀ + -3//2*σ₃*σ₁₀ + -10//1*σ₄*σ₁₀ + -2//1*σ₅*σ₁₀ + -9//1*σ₆*σ₁₀ + 5//1*σ₇*σ₁₀ + 21//2*σ₈*σ₁₀ + 9//2*σ₉*σ₁₀ + -15//2*σ₁ + 20//1*σ₂ + 5//2*σ₃ + -15//1*σ₄ + -33//1*σ₅ + -9//1*σ₆ + -34//1*σ₇ + -16//1*σ₈ + -9//2*σ₉ + -7//1*σ₁₀ + 203//1"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "julia-1.8",
"display_name": "Julia 1.8.3",
"language": "julia"
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "1.8.3"
},
"gist": {
"id": "a401e5a09b543f11d54ca593e9a08ade",
"data": {
"description": "Documents/Papers/2212.12372 H5C check.ipynb",
"public": true
}
},
"_draft": {
"nbviewer_url": "https://gist.github.com/a401e5a09b543f11d54ca593e9a08ade"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment