Generates unique Julia-set fractals driven by a quantum circuit executed on a hardware-realistic noise model of IQM's 20-qubit Garnet processor.
Each run produces a different fractal because:
- The quantum circuit uses randomly sampled gate angles.
- IQM's hardware noise model (T1/T2 relaxation, gate errors, readout errors) introduces authentic quantum imperfections that shift the fractal parameter.
The visual style references Vincent van Gogh's The Starry Night through a custom blue-yellow colormap and an optional composite with the original painting.
Random U gates (θ, φ, λ)
│
▼
┌─────────────────────────────────────┐
│ Quantum Circuit (2 qubits) │
│ H(q0) → CNOT(q0→q1) │
│ → U(θ₁,φ₁,λ₁) on q0 │
│ → U(θ₂,φ₂,λ₂) on q1 │
└──────────────┬──────────────────────┘
│ transpile to IQM native gates (PRX + CZ)
▼
┌─────────────────────────────────────┐
│ IQMFakeGarnet (8 192 shots) │
│ Hardware-realistic noise model │
│ based on IQM Garnet 20-qubit QPU │
└──────────────┬──────────────────────┘
│ measurement counts {00, 01, 10, 11}
▼
c = (P₀₀ − P₁₁) + i·(P₀₁ − P₁₀)
│
▼
┌─────────────────────────────────────┐
│ Julia set z → z² + c │
│ 1000×1000 px, 100 iterations │
│ Van Gogh blue-yellow colormap │
└──────────────┬──────────────────────┘
│
▼
fractal.png + new_image.png
The original Bell state alone creates a symmetric state where P(|00⟩) = P(|11⟩)
and P(|01⟩) = P(|10⟩), which would always give c = 0 (a trivial Julia set).
Applying an independent random U gate to each qubit breaks this symmetry so
that all four probabilities are distinct, yielding a genuinely complex-valued c.
pip install "iqm-client[qiskit]" qiskit qiskit-aer numpy matplotlib PillowNote: The old
qiskit-iqmpackage is deprecated. Useiqm-client[qiskit](documented at docs.meetiqm.com).
# Optional: place gogh_night.png in the project directory for the composite output
python fractal.py- Krok 1 — fraktal. Skrypt liczy
cz obwodu (lubFIXED_C), rysuje zbiór Julii i zapisujefractal.png. - Krok 2 — Van Gogh na wierzch. Jeśli
COMPOSITE_WITH_GOGHjest włączone i jest plikgogh_night.png, fraktal jest używany jako tło na całą kanwę (powiększenie „cover”), a obraz malarski jest wklejony na środek z kanałem alfa — efekt wnew_image.png.
Logika wgogh_style.compose_gogh_over_fractal(marginespad_ratiowokół obrazka, żeby widać obramowanie fraktala).
Przykłady (4 gotowe c):
python generate_examples.py→ examples/*.png (same fraktale), potem examples/*_gogh.png (z nałożonym obrazem).
Output files
| File | Description |
|---|---|
fractal.png |
Julia-set fractal (1000×1000 px, 300 DPI) |
new_image.png |
Fractal composited with gogh_night.png (if present) |
To run on an actual IQM quantum computer instead of the noise simulator,
replace the backend setup in fractal.py with:
import os
from qiskit import transpile
from iqm.qiskit_iqm import IQMProvider
# Store your token in the IQM_TOKEN environment variable
provider = IQMProvider("https://cocos.resonance.meetiqm.com/garnet")
backend = provider.get_backend()
circuit_meas = circuit.copy()
circuit_meas.measure_all()
transpiled = transpile(circuit_meas, backend=backend)
job = backend.run(transpiled, shots=SHOTS)
counts = job.result().get_counts()Get your API token at resonance.meetiqm.com.
| Package | Role |
|---|---|
iqm-client[qiskit] |
IQM fake backend & Resonance cloud access |
qiskit |
Quantum circuit construction & transpilation |
qiskit-aer |
Statevector visualization (plot_state_qsphere) |
numpy |
Vectorised Julia set computation |
matplotlib |
Fractal rendering & colormap |
Pillow |
Image compositing |
Tak — i to zaskakująco szerokie:
Kryptografia i generatory liczb pseudolosowych
Iteracje fraktalne są czułe na wartość parametru c — mała zmiana daje zupełnie inny obraz. Ta własność (chaos deterministyczny) jest wykorzystywana do projektowania generatorów liczb pseudolosowych i funkcji jednokierunkowych w kryptografii.
Kompresja obrazów (IFS — Iterated Function Systems) Fraktale są podstawą algorytmów kompresji opartych na samopodobieństwie. Algorytm fractal image compression (Jacquin, 1992) koduje obraz jako zestaw transformacji afinicznych — osiąga wyższe współczynniki kompresji niż JPEG przy zachowaniu jakości.
Modelowanie złożonych układów Granice zbiorów Julii odpowiadają tzw. atraktorom dziwnym, które pojawiają się w modelowaniu turbulencji, wzrostu kryształów, dynamiki rynków finansowych czy rozprzestrzeniania się chorób.
Wizualizacja danych kwantowych Obwody kwantowe operują na przestrzeni zespolonej — amplitudy są liczbami zespolonymi. Mapowanie amplitud na fraktal jest naturalnym sposobem wizualizacji stanu kwantowego w formie, którą człowiek może intuicyjnie interpretować.
Ten projekt to więcej niż generator ładnych obrazków. Wskazuje on na kilka realnych kierunków badawczych:
1. Kwantowy generator sztuki proceduralnej Każde uruchomienie obwodu kwantowego daje unikalny, niepowtarzalny fraktal — prawdziwa losowość kwantowa (w odróżnieniu od pseudolosowości klasycznej). To fundament dla systemów generatywnego NFT, gier czy architektury proceduralnej.
2. Wizualizacja stanów kwantowych
Parametr c enkoduje informację o splątaniu kubitu. Można zbadać, jak różne typy splątania (stany Bella, GHZ, W) przekładają się na różne klasy fraktali — jest to potencjalnie nowy sposób klasyfikacji stanów kwantowych.
3. Kwantowa weryfikacja obwodów Porównując fraktal wygenerowany przez idealny symulator z fraktalem z prawdziwego sprzętu (IQM Resonance), można wizualnie ocenić poziom szumów i dekoherencji — „fingerprint" konkretnego procesora kwantowego.
4. Algorytm Quantum Walk na fraktalu Spacery kwantowe (quantum walks) na grafach o strukturze fraktalnej wykazują inne właściwości niż klasyczne spacery losowe. Zbadanie dynamiki kwantowej na zbiorze Julii jako grafie to otwarty temat badawczy.
5. Sztuka i edukacja kwantowa Projekt obniża barierę wejścia do obliczeń kwantowych — fraktal jest natychmiast zrozumiałym, pięknym wynikiem działania obwodu kwantowego. To skuteczne narzędzie dydaktyczne dla studentów fizyki, informatyki i matematyki.
This paper presents a method for generating geometric fractals using quantum computation. A 2-qubit quantum circuit consisting of a Bell state and two independent randomized unitary U gates is executed on a hardware-realistic noise model of IQM's Garnet processor. The four measurement probabilities of the resulting quantum state are mapped to a single complex number c, which serves as the parameter in the Julia set iteration formula z → z² + c. Each run of the program yields a unique fractal due to both the randomly sampled gate angles and the stochastic nature of quantum hardware noise. The visualization references Van Gogh's Starry Night through a custom blue-yellow colormap and image compositing. The project demonstrates an original intersection of quantum mechanics and generative computer art.