Skip to content

Instantly share code, notes, and snippets.

@Shoichiro-Tsutsui
Last active August 26, 2020 11:42
Show Gist options
  • Save Shoichiro-Tsutsui/c32bedb5f81c42b61db357406b7e66a1 to your computer and use it in GitHub Desktop.
Save Shoichiro-Tsutsui/c32bedb5f81c42b61db357406b7e66a1 to your computer and use it in GitHub Desktop.
Make quantum spin Hamiltonians using Julia
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Pauli matrices"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2×2 SparseMatrixCSC{Complex{Float64},Int64} with 2 stored entries:\n",
" [1, 1] = 1.0+0.0im\n",
" [2, 2] = -1.0+0.0im"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using SparseArrays\n",
"\n",
"σ⁰ = sparse([1.0+0.0im 0.0; 0.0 1.0+0.0im])\n",
"σˣ = sparse([0.0 1.0+0.0im; 1.0+0.0im 0.0])\n",
"σʸ = sparse([0.0 -1.0im; 1.0im 0.0])\n",
"σᶻ = sparse([1.0+0.0im 0.0; 0.0 -1.0+0.0im])"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"σˣ * σˣ == σ⁰ = true\n",
"σʸ * σʸ == σ⁰ = true\n",
"σᶻ * σᶻ == σ⁰ = true\n",
"σˣ * σʸ - σʸ * σˣ == (2.0im) * σᶻ = true\n",
"σʸ * σᶻ - σᶻ * σʸ == (2.0im) * σˣ = true\n",
"σᶻ * σˣ - σˣ * σᶻ == (2.0im) * σʸ = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show σˣ*σˣ == σ⁰\n",
"@show σʸ*σʸ == σ⁰\n",
"@show σᶻ*σᶻ == σ⁰\n",
"@show σˣ*σʸ - σʸ*σˣ == 2.0im*σᶻ\n",
"@show σʸ*σᶻ - σᶻ*σʸ == 2.0im*σˣ\n",
"@show σᶻ*σˣ - σˣ*σᶻ == 2.0im*σʸ"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Kronecker product"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"⊗ (generic function with 1 method)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"⊗(A, B) = kron(A, B)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A ⊗ (B + C) ≈ A ⊗ B + A ⊗ C = true\n",
"(B + C) ⊗ A ≈ B ⊗ A + C ⊗ A = true\n",
"(A ⊗ B) ⊗ C ≈ A ⊗ (B ⊗ C) = true\n",
"(A ⊗ B) * (C ⊗ D) ≈ (A * C) ⊗ (B * D) = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A, B, C, D = rand(2, 2), rand(2, 2), rand(2, 2), rand(2, 2)\n",
"@show A⊗(B+C) ≈ A⊗B + A⊗C\n",
"@show (B+C)⊗A ≈ B⊗A + C⊗A\n",
"@show (A⊗B)⊗C ≈ A⊗(B⊗C)\n",
"@show (A⊗B)*(C⊗D) ≈ (A*C)⊗(B*D)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Way to make the 1d Ising Hamiltonian"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"16×16 SparseMatrixCSC{Complex{Float64},Int64} with 4 stored entries:\n",
" [1 , 1] = 4.0+0.0im\n",
" [6 , 6] = -4.0+0.0im\n",
" [11, 11] = -4.0+0.0im\n",
" [16, 16] = 4.0+0.0im"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Ising Hamiltonian\n",
"H3 = σ⁰⊗σᶻ⊗σᶻ + σᶻ⊗σᶻ⊗σ⁰ + σᶻ⊗σ⁰⊗σᶻ\n",
"H4 = σ⁰⊗σ⁰⊗σᶻ⊗σᶻ + σ⁰⊗σᶻ⊗σᶻ⊗σ⁰ + σᶻ⊗σᶻ⊗σ⁰⊗σ⁰ + σᶻ⊗σ⁰⊗σ⁰⊗σᶻ"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"H3 == Diagonal([3, -1, -1, -1, -1, -1, -1, 3]) = true\n",
"H4 == Diagonal([4, 0, 0, 0, 0, -4, 0, 0, 0, 0, -4, 0, 0, 0, 0, 4]) = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using LinearAlgebra\n",
"\n",
"@show H3 == Diagonal([3,-1,-1,-1,-1,-1,-1,3])\n",
"@show H4 == Diagonal([4,0,0,0,0,-4,0,0,0,0,-4,0,0,0,0,4])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Way to make the 1d Ising Hamiltonian with arbitrary N"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"⊗ (generic function with 2 methods)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function ⊗(A,B,C...)\n",
" A = kron(A, B)\n",
" for Ci in C\n",
" A = kron(A, Ci)\n",
" end\n",
" return A\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⊗(σᶻ, σᶻ, σ⁰, σ⁰) == ((σᶻ ⊗ σᶻ) ⊗ σ⁰) ⊗ σ⁰ = true\n",
"(⊗)([σᶻ, σᶻ, σ⁰, σ⁰]...) == ((σᶻ ⊗ σᶻ) ⊗ σ⁰) ⊗ σ⁰ = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show ⊗(σᶻ,σᶻ,σ⁰,σ⁰)==σᶻ⊗σᶻ⊗σ⁰⊗σ⁰\n",
"@show ⊗([σᶻ,σᶻ,σ⁰,σ⁰]...)==σᶻ⊗σᶻ⊗σ⁰⊗σ⁰"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"set_spins (generic function with 1 method)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function set_spins(N, sites, σs)\n",
" list_mats = fill(σ⁰, N)\n",
" for (site, σ) in zip(sites, σs)\n",
" list_mats[site] = σ\n",
" end\n",
" return list_mats\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"set_spins(4, [1, 2], [σᶻ, σᶻ]) == [σᶻ, σᶻ, σ⁰, σ⁰] = true\n",
"set_spins(4, [1, 4], [σᶻ, σˣ]) == [σᶻ, σ⁰, σ⁰, σˣ] = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show set_spins(4, [1,2], [σᶻ,σᶻ]) == [σᶻ,σᶻ,σ⁰,σ⁰]\n",
"@show set_spins(4, [1,4], [σᶻ,σˣ]) == [σᶻ,σ⁰,σ⁰,σˣ]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"HIsing (generic function with 1 method)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 1d Ising Hamiltonian\n",
"function HIsing(N)\n",
" H = ⊗(set_spins(N, [N,1], [σᶻ,σᶻ])...)\n",
" for i in 1:N-1\n",
" H += ⊗(set_spins(N, [i,i+1], [σᶻ,σᶻ])...)\n",
" end\n",
" return H\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HIsing(3) == H3 = true\n",
"HIsing(4) == H4 = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show HIsing(3) == H3\n",
"@show HIsing(4) == H4"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1d Heisenberg Hamiltonian"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"HHeisenberg (generic function with 1 method)"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 1d Heisenberg Hamiltonian\n",
"function HHeisenberg(N)\n",
" H = ⊗(set_spins(N, [N,1], [σˣ,σˣ])...)\n",
" H += ⊗(set_spins(N, [N,1], [σʸ,σʸ])...)\n",
" H += ⊗(set_spins(N, [N,1], [σᶻ,σᶻ])...)\n",
" for i in 1:N-1\n",
" H += ⊗(set_spins(N, [i,i+1], [σˣ,σˣ])...)\n",
" H += ⊗(set_spins(N, [i,i+1], [σʸ,σʸ])...)\n",
" H += ⊗(set_spins(N, [i,i+1], [σᶻ,σᶻ])...)\n",
" end\n",
" return H\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"16×16 SparseMatrixCSC{Complex{Float64},Int64} with 36 stored entries:\n",
" [1 , 1] = 4.0+0.0im\n",
" [3 , 2] = 2.0+0.0im\n",
" [9 , 2] = 2.0+0.0im\n",
" [2 , 3] = 2.0+0.0im\n",
" [5 , 3] = 2.0+0.0im\n",
" [6 , 4] = 2.0+0.0im\n",
" [11, 4] = 2.0+0.0im\n",
" [3 , 5] = 2.0+0.0im\n",
" [9 , 5] = 2.0+0.0im\n",
" [4 , 6] = 2.0+0.0im\n",
" [6 , 6] = -4.0+0.0im\n",
" [7 , 6] = 2.0+0.0im\n",
" ⋮\n",
" [7 , 11] = 2.0+0.0im\n",
" [10, 11] = 2.0+0.0im\n",
" [11, 11] = -4.0+0.0im\n",
" [13, 11] = 2.0+0.0im\n",
" [8 , 12] = 2.0+0.0im\n",
" [14, 12] = 2.0+0.0im\n",
" [6 , 13] = 2.0+0.0im\n",
" [11, 13] = 2.0+0.0im\n",
" [12, 14] = 2.0+0.0im\n",
" [15, 14] = 2.0+0.0im\n",
" [8 , 15] = 2.0+0.0im\n",
" [14, 15] = 2.0+0.0im\n",
" [16, 16] = 4.0+0.0im"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"HHeisenberg(4)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Ising Hamiltonian on a square lattice"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"SiteIndeces_2d (generic function with 1 method)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"SiteIndeces_2d(N) = transpose(reshape(1:N^2, N,N))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3×3 Transpose{Int64,Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}}}:\n",
" 1 2 3\n",
" 4 5 6\n",
" 7 8 9"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"SiteIndeces_2d(3)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"pbc (generic function with 1 method)"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function pbc(index, N)\n",
" i = index % N\n",
" i > 0 ? i : i+N\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10-element Array{Int64,1}:\n",
" 3\n",
" 1\n",
" 2\n",
" 3\n",
" 1\n",
" 2\n",
" 3\n",
" 1\n",
" 2\n",
" 3"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pbc.(-3:6, 3)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"bonds (generic function with 1 method)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function bonds(N)\n",
" A = SiteIndeces_2d(N)\n",
" v = [(A[CartesianIndex(i,j)], A[CartesianIndex(i,pbc(j+1,N))]) for i in 1:N for j in 1:N]\n",
" h = [(A[CartesianIndex(i,j)], A[CartesianIndex(pbc(i+1,N),j)]) for i in 1:N for j in 1:N]\n",
" return vcat(v, h)\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"18-element Array{Tuple{Int64,Int64},1}:\n",
" (1, 2)\n",
" (2, 3)\n",
" (3, 1)\n",
" (4, 5)\n",
" (5, 6)\n",
" (6, 4)\n",
" (7, 8)\n",
" (8, 9)\n",
" (9, 7)\n",
" (1, 4)\n",
" (2, 5)\n",
" (3, 6)\n",
" (4, 7)\n",
" (5, 8)\n",
" (6, 9)\n",
" (7, 1)\n",
" (8, 2)\n",
" (9, 3)"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bonds(3)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"HIsing_2d (generic function with 1 method)"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 2d Ising Hamiltonian\n",
"function HIsing_2d(N)\n",
" H = spzeros(2^(N*N), 2^(N*N))\n",
" for b in bonds(N)\n",
" H += ⊗(set_spins(N*N, [b[1],b[2]], [σᶻ,σᶻ])...)\n",
" end\n",
" return H\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"16×16 SparseMatrixCSC{Complex{Float64},Int64} with 4 stored entries:\n",
" [1 , 1] = 8.0+0.0im\n",
" [7 , 7] = -8.0+0.0im\n",
" [10, 10] = -8.0+0.0im\n",
" [16, 16] = 8.0+0.0im"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"HIsing_2d(2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Appendix"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"ename": "UndefVarError",
"evalue": "UndefVarError: σᶻ₂ not defined",
"output_type": "error",
"traceback": [
"UndefVarError: σᶻ₂ not defined",
"",
"Stacktrace:",
" [1] top-level scope at In[30]:1"
]
}
],
"source": [
"σᶻ₂"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"sub_to_num (generic function with 1 method)"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function sub_to_num(sub)\n",
" if sub == '₁'\n",
" return 1\n",
" elseif sub == '₂'\n",
" return 2\n",
" elseif sub == '₃'\n",
" return 3\n",
" elseif sub == '₄'\n",
" return 4\n",
" elseif sub == '₅'\n",
" return 5\n",
" elseif sub == '₆'\n",
" return 6\n",
" elseif sub == '₇'\n",
" return 7\n",
" elseif sub == '₈'\n",
" return 8\n",
" elseif sub == '₉'\n",
" return 9\n",
" elseif sub == '₀'\n",
" return 0\n",
" else\n",
" UndefVarError()\n",
" end\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sub_to_num('₀') == 0 = true\n",
"sub_to_num('₁') == 1 = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show sub_to_num('₀') == 0\n",
"@show sub_to_num('₁') == 1"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"to_siteindex (generic function with 1 method)"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function to_siteindex(array)\n",
" n = length(array)\n",
" sum([array[i]*10^(n-i) for i in 1:n])\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"to_siteindex([1]) = 1\n",
"to_siteindex([1, 2]) = 12\n",
"to_siteindex([1, 2, 3]) = 123\n"
]
},
{
"data": {
"text/plain": [
"123"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show to_siteindex([1])\n",
"@show to_siteindex([1,2])\n",
"@show to_siteindex([1,2,3])"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"to_siteindex(sub_to_num.(['₁'])) = 1\n",
"to_siteindex(sub_to_num.(['₁', '₂'])) = 12\n",
"to_siteindex(sub_to_num.(['₁', '₂', '₃'])) = 123\n"
]
},
{
"data": {
"text/plain": [
"123"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show to_siteindex(sub_to_num.(['₁']))\n",
"@show to_siteindex(sub_to_num.(['₁','₂']))\n",
"@show to_siteindex(sub_to_num.(['₁','₂','₃']))"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"@_spin (macro with 1 method)"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"macro _spin(S, N)\n",
" indeces = []\n",
" spins = []\n",
" for str in split(string(:($S)), \"σ\")[2:end]\n",
" str = [s for s in \"σ\"*str]\n",
" index = to_siteindex(sub_to_num.(str[3:end]))\n",
" push!(indeces, index)\n",
" @assert index <= N\n",
" spin = eval(Meta.parse(prod(str[1:2])))\n",
" push!(spins, spin)\n",
" end\n",
" ⊗(set_spins(N, indeces, spins)...)\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"#= In[37]:1 =# @_spin(σᶻ₁, 4) == ((σᶻ ⊗ σ⁰) ⊗ σ⁰) ⊗ σ⁰ = true\n",
"#= In[37]:2 =# @_spin(σᶻ₂σᶻ₃, 4) == ((σ⁰ ⊗ σᶻ) ⊗ σᶻ) ⊗ σ⁰ = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show (@_spin σᶻ₁ 4) == σᶻ⊗σ⁰⊗σ⁰⊗σ⁰\n",
"@show (@_spin σᶻ₂σᶻ₃ 4) == σ⁰⊗σᶻ⊗σᶻ⊗σ⁰"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"@spin (macro with 1 method)"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"macro spin(S, N)\n",
" str = \"(@_spin \" * replace(string(:($S)), \"+\"=>string(N)*\")+(@_spin\") * \" \" * string(N)* \")\"\n",
" Meta.parse(str)\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"#= In[39]:1 =# @spin(σᶻ₁σᶻ₂ + σᶻ₂σᶻ₃ + σᶻ₃σᶻ₁, 3) == HIsing(3) = true\n"
]
},
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@show (@spin σᶻ₁σᶻ₂+σᶻ₂σᶻ₃+σᶻ₃σᶻ₁ 3) == HIsing(3)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"HIsing_2d(2) == (@spin σᶻ₁σᶻ₂+σᶻ₂σᶻ₁+σᶻ₃σᶻ₄+σᶻ₄σᶻ₃+σᶻ₁σᶻ₃+σᶻ₃σᶻ₁+σᶻ₂σᶻ₄+σᶻ₄σᶻ₂ 4)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.4.0",
"language": "julia",
"name": "julia-1.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.4.0"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"toc_cell": false,
"toc_position": {},
"toc_section_display": "block",
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment