From 0d15c446fb7e1775e5a9a4f652572322a6e2ce68 Mon Sep 17 00:00:00 2001 From: arettig Date: Thu, 16 Jul 2026 20:21:55 +0000 Subject: [PATCH 1/3] Fix several typos in tutorials Fixes several small typos in the OpenFermion tutorials. The docs builder cannot handle inline latex that is split across several lines, so these were combined to a single line. --- docs/tutorials/binary_code_transforms.ipynb | 4 ++-- docs/tutorials/bosonic_operators.ipynb | 7 ++----- .../jordan_wigner_and_bravyi_kitaev_transforms.ipynb | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/tutorials/binary_code_transforms.ipynb b/docs/tutorials/binary_code_transforms.ipynb index c6f37d268..a799fcbf4 100644 --- a/docs/tutorials/binary_code_transforms.ipynb +++ b/docs/tutorials/binary_code_transforms.ipynb @@ -95,7 +95,7 @@ "source": [ "## Introduction\n", "\n", - "Molecular Hamiltonians are known to have certain symmetries that are not taken into account by mappings like the Jordan-Wigner or Bravyi-Kitaev transform. The most notable of such symmetries is the conservation of the total number of particles in the system. Since those symmetries effectively reduce the degrees of freedom of the system, one is able to reduce the number of qubits required for simulation by utilizing binary codes (arXiv:1712.07067). \n", + "Molecular Hamiltonians are known to have certain symmetries that are not taken into account by mappings like the Jordan-Wigner or Bravyi-Kitaev transform. The most notable of such symmetries is the conservation of the total number of particles in the system. Since those symmetries effectively reduce the degrees of freedom of the system, one is able to reduce the number of qubits required for simulation by utilizing binary codes ([arXiv:1712.07067](https://arxiv.org/abs/1712.07067)). \n", "\n", "We can represent the symmetry-reduced Fermion basis by binary vectors of a set $\\mathcal{V} \\ni \\boldsymbol{\\nu}$, with $ \\boldsymbol{\\nu} = (\\nu_0, \\, \\nu_1, \\dots, \\, \\nu_{N-1} ) $, where every component $\\nu_i \\in \\lbrace 0, 1 \\rbrace $ and $N$ is the total number of Fermion modes. These binary vectors $ \\boldsymbol{\\nu}$ are related to the actual basis states by: $$\n", "\\left[\\prod_{i=0}^{N-1} (a_i^{\\dagger})^{\\nu_i} \\right] \\left|{\\text{vac}}\\right\\rangle \\, ,\n", @@ -175,7 +175,7 @@ "id": "03e9717ebd49" }, "source": [ - "The code used in the example above, is in fact the (odd) Checksum code, and is implemented already - along with a few other examples from arxiv:1712.07067. In addition to the $\\text{checksum_code}$ the functions $\\text{weight_one_segment_code}$, $\\text{weight_two_segment_code}$, that output a subcode each, as well as $\\text{weight_one_binary_addressing_code}$ can be found under openfermion.transforms._code_transform_functions.\n", + "The code used in the example above, is in fact the (odd) Checksum code, and is implemented already - along with a few other examples from [arxiv:1712.07067](https://arxiv.org/abs/1712.07067). In addition to the $\\text{checksum_code}$ the functions $\\text{weight_one_segment_code}$, $\\text{weight_two_segment_code}$, that output a subcode each, as well as $\\text{weight_one_binary_addressing_code}$ can be found under openfermion.transforms._code_transform_functions.\n", "\n", "There are two other ways to construct new codes from the ones given - both of them can be done conveniently with symbolic operations between two code objects $(\\boldsymbol{e}, \\boldsymbol{d})$ and $(\\boldsymbol{e^\\prime}, \\boldsymbol{d^\\prime})$ to yield a new code $(\\boldsymbol{e^{\\prime\\prime}}, \\boldsymbol{d^{\\prime\\prime}})$:" ] diff --git a/docs/tutorials/bosonic_operators.ipynb b/docs/tutorials/bosonic_operators.ipynb index babb63208..8e64ef91e 100644 --- a/docs/tutorials/bosonic_operators.ipynb +++ b/docs/tutorials/bosonic_operators.ipynb @@ -860,10 +860,7 @@ "\n", "In addition to the bosonic operators discussed above, we also provide Bosonic Hamiltonians that describe specific models. The Bose-Hubbard Hamiltonian over a discrete lattice or grid described by nodes $V=\\{0,1,\\dots,N-1\\}$ is described by:\n", "\n", - "$$H = - t \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_{j + 1}\n", - " + \\frac{U}{2} \\sum_{k=1}^{N-1} b_k^\\dagger b_k (b_k^\\dagger b_k - 1)\n", - " - \\mu \\sum_{k=1}^N b_k^\\dagger b_k\n", - " + V \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_i b_j^\\dagger b_j.$$\n", + "$$H = - t \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_{j + 1} + \\frac{U}{2} \\sum_{k=1}^{N-1} b_k^\\dagger b_k (b_k^\\dagger b_k - 1) - \\mu \\sum_{k=1}^N b_k^\\dagger b_k + V \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_i b_j^\\dagger b_j.$$\n", " \n", "where\n", "\n", @@ -921,7 +918,7 @@ "id": "04673b1d4a9c" }, "source": [ - "Like the fermionic operators, OpenFermion contains the capability to represent bosonic operators as a sparse matrix (`sparse.csc_matrix`). However, as the fermionic operators can be represented as finite matrices, this is not the case of bosonic systems, as they inhabit a infinite-dimensional Fock space. Instead, a integer truncation value $N$ need to be provided - the returned sparse operator will be of size $N^{M}\\times N^{M}$, where $M$ is the number of modes in the system, and acts on the truncated Fock basis $\\{\\left|{0}\\right\\rangle, \\left|{1}\\right\\rangle, \\dots, \\left|{N-1}\\right\\rangle\\}$." + "Like the fermionic operators, OpenFermion contains the capability to represent bosonic operators as a sparse matrix (`sparse.csc_matrix`). However, while the fermionic operators can be represented as finite matrices, this is not the case for bosonic systems, as they inhabit a infinite-dimensional Fock space. Instead, an integer truncation value $N$ needs to be provided - the returned sparse operator will be of size $N^{M}\\times N^{M}$, where $M$ is the number of modes in the system, and acts on the truncated Fock basis $\\{\\left|{0}\\right\\rangle, \\left|{1}\\right\\rangle, \\dots, \\left|{N-1}\\right\\rangle\\}$." ] }, { diff --git a/docs/tutorials/jordan_wigner_and_bravyi_kitaev_transforms.ipynb b/docs/tutorials/jordan_wigner_and_bravyi_kitaev_transforms.ipynb index 740bcfd88..0cb2bb352 100644 --- a/docs/tutorials/jordan_wigner_and_bravyi_kitaev_transforms.ipynb +++ b/docs/tutorials/jordan_wigner_and_bravyi_kitaev_transforms.ipynb @@ -364,8 +364,7 @@ "\n", "Under the JWT, Steps 1, 2, and 3 are represented by the operator $(\\lvert{0}\\rangle\\langle{1}\\rvert)_p$ and Step 4 is accomplished by the operator $Z_{0} \\cdots Z_{p-1}$ (Step 3 actually requires no action).\n", "Under the parity transform, Steps 1, 2, and 4 are represented by the operator\n", - "$(\\lvert{0}\\rangle\\langle{1}\\rvert)_p (\\lvert{0}\\rangle\\langle{0}\\rvert)_{p - 1} -\n", - "(\\lvert{0}\\rangle\\langle{1}\\rvert)_p (\\lvert{1}\\rangle\\langle{1}\\rvert)_{p - 1}$ and Step 3 is accomplished by the operator $X_{p+1} \\cdots X_{N-1}$.\n", + "$(\\lvert{0}\\rangle\\langle{1}\\rvert)_p (\\lvert{0}\\rangle\\langle{0}\\rvert)_{p - 1} - (\\lvert{0}\\rangle\\langle{1}\\rvert)_p (\\lvert{1}\\rangle\\langle{1}\\rvert)_{p - 1}$ and Step 3 is accomplished by the operator $X_{p+1} \\cdots X_{N-1}$.\n", "\n", "To obtain a simpler description of these and other transforms (with an aim at generalizing), it is better to put aside the ladder operators and work with an alternative set of $2N$ operators defined by\n", "$$c_p = a_p + a_p^\\dagger\\,, \\qquad d_p = -\\mathrm{i} (a_p - a_p^\\dagger)\\,.$$\n", From 41a0d335d20226be62a4f69a4743ccba82a13036 Mon Sep 17 00:00:00 2001 From: arettig Date: Thu, 16 Jul 2026 21:11:39 +0000 Subject: [PATCH 2/3] Fix Bose-Hubbard Hamiltonian equation in tutorial The equation for the Bose-Hubbard Hamiltonian was incorrect due to some sum bounds. 'V' was also used as both the dipole interaction strength and the set of nodes in the model. These are both corrected here. --- docs/tutorials/bosonic_operators.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/bosonic_operators.ipynb b/docs/tutorials/bosonic_operators.ipynb index 8e64ef91e..b18626b80 100644 --- a/docs/tutorials/bosonic_operators.ipynb +++ b/docs/tutorials/bosonic_operators.ipynb @@ -858,9 +858,9 @@ "source": [ "## Bose-Hubbard Hamiltonian\n", "\n", - "In addition to the bosonic operators discussed above, we also provide Bosonic Hamiltonians that describe specific models. The Bose-Hubbard Hamiltonian over a discrete lattice or grid described by nodes $V=\\{0,1,\\dots,N-1\\}$ is described by:\n", + "In addition to the bosonic operators discussed above, we also provide Bosonic Hamiltonians that describe specific models. The Bose-Hubbard Hamiltonian over a discrete lattice or grid described by nodes $\\{0,1,\\dots,N-1\\}$ is described by:\n", "\n", - "$$H = - t \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_{j + 1} + \\frac{U}{2} \\sum_{k=1}^{N-1} b_k^\\dagger b_k (b_k^\\dagger b_k - 1) - \\mu \\sum_{k=1}^N b_k^\\dagger b_k + V \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_i b_j^\\dagger b_j.$$\n", + "$$H = - t \\sum_{\\langle i, j \\rangle} (b_i^\\dagger b_{j} + b_j^\\dagger b_i) + \\frac{U}{2} \\sum_{k=0}^{N-1} b_k^\\dagger b_k (b_k^\\dagger b_k - 1) - \\mu \\sum_{k=0}^{N-1} b_k^\\dagger b_k + V \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_i b_j^\\dagger b_j.$$\n", " \n", "where\n", "\n", From 21cc5690a835e2bba3afaa8998354099191f0ea1 Mon Sep 17 00:00:00 2001 From: arettig Date: Thu, 16 Jul 2026 22:35:16 +0000 Subject: [PATCH 3/3] Break Bose-Hubbard Hamiltonian into multiple lines The previous equation that was broken into multiple lines got interpreted as a code block because the -/+ signs at the start of the lines turned it into a markdown list. Moving these to the end of the previous line fixes the problem. --- docs/tutorials/bosonic_operators.ipynb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/bosonic_operators.ipynb b/docs/tutorials/bosonic_operators.ipynb index b18626b80..84e4301ff 100644 --- a/docs/tutorials/bosonic_operators.ipynb +++ b/docs/tutorials/bosonic_operators.ipynb @@ -860,8 +860,13 @@ "\n", "In addition to the bosonic operators discussed above, we also provide Bosonic Hamiltonians that describe specific models. The Bose-Hubbard Hamiltonian over a discrete lattice or grid described by nodes $\\{0,1,\\dots,N-1\\}$ is described by:\n", "\n", - "$$H = - t \\sum_{\\langle i, j \\rangle} (b_i^\\dagger b_{j} + b_j^\\dagger b_i) + \\frac{U}{2} \\sum_{k=0}^{N-1} b_k^\\dagger b_k (b_k^\\dagger b_k - 1) - \\mu \\sum_{k=0}^{N-1} b_k^\\dagger b_k + V \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_i b_j^\\dagger b_j.$$\n", - " \n", + "$$\n", + "H = - t \\sum_{\\langle i, j \\rangle} (b_i^\\dagger b_{j} + b_j^\\dagger b_i) +\n", + " \\frac{U}{2} \\sum_{k=0}^{N-1} b_k^\\dagger b_k (b_k^\\dagger b_k - 1) -\n", + " \\mu \\sum_{k=0}^{N-1} b_k^\\dagger b_k +\n", + " V \\sum_{\\langle i, j \\rangle} b_i^\\dagger b_i b_j^\\dagger b_j.\n", + "$$\n", + "\n", "where\n", "\n", "- The indices $\\langle i, j \\rangle$ run over pairs\n",