Skip to content

Commit 90502e1

Browse files
Merge pull request #488 from rawkintrevo/487
2 parents 16e25aa + b6aa75a commit 90502e1

File tree

5 files changed

+64
-32
lines changed

5 files changed

+64
-32
lines changed

website/_config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ baseurl: ""
3939

4040
# Build settings
4141
markdown: kramdown
42+
kramdown:
43+
math_engine: mathjax
44+
syntax_highlighter: rouge
4245
plugins:
4346
- jekyll-feed
4447
- jekyll-latex

website/quantum-computing-primer/03_qubits/index.md

+23-6
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,32 @@ In classical computing, the fundamental unit of information is the **bit**, whic
1111

1212
$$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$$
1313

14-
where \(\alpha\) and \(\beta\) are complex numbers representing the probability amplitudes of the qubit being in the \(|0\rangle\) and \(|1\rangle\) states, respectively. The probabilities of measuring the qubit in either state are given by \(|\alpha|^2\) and \(|\beta|^2\), and they must satisfy the normalization condition:
14+
{% raw %}
15+
where $\alpha$ and $\beta$ are complex numbers representing the probability
16+
amplitudes of the qubit being in the $|0\rangle$ and $|1\rangle$ states,
17+
respectively. The probabilities of measuring the qubit in either state are given
18+
by $|\alpha|^2$ and $|\beta|^2$, and they must satisfy the normalization condition:
19+
{% endraw %}
1520

1621
$$|\alpha|^2 + |\beta|^2 = 1$$
1722

1823
## 3.2 Representing Qubits
1924

20-
Qubits can be visualized using the **Bloch sphere**, a geometric representation of the quantum state of a single qubit. The Bloch sphere is a unit sphere where the north and south poles represent the \(|0\rangle\) and \(|1\rangle\) states, respectively. Any point on the surface of the sphere represents a valid quantum state of the qubit.
25+
Qubits can be visualized using the **Bloch sphere**, a geometric representation
26+
of the quantum state of a single qubit. The Bloch sphere is a unit sphere where
27+
the north and south poles represent the $|0\rangle$ and $|1\rangle$ states,
28+
respectively. Any point on the surface of the sphere represents a valid quantum
29+
state of the qubit.
2130

22-
The state of a qubit can also be described using a **state vector** in a two-dimensional complex vector space. For example, the state \(|0\rangle\) is represented as:
31+
The state of a qubit can also be described using a **state vector** in a
32+
two-dimensional complex vector space. For example, the state $|0\rangle$ is
33+
represented as:
2334

2435
$$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$$
2536

26-
and the state \(|1\rangle\) is represented as:
37+
{% raw %}
38+
and the state $|1\rangle$ is represented as:
39+
{% endraw %}
2740

2841
$$|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$$
2942

@@ -51,7 +64,9 @@ In this example, we initialize a quantum circuit with one qubit using the qiskit
5164

5265
### Example: Applying a Hadamard Gate
5366

54-
The Hadamard gate ((H)) is a fundamental quantum gate that puts a qubit into a superposition state. Applying the Hadamard gate to a qubit initially in the (|0\rangle) state results in the state:
67+
The Hadamard gate ((H)) is a fundamental quantum gate that puts a qubit into a
68+
superposition state. Applying the Hadamard gate to a qubit initially in the
69+
$|0\rangle$ state results in the state:
5570

5671
$$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$
5772

@@ -66,7 +81,9 @@ result = qc.execute_circuit()
6681
print(result)
6782
```
6883

69-
In this example, the Hadamard gate is applied to the qubit at index 0, and the circuit is executed to obtain the measurement results. The output will show the probabilities of measuring the qubit in the (|0\rangle) and (|1\rangle) states.
84+
In this example, the Hadamard gate is applied to the qubit at index 0, and the
85+
circuit is executed to obtain the measurement results. The output will show the
86+
probabilities of measuring the qubit in the $|0\rangle$ and $|1\rangle$ states.
7087

7188
### Visualizing the Circuit
7289

website/quantum-computing-primer/04_quantum_gates/index.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ print(result)
3636

3737
## 4.2 Multi-Qubit Gates
3838

39-
Multi-qubit gates operate on two or more qubits, enabling entanglement and more complex quantum operations. Some of the most common multi-qubit gates include:
39+
Multi-qubit gates operate on two or more qubits, enabling entanglement and more
40+
complex quantum operations. Some of the most common multi-qubit gates include:
4041

41-
- **CNOT Gate (Controlled-NOT)**: Flips the target qubit if the control qubit is in the state |1⟩.
42-
- **Toffoli Gate (CCNOT)**: A controlled-controlled-NOT gate that flips the target qubit if both control qubits are in the state |1⟩.
42+
- **CNOT Gate (Controlled-NOT)**: Flips the target qubit if the control qubit is
43+
in the state $|1\rangle$.
44+
- **Toffoli Gate (CCNOT)**: A controlled-controlled-NOT gate that flips the
45+
target qubit if both control qubits are in the state $|1\rangle$.
4346
- **SWAP Gate**: Exchanges the states of two qubits.
4447

4548
### Example: Applying a CNOT Gate

website/quantum-computing-primer/07_quantum_algorithms/index.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ Quantum algorithms leverage the unique properties of quantum mechanics, such as
1111

1212
## 7.1 Deutsch-Jozsa Algorithm
1313

14-
The Deutsch-Jozsa algorithm is one of the earliest quantum algorithms that demonstrates the potential of quantum computing. It solves a specific problem exponentially faster than any classical algorithm.
14+
The Deutsch-Jozsa algorithm is one of the earliest quantum algorithms that
15+
demonstrates the potential of quantum computing. It solves a specific problem
16+
exponentially faster than any classical algorithm.
1517

1618
### Problem Statement
17-
Given a function \( f: \{0,1\}^n \rightarrow \{0,1\} \), determine whether the function is **constant** (returns the same value for all inputs) or **balanced** (returns 0 for half of the inputs and 1 for the other half).
19+
Given a function $ f: \{0,1\}^n \rightarrow \{0,1\} $, determine whether the
20+
function is **constant** (returns the same value for all inputs) or **balanced**
21+
(returns 0 for half of the inputs and 1 for the other half).
1822

1923
### Quantum Solution
20-
The Deutsch-Jozsa algorithm uses quantum parallelism to evaluate the function over all possible inputs simultaneously. It requires only **one query** to the function, whereas a classical algorithm would need \( 2^{n-1} + 1 \) queries in the worst case.
24+
The Deutsch-Jozsa algorithm uses quantum parallelism to evaluate the function
25+
over all possible inputs simultaneously. It requires only **one query** to the
26+
function, whereas a classical algorithm would need $ 2^{n-1} + 1 $ queries in
27+
the worst case.
2128

2229
### Implementation with `qumat`
2330
Here’s how you can implement the Deutsch-Jozsa algorithm using `qumat`:
@@ -55,10 +62,12 @@ print(result)
5562

5663
## 7.2 Grover's Algorithm
5764

58-
Grover's algorithm is a quantum search algorithm that can search an unsorted database of \( N \) items in \( O(\sqrt{N}) \) time, compared to \( O(N) \) for classical algorithms.
65+
Grover's algorithm is a quantum search algorithm that can search an unsorted
66+
database of $ N $ items in $ O(\sqrt{N}) $ time, compared to $ O(N) $ for
67+
classical algorithms.
5968

6069
### Problem Statement
61-
Given an unsorted database of \( N \) items, find a specific item (marked by an oracle) with as few queries as possible.
70+
Given an unsorted database of $ N $ items, find a specific item (marked by an oracle) with as few queries as possible.
6271

6372
### Quantum Solution
6473
Grover's algorithm uses amplitude amplification to increase the probability of measuring the marked item. It consists of two main steps:
@@ -109,7 +118,7 @@ print(result)
109118
```
110119

111120
### Explanation
112-
- The oracle marks the desired state (e.g., `|110>`).
121+
- The oracle marks the desired state (e.g., $|110\rangle$).
113122
- The diffusion operator amplifies the probability of measuring the marked state.
114123
- After running the algorithm, the marked state will have a higher probability of being measured.
115124

website/quantum-computing-primer/10_advanced_topics/index.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ qc.create_empty_circuit(3)
2525

2626
# Apply the Quantum Fourier Transform
2727
def apply_qft(qc, n_qubits):
28-
for qubit in range(n_qubits):
29-
qc.apply_hadamard_gate(qubit)
30-
for next_qubit in range(qubit + 1, n_qubits):
31-
angle = 2 * 3.14159 / (2 ** (next_qubit - qubit + 1))
32-
qc.apply_cu_gate(next_qubit, qubit, angle)
28+
for qubit in range(n_qubits):
29+
qc.apply_hadamard_gate(qubit)
30+
for next_qubit in range(qubit + 1, n_qubits):
31+
angle = 2 * 3.14159 / (2 ** (next_qubit - qubit + 1))
32+
qc.apply_cu_gate(next_qubit, qubit, angle)
3333

3434
apply_qft(qc, 3)
3535

@@ -56,11 +56,11 @@ qc.create_empty_circuit(3)
5656

5757
# Apply the Quantum Phase Estimation
5858
def apply_qpe(qc, n_qubits):
59-
for qubit in range(n_qubits):
60-
qc.apply_hadamard_gate(qubit)
61-
# Apply controlled unitary operations (simplified example)
62-
qc.apply_cu_gate(1, 0, 3.14159 / 2)
63-
qc.apply_cu_gate(2, 1, 3.14159 / 4)
59+
for qubit in range(n_qubits):
60+
qc.apply_hadamard_gate(qubit)
61+
# Apply controlled unitary operations (simplified example)
62+
qc.apply_cu_gate(1, 0, 3.14159 / 2)
63+
qc.apply_cu_gate(2, 1, 3.14159 / 4)
6464
# Inverse QFT
6565
apply_qft(qc, n_qubits)
6666

@@ -89,13 +89,13 @@ qc.create_empty_circuit(2)
8989

9090
# Apply the Quantum Annealing process
9191
def apply_quantum_annealing(qc, n_qubits):
92-
for qubit in range(n_qubits):
93-
qc.apply_hadamard_gate(qubit)
94-
# Apply a simple Hamiltonian (simplified example)
95-
qc.apply_rx_gate(0, 3.14159 / 2)
96-
qc.apply_ry_gate(1, 3.14159 / 2)
97-
# Measure the qubits
98-
qc.execute_circuit()
92+
for qubit in range(n_qubits):
93+
qc.apply_hadamard_gate(qubit)
94+
# Apply a simple Hamiltonian (simplified example)
95+
qc.apply_rx_gate(0, 3.14159 / 2)
96+
qc.apply_ry_gate(1, 3.14159 / 2)
97+
# Measure the qubits
98+
qc.execute_circuit()
9999

100100
apply_quantum_annealing(qc, 2)
101101

0 commit comments

Comments
 (0)