Skip to content

Commit 7132772

Browse files
josh146co9olguy
andauthored
Fix typos in QFT arithmetic tutorial (#1594)
Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
1 parent f809ca9 commit 7132772

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

demonstrations_v2/tutorial_qft_arithmetics/demo.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
2222
In this demo we will not focus on understanding how the QFT is built,
2323
as we can find a great explanation in the
24-
`PennyLane Codebook </codebook/08-quantum-fourier-transform/01-changing-perspectives/>`__. Instead, we will develop the
24+
`PennyLane Codebook </codebook/quantum-fourier-transform/changing-perspectives/>`__. Instead, we will develop the
2525
intuition for how it works and how we can best take advantage of it.
2626
2727
Motivation
@@ -54,8 +54,8 @@
5454
-----------------
5555
5656
To apply the QFT to basic arithmetic operations, our objective now is to learn how to add,
57-
subtract and multiply numbers using quantum devices. As we are working with qubits,
58-
—which, like bits, can take the
57+
subtract and multiply numbers using quantum devices. As we are working with qubits—which,
58+
like bits, can take the
5959
values :math:`0` or :math:`1`—we will represent the numbers in binary. For the
6060
purposes of this tutorial, we will assume that we are working only with
6161
integers. Therefore, if we have :math:`n` qubits, we will be able to
@@ -71,7 +71,7 @@
7171
7272
.. math:: m= \sum_{i = 0}^{n-1}2^{n-1-i}q_i.
7373
74-
Note that :math:`\vert m \rangle` refers to the basic state
74+
Note that :math:`\vert m \rangle` refers to the basis state
7575
generated by the binary encoding of the number :math:`m.`
7676
For instance, the natural number :math:`6`
7777
is represented by the quantum state :math:`\vert 110\rangle,` since :math:`\vert 110 \rangle = 1 \cdot 2^2 + 1\cdot 2^1+0\cdot 2^0 = 6.`
@@ -286,12 +286,12 @@ def sum2(m, k, wires_m, wires_k, wires_solution):
286286
#
287287
# To understand the multiplication process, let's work with the binary decomposition of
288288
# :math:`k:=\sum_{i=0}^{n-1}2^{n-i-1}k_i` and
289-
# :math:`m:=\sum_{j=0}^{l-1}2^{l-j-1}m_i.` In this case, the product would
289+
# :math:`m:=\sum_{j=0}^{l-1}2^{l-j-1}m_j.` In this case, the product would
290290
# be:
291291
#
292-
# .. math:: k \cdot m = \sum_{i=0}^{n-1}\sum_{j = 0}^{l-1}m_ik_i (2^{n-i-1} \cdot 2^{l-j-1}).
292+
# .. math:: k \cdot m = \sum_{i=0}^{n-1}\sum_{j = 0}^{l-1} k_i m_j (2^{n-i-1} \cdot 2^{l-j-1}).
293293
#
294-
# In other words, if :math:`k_i = 1` and :math:`m_i = 1,` we would add
294+
# In other words, if :math:`k_i = 1` and :math:`m_j = 1,` we would add
295295
# :math:`2^{n-i-1} \cdot 2^{l-j-1}` units to the counter, where :math:`n` and :math:`l`
296296
# are the number of qubits with which we encode :math:`m` and :math:`k` respectively.
297297
# Let's code to see how it works!
@@ -351,7 +351,7 @@ def mul(m, k):
351351
# Let’s imagine now that we want just the opposite: to factor the
352352
# number :math:`21` as a product of two terms. Is this something we could do
353353
# using our previous reasoning? The answer is yes! We can make use of
354-
# `Grover's algorithm <https://en.wikipedia.org/wiki/Grover%27s_algorithm>`_ to
354+
# `Grover's algorithm </qml/demos/tutorial_grovers_algorithm>`__ to
355355
# amplify the states whose product is the number we
356356
# are looking for. All we would need is to construct the oracle :math:`U,` i.e., an
357357
# operator such that
@@ -404,15 +404,15 @@ def factorization(n, wires_m, wires_k, wires_solution):
404404

405405

406406
plt.bar(range(2 ** len(wires_m)), factorization(n, wires_m, wires_k, wires_solution))
407-
plt.xlabel("Basic states")
407+
plt.xlabel("Basis states")
408408
plt.ylabel("Probability")
409409
plt.show()
410410

411411
######################################################################
412-
# By plotting the probabilities of obtaining each basic state we see that
412+
# By plotting the probabilities of obtaining each basis state we see that
413413
# prime factors have been amplified! Factorization via Grover’s algorithm
414-
# does not achieve exponential improvement that
415-
# `Shor's algorithm <https://en.wikipedia.org/wiki/Shor%27s_algorithm>`_ does, but we
414+
# does not achieve the exponential improvement that
415+
# `Shor's algorithm </codebook/shors-algorithm/shors-algorithm/>`__ does, but we
416416
# can see that this construction is simple and a great example to
417417
# illustrate basic arithmetic!
418418
#
@@ -427,3 +427,9 @@ def factorization(n, wires_m, wires_k, wires_solution):
427427
#
428428
# Thomas G. Draper, "Addition on a Quantum Computer". `arXiv:quant-ph/0008033 <https://arxiv.org/abs/quant-ph/0008033>`__.
429429
#
430+
431+
432+
433+
434+
435+

demonstrations_v2/tutorial_qft_arithmetics/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"executable_stable": true,
99
"executable_latest": true,
1010
"dateOfPublication": "2022-11-07T00:00:00+00:00",
11-
"dateOfLastModification": "2025-10-15T00:00:00+00:00",
11+
"dateOfLastModification": "2025-11-05T00:00:00+00:00",
1212
"categories": [
1313
"Getting Started",
1414
"Algorithms",
@@ -43,4 +43,4 @@
4343
"weight": 1.0
4444
}
4545
]
46-
}
46+
}

0 commit comments

Comments
 (0)