Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
projects:quantum:hottblockp1 [2025/09/23 11:13] – created kymkiprojects:quantum:hottblockp1 [2025/09/23 11:46] (current) kymki
Line 1: Line 1:
-Here’s a **draft of Post 1** in a concise, formal Markdown style, written for an educational blog. It assumes readers have cloned your repo and installed requirements.+====== Post 1 — Qubits and the Bloch Sphere ======
  
-````markdown +This first entry introduces the Bloch sphere representation of qubits and demonstrates how to obtain Bloch vectors with the [[https://github.com/erikkallman/hottbloch|accompanying Python code]].
-# Post 1 — Qubits and the Bloch Sphere+
  
-This first entry introduces the Bloch sphere representation of qubits and demonstrates how to obtain Bloch vectors with the accompanying Python code.+----
  
----+===== 1. Qubit states and density matrices =====
  
-## 1. Qubit states and density matrices+A pure qubit state is written as \[ |\psi\rangle = \alpha |0\rangle + \beta |1\rangle, \quad \alpha, \beta \in \mathbb{C}, \quad |\alpha|^2 + |\beta|^2 = 1. \] 
  
-A pure qubit state is written as +From this vector we form the density matrix \[ \rho = |\psi\rangle \langle \psi |. \]
-\[ +
-|\psi\rangle \alpha |0\rangle + \beta |1\rangle\quad \alpha, \beta \in \mathbb{C}, \quad |\alpha|^2 + |\beta|^2 = 1. +
-\]+
  
-From this vector we form the density matrix +----
-\[ +
-\rho = |\psi\rangle \langle \psi |. +
-\]+
  
---- +===== 2. Mapping to the Bloch sphere =====
- +
-## 2. Mapping to the Bloch sphere+
  
 The Pauli matrices are The Pauli matrices are
-\[ 
-\sigma_x = 
-\begin{bmatrix} 
-0 & 1 \\ 1 & 0 
-\end{bmatrix}, \quad 
-\sigma_y = 
-\begin{bmatrix} 
-0 & -i \\ i & 0 
-\end{bmatrix}, \quad 
-\sigma_z = 
-\begin{bmatrix} 
-1 & 0 \\ 0 & -1 
-\end{bmatrix}. 
-\] 
  
-The Bloch vector is defined by + \[ \sigma_x = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}, \quad \sigma_y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}, \quad \sigma_z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}. \]  
-\[ + 
-r_i = \operatorname{Tr}(\rho \, \sigma_i), \quad i \in \{x,y,z\}. +The Bloch vector is defined by \[ r_i = \operatorname{Tr}(\rho \, \sigma_i), \quad i \in \{x,y,z\}. \] 
-\]+
  
 For pure states we obtain \(\|r\|=1\), so every qubit corresponds to a point on the unit sphere \(S^2\). For pure states we obtain \(\|r\|=1\), so every qubit corresponds to a point on the unit sphere \(S^2\).
  
----+===== 3. Using the code =====
  
-## 3. Using the code +The function **state_to_bloch** implements this mapping.  
- +
-The function `state_to_blochimplements this mapping.  +
 Example: Example:
  
-```python+<code python>
 import numpy as np import numpy as np
-import hott_bloch_edu as h+import hottbloch as h
  
 # Basis states # Basis states
Line 68: Line 42:
 ket_plus = (ket0 + ket1) / np.sqrt(2) ket_plus = (ket0 + ket1) / np.sqrt(2)
 print("Bloch vector of |+>:", h.state_to_bloch(ket_plus)) print("Bloch vector of |+>:", h.state_to_bloch(ket_plus))
-````+</code>
  
 Expected output: Expected output:
  
-$|0\rangle$ maps to the north pole $(0,0,1)$. +$|0\rangle$ maps to the north pole $(0,0,1)$.  
-$|1\rangle$ maps to the south pole $(0,0,-1)$. + 
-$|+\rangle$ maps to a point on the equator $(1,0,0)$.+$|1\rangle$ maps to the south pole $(0,0,-1)$.  
 + 
 +$|+\rangle$ maps to a point on the equator $(1,0,0)$.
  
----+----
  
-## 4. Visualization+===== 4. Visualization =====
  
 To plot Bloch points or loops, use: To plot Bloch points or loops, use:
  
-```bash +<code bash> 
-python hott_bloch_edu.py --out ./hott_outputs --loop equator --theta 0 +python hottbloch.py --out ./hott_outputs --loop equator --theta 0 
-```+</code>
  
-This produces a static Bloch sphere with a marked state.+This produces a static Bloch sphere with a marked state.  
 Images are saved in `./hott_outputs`. Images are saved in `./hott_outputs`.
  
----+----
  
-## Conclusion+===== Conclusion =====
  
-This establishes the basic correspondence between qubit states and points on the Bloch sphere. In subsequent posts we extend this to continuous paths, closed loops, and their associated geometric phases.+This establishes the basic correspondence between qubit states and points on the Bloch sphere.   
 +In subsequent posts we extend this to continuous paths, closed loops, and their associated geometric phases.