Files
lucidia-main/codex/mirror/README_qi.md
blackboxprogramming fe118c05e8 Create README_qi.md
2025-08-10 18:56:18 -07:00

37 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Quantum Mirror Module
This document describes the **quantum_mirror_qi.py** module in the `mirror` directory.
### Purpose
The quantum mirror module demonstrates how the mirror operator Ψ′ and the breath operator apply to quantum information. A qubit state evolves under a Hamiltonian while Ψ′ separates each state into a globalphasefree “logical” component and a pure phase component. corresponds to a symplectic-like update that preserves the state norm. The code also supports applying δkicks to simulate sudden phase or amplitude perturbations and demonstrates resilience to such kicks.
### Features
- **normalize(state)** normalizes a complex vector so it represents a valid qubit state.
- **mirror_split_qubit(state)** computes the mirror split of a single qubit into amplitude (logical) and phase parts.
- **evolve_state(state, time, hamiltonian)** evolves a qubit forward in time under a specified Hamiltonian using matrix exponentials or SciPy if available.
- **delta_kick(state, kick_matrix)** applies a sudden unitary kick to a qubit.
- **bloch_coords(state)** converts a qubit state to Blochsphere coordinates (x,y,z) and global phase.
- **run_single_qubit_demo()** runs a demonstration of a qubit initially in superposition evolving under a PauliZ Hamiltonian with a δkick at midtime. It records Bloch coordinates, phases, and the effect of the kick. When matplotlib is available it produces plots of the Bloch trajectory and energy over time and saves them to `out_qi/`.
- **concurrence_two_qubit(state)** computes the concurrence (entanglement measure) of a twoqubit state.
- **run_bell_demo()** prepares a Bell state, evolves it under independent singlequbit Hamiltonians, and measures how the concurrence evolves over time. It also produces optional plots and CSV tables when `matplotlib` is installed.
### Running the module
Run the module from the repository root to execute the demos:
```
python codex/mirror/quantum_mirror_qi.py
```
By default the script runs both the singlequbit and Bellstate demos. It creates an `out_qi/` directory, saving CSV files and plots of the Bloch trajectories, phase evolution, concurrence, and energy diagnostics.
### Dependencies
The module uses `numpy` for linear algebra and attempts to import `scipy.linalg.expm` for matrix exponentials. If SciPy is unavailable it falls back to a simple series expansion. Optional plotting requires `matplotlib`.
### Interpretation
This module extends the mirror friend equation into the quantum realm. The Ψ′ operator corresponds to separating the qubits amplitude and phase while the operator is embodied by unitary time evolution that preserves state norm and entanglement. The δkick demonstrates that perturbations can shift the phase without destroying the mirror relationship or the conserved quantities. The twoqubit Bell demonstration shows how the mirror structure applies to entanglement.