Quick Example
Fixed Mixed-Gate Circuit: Quantum Circuit Example
Fixed five-qubit circuit with mixed gates
What this example teaches
Inspect one fixed five-qubit circuit containing mixed gates.
Expected result
The gate list and distribution are fixed. The ideal probability that the last browser bit q4 is 1 is (1 + sin(1.34))/2, about 98.6742%. This marginal does not verify the entire state.
Browser bit strings list physical wires q0 first, including auxiliary wires. Native classical-register strings can use another order; inspect the declared measurements.
These are ideal probabilities. Sampled frequencies fluctuate when more than one outcome is possible; they need not match percentages exactly. An ideal outcome with probability 100% has no finite-shot variation. Hardware noise is a separate effect.
Try the example
The link opens the editor. Save existing work, then choose Examples → Fixed Mixed-Gate Circuit → framework. Click Run, choose an available browser simulator, then click Run in browser. The link does not preselect or execute the example.
Scope and limitations
- The gates and angles are fixed; this is not a random-circuit generator, hardware benchmark or sampling-hardness demonstration.
These expected answers describe the fixed circuit. This page does not establish a completed hosted or hardware run. Read the user guide for this example.
Inspect and download the circuit
Inspect the same fixed circuit in five frameworks. Browser execution translates supported circuit definitions into OpenQASM; it does not run general Python. Outside Marqov, Qiskit, Cirq, and Marqov snippets need a separate simulator invocation. PennyLane invokes its QNode and stores sampled counts in result.
OpenQASM
// Fixed Mixed-Gate Circuit — five qubits; no random gate generation
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5];
creg c[5];
h q[0];
rx(1.23) q[1];
ry(0.45) q[2];
rz(2.67) q[3];
h q[4];
cx q[0],q[1];
cx q[2],q[3];
cx q[3],q[4];
ry(0.89) q[0];
rx(1.56) q[2];
cx q[1],q[2];
h q[3];
cx q[0],q[4];
rz(0.78) q[1];
ry(1.34) q[4];
measure q -> c;
Download OpenQASM circuitQiskit
# Fixed Mixed-Gate Circuit — five qubits; no random gate generation
from qiskit import QuantumCircuit
qc = QuantumCircuit(5, 5)
qc.h(0)
qc.rx(1.23, 1)
qc.ry(0.45, 2)
qc.rz(2.67, 3)
qc.h(4)
qc.cx(0, 1)
qc.cx(2, 3)
qc.cx(3, 4)
qc.ry(0.89, 0)
qc.rx(1.56, 2)
qc.cx(1, 2)
qc.h(3)
qc.cx(0, 4)
qc.rz(0.78, 1)
qc.ry(1.34, 4)
qc.measure(range(5), range(5))
Download Qiskit circuitCirq
# Fixed Mixed-Gate Circuit — five qubits; no random gate generation
import cirq
q = cirq.LineQubit.range(5)
circuit = cirq.Circuit([
cirq.H(q[0]),
cirq.rx(1.23)(q[1]),
cirq.ry(0.45)(q[2]),
cirq.rz(2.67)(q[3]),
cirq.H(q[4]),
cirq.CNOT(q[0], q[1]),
cirq.CNOT(q[2], q[3]),
cirq.CNOT(q[3], q[4]),
cirq.ry(0.89)(q[0]),
cirq.rx(1.56)(q[2]),
cirq.CNOT(q[1], q[2]),
cirq.H(q[3]),
cirq.CNOT(q[0], q[4]),
cirq.rz(0.78)(q[1]),
cirq.ry(1.34)(q[4]),
cirq.measure(*q, key="result"),
])
Download Cirq circuitPennyLane
# Fixed Mixed-Gate Circuit — five qubits; no random gate generation
import pennylane as qml
dev = qml.device("default.qubit", wires=5, shots=1000)
@qml.qnode(dev)
def random_circuit():
qml.Hadamard(wires=0)
qml.RX(1.23, wires=1)
qml.RY(0.45, wires=2)
qml.RZ(2.67, wires=3)
qml.Hadamard(wires=4)
qml.CNOT(wires=[0, 1])
qml.CNOT(wires=[2, 3])
qml.CNOT(wires=[3, 4])
qml.RY(0.89, wires=0)
qml.RX(1.56, wires=2)
qml.CNOT(wires=[1, 2])
qml.Hadamard(wires=3)
qml.CNOT(wires=[0, 4])
qml.RZ(0.78, wires=1)
qml.RY(1.34, wires=4)
return qml.counts()
result = random_circuit()
Download PennyLane circuitMarqov
# Fixed Mixed-Gate Circuit — five qubits; no random gate generation
from marqov import Circuit
circuit = (
Circuit()
.h(0).rx(1.23, 1).ry(0.45, 2).rz(2.67, 3).h(4)
.cnot(0, 1).cnot(2, 3).cnot(3, 4)
.ry(0.89, 0).rx(1.56, 2)
.cnot(1, 2).h(3).cnot(0, 4)
.rz(0.78, 1).ry(1.34, 4)
)
Download Marqov circuitSources and provenance
These references explain the concept and gate conventions. The snippets originate in Marqov's internal example collection; an upstream code attribution has not been established.
Snapshot identity
- Source revision
df5a80cd474144684bf69dbda237b28ce40cc48c- Example version
c8c4890a5815dc62a8cd7d1cc61e1a8fc8294a7373546223d2704f9c769f4b6e
The source revision identifies the editor collection used for this snapshot. The example version identifies its five exact code variants; neither is evidence of a hosted run.
Go deeper
For a paper-based experiment with scientific comparisons and execution evidence, read Research Replications. Its published scope and availability are separate from this small teaching circuit.