[{"data":1,"prerenderedAt":2333},["ShallowReactive",2],{"blog-post-quantum-superposition":3,"sibling-dives-quantum-superposition":2331,"learn-track-quantum-superposition":2332},{"id":4,"title":5,"authors":6,"body":8,"breadcrumb":2289,"builders":2293,"byline":2306,"category":2307,"categoryName":2307,"challenge":2307,"courseAuthor":2307,"courseLead":2307,"dek":2308,"description":2309,"draft":2310,"extension":2311,"eyebrow":2307,"featured":2310,"finish":2307,"fork":2312,"hero":2307,"heroAlt":2307,"heroCta":2307,"heroImage":2307,"homepageFeatured":2310,"kind":2314,"lessonCount":2307,"meta":2315,"navigation":2316,"newsItems":2307,"next":2307,"ogImage":2317,"order":2307,"outcomes":2307,"path":2318,"publishDate":2319,"readingTime":2320,"related":2321,"relatedProjects":2307,"seo":2322,"stem":2325,"tags":2326,"track":2307,"trackName":2307,"__hash__":2330},"blog\u002Fblog\u002Flearn\u002Fquantum-superposition.md","Understanding Quantum Superposition",[7],"nico",{"type":9,"value":10,"toc":2274},"minimark",[11,15,20,29,41,44,52,56,59,62,65,68,71,80,84,87,101,104,107,111,120,363,366,506,509,512,515,518,521,524,528,531,549,572,589,598,619,632,636,639,645,738,741,752,761,767,771,774,785,946,949,965,968,976,980,983,1242,1248,1251,1259,1263,1266,1269,1272,1295,1308,1707,1728,1731,1734,1737,1744,1748,1755,1762,1777,1783,1786,1790,1793,1937,1943,1950,1953,1957,1960,2115,2126,2132,2135,2210,2227,2234,2246,2250,2253,2256,2259,2270],[12,13,14],"p",{},"\"A quantum computer tries every answer at once\" is the usual one-line account of why these machines matter. The claim is about the state inside the circuit. Your results are a different matter.",[16,17,19],"h2",{"id":18},"what-is-quantum-superposition","What is quantum superposition?",[21,22,23,26],"quick-answer",{},[12,24,25],{},"Superposition is a qubit carrying a weight on each outcome it could produce, instead of carrying a value. Measuring turns those weights into one answer, and running the same circuit again can give you a different one.",[12,27,28],{},"The weights are part of the qubit. You set them with rotation gates, you can tune them continuously rather than only to fifty-fifty, and each qubit you put into superposition doubles how many outcomes carry weight. The weights themselves never come back out. A quantum computer returns a tally of measured outcomes and nothing else.",[12,30,31,32,36,37,40],{},"Start with an ordinary bit. It holds a ",[33,34,35],"code",{},"0"," or a ",[33,38,39],{},"1",". If you have not looked at it you do not know which, but it is already one or the other, and looking only tells you which one it was.",[12,42,43],{},"A qubit in superposition is not a bit you have not looked at. Before you measure, there is no value in there to find. What the qubit carries instead is a weight on each outcome it could produce, and measuring is the step that turns those weights into one answer.",[12,45,46,47,36,49,51],{},"Those two situations sound identical from the outside. Both give you a ",[33,48,35],{},[33,50,39],{},", and neither lets you predict which. Telling them apart takes three pieces of plastic.",[16,53,55],{"id":54},"adding-a-filter-lets-more-light-through","Adding a filter lets more light through",[12,57,58],{},"A polarising filter passes light lined up with its own axis and blocks light across it. Two filters at right angles pass nothing, because what clears the first is exactly what the second stops.",[12,60,61],{},"Put a third filter between those two at forty-five degrees and about a quarter of the light that cleared the first reaches the far side. Adding a filter increased the light.",[12,63,64],{},"No sorting story explains that. If each photon carried a polarisation all along and the filters only sorted them, one more filter could subtract and never add.",[12,66,67],{},"A filter does not sort. Every photon that comes out of one is polarised along that filter's axis, whatever it was doing before. So the middle filter hands the last filter light at forty-five degrees to it, where the first filter would have handed it ninety. Forty-five degrees is a fight the last filter only half wins. Half the light clears the middle filter, half of that clears the last, and half of a half is the quarter.",[12,69,70],{},"The middle filter is also a dial: about a fifth of the light at thirty degrees, a quarter at forty-five, nothing at ninety. Each filter on its own passes cos² of the angle to the one before it, which is Malus's law, written down for light in 1809. Two of those in a row multiply, which is why the dial peaks in the middle instead of climbing.",[12,72,73,74,76,77,79],{},"A qubit works the same way and the code below says so out loud. Rotate one by an angle θ away from a certain ",[33,75,35],{},", measure it, and ",[33,78,35],{}," comes back cos²(θ\u002F2) of the time. The filter angle and the rotation angle are the same dial.",[16,81,83],{"id":82},"where-superposition-came-from","Where superposition came from",[12,85,86],{},"The idea arrived as a property of waves, and the arguing was over what it meant for matter.",[88,89],"timeline",{"l1":90,"l2":91,"l3":92,"l4":93,"l5":94,"l6":95,"w1":96,"w2":97,"w3":97,"w4":98,"w5":99,"w6":100},"De Broglie proposes that matter behaves as a wave.","Schrödinger's equation is linear, so any sum of solutions is also a solution.","Born reads the square of the wave as probability, which is what makes the weights weights.","Davisson and Germer diffract electrons, confirming the wave behaviour.","Dirac opens his textbook with superposition as a founding principle.","Schrödinger publishes the cat as an absurdity, not an illustration.","1924","1926","1927","1930","1935",[12,102,103],{},"Schrödinger meant the cat as an objection. A cat both alive and dead is ridiculous, and his point was that a theory letting you write one down needed better rules about when superposition stops. The phrase \"both at once\" outlived the argument he was making with it.",[12,105,106],{},"None of that has to be settled to write a circuit. The weights are numbers you set with gates and read back as counts.",[16,108,110],{"id":109},"the-smallest-superposition-you-can-make","The smallest superposition you can make",[12,112,113,114,116,117,119],{},"One qubit and one gate. The Hadamard leaves a qubit weighted evenly between ",[33,115,35],{}," and ",[33,118,39],{},". A single run gives one answer, so you run the circuit a thousand times and read the split off the tally. Each run is called a shot.",[121,122,126],"code-block",{"name":123,"run-href":124,"tag":125},"one_superposition.py","\u002Fu\u002Fqollab\u002Fbell-state","Python · Playground version",[127,128,133],"pre",{"className":129,"code":130,"language":131,"meta":132,"style":132},"language-python shiki shiki-themes one-dark-pro","# 'backend' is pre-created for you in the Qollab Playground.\nfrom qiskit import QuantumCircuit\n\nqc = QuantumCircuit(1, 1)\nqc.h(0)\nqc.measure(0, 0)\n\njob = backend.run(qc, shots=1000)\nprint(job.result().get_counts())\n","python","",[33,134,135,149,168,176,207,225,246,253,284,308],{"__ignoreMap":132},[136,137,140,145],"span",{"class":138,"line":139},"line",1,[136,141,144],{"class":142,"aria-hidden":143},"qg-cue qg-cue--empty","true","​",[136,146,148],{"class":147},"sV9Aq","# 'backend' is pre-created for you in the Qollab Playground.\n",[136,150,152,154,158,162,165],{"class":138,"line":151},2,[136,153,144],{"class":142,"aria-hidden":143},[136,155,157],{"class":156},"seHd6","from",[136,159,161],{"class":160},"sn6KH"," qiskit ",[136,163,164],{"class":156},"import",[136,166,167],{"class":160}," QuantumCircuit\n",[136,169,171,173],{"class":138,"line":170},3,[136,172,144],{"class":142,"aria-hidden":143},[136,174,175],{},"​\n",[136,177,179,182,185,189,193,196,199,202,204],{"class":138,"data-cue":39,"line":178},4,[136,180,39],{"class":181},"qg-cue",[136,183,184],{"class":160},"qc ",[136,186,188],{"class":187},"sjrmR","=",[136,190,192],{"class":191},"sVbv2"," QuantumCircuit",[136,194,195],{"class":160},"(",[136,197,39],{"class":198},"sVC51",[136,200,201],{"class":160},", ",[136,203,39],{"class":198},[136,205,206],{"class":160},")\n",[136,208,211,213,216,219,221,223],{"class":138,"data-cue":209,"line":210},"2",5,[136,212,209],{"class":181},[136,214,215],{"class":160},"qc.",[136,217,218],{"class":191},"h",[136,220,195],{"class":160},[136,222,35],{"class":198},[136,224,206],{"class":160},[136,226,229,231,233,236,238,240,242,244],{"class":138,"data-cue":227,"line":228},"3",6,[136,230,227],{"class":181},[136,232,215],{"class":160},[136,234,235],{"class":191},"measure",[136,237,195],{"class":160},[136,239,35],{"class":198},[136,241,201],{"class":160},[136,243,35],{"class":198},[136,245,206],{"class":160},[136,247,249,251],{"class":138,"line":248},7,[136,250,144],{"class":142,"aria-hidden":143},[136,252,175],{},[136,254,257,259,262,264,267,270,273,277,279,282],{"class":138,"data-cue":255,"line":256},"4",8,[136,258,255],{"class":181},[136,260,261],{"class":160},"job ",[136,263,188],{"class":187},[136,265,266],{"class":160}," backend.",[136,268,269],{"class":191},"run",[136,271,272],{"class":160},"(qc, ",[136,274,276],{"class":275},"s_ZVi","shots",[136,278,188],{"class":187},[136,280,281],{"class":198},"1000",[136,283,206],{"class":160},[136,285,288,290,293,296,299,302,305],{"class":138,"data-cue":286,"line":287},"5",9,[136,289,286],{"class":181},[136,291,292],{"class":187},"print",[136,294,295],{"class":160},"(job.",[136,297,298],{"class":191},"result",[136,300,301],{"class":160},"().",[136,303,304],{"class":191},"get_counts",[136,306,307],{"class":160},"())\n",[309,310,312,321,333,346,353],"ol",{"class":311},"qg-cues",[313,314,315,317],"li",{"data-cue":39},[136,316,39],{"class":181},[136,318,320],{"class":319},"qg-cues__text","A circuit is a list of operations to run in order. This one asks for a single qubit to do the quantum work and one ordinary bit to read the answer into.",[313,322,323,325],{"data-cue":209},[136,324,209],{"class":181},[136,326,327,328,116,330,332],{"class":319},"A gate is one operation applied to a qubit. This is the Hadamard, applied to qubit 0, and it leaves that qubit with no fixed value and equal weight on ",[33,329,35],{},[33,331,39],{},".",[313,334,335,337],{"data-cue":227},[136,336,227],{"class":181},[136,338,339,340,342,343,345],{"class":319},"Measuring is the only way to see a qubit. It forces this one to a definite ",[33,341,35],{}," or ",[33,344,39],{}," and copies that into the bit.",[313,347,348,350],{"data-cue":255},[136,349,255],{"class":181},[136,351,352],{"class":319},"One run gives one answer and which one is random, so run it a thousand times. Each run is called a shot.",[313,354,355,357],{"data-cue":286},[136,356,286],{"class":181},[136,358,359,362],{"class":319},[33,360,361],{},"{'0': 503, '1': 497}"," — the weights were even, so a thousand shots come back about level.",[12,364,365],{},"Add a second qubit and a second Hadamard, then count outcomes rather than qubits. Two or more qubits addressed together are a register.",[121,367,369],{"name":368,"run-href":124,"tag":125},"two_superpositions.py",[127,370,372],{"className":129,"code":371,"language":131,"meta":132,"style":132},"qc = QuantumCircuit(2, 2)\nqc.h(0)\nqc.h(1)\nqc.measure([0, 1], [0, 1])\n\nprint(backend.run(qc, shots=1000).result().get_counts())\n",[33,373,374,394,408,422,451,457,487],{"__ignoreMap":132},[136,375,376,378,380,382,384,386,388,390,392],{"class":138,"line":139},[136,377,144],{"class":142,"aria-hidden":143},[136,379,184],{"class":160},[136,381,188],{"class":187},[136,383,192],{"class":191},[136,385,195],{"class":160},[136,387,209],{"class":198},[136,389,201],{"class":160},[136,391,209],{"class":198},[136,393,206],{"class":160},[136,395,396,398,400,402,404,406],{"class":138,"data-cue":39,"line":151},[136,397,39],{"class":181},[136,399,215],{"class":160},[136,401,218],{"class":191},[136,403,195],{"class":160},[136,405,35],{"class":198},[136,407,206],{"class":160},[136,409,410,412,414,416,418,420],{"class":138,"line":170},[136,411,144],{"class":142,"aria-hidden":143},[136,413,215],{"class":160},[136,415,218],{"class":191},[136,417,195],{"class":160},[136,419,39],{"class":198},[136,421,206],{"class":160},[136,423,424,426,428,430,433,435,437,439,442,444,446,448],{"class":138,"line":178},[136,425,144],{"class":142,"aria-hidden":143},[136,427,215],{"class":160},[136,429,235],{"class":191},[136,431,432],{"class":160},"([",[136,434,35],{"class":198},[136,436,201],{"class":160},[136,438,39],{"class":198},[136,440,441],{"class":160},"], [",[136,443,35],{"class":198},[136,445,201],{"class":160},[136,447,39],{"class":198},[136,449,450],{"class":160},"])\n",[136,452,453,455],{"class":138,"line":210},[136,454,144],{"class":142,"aria-hidden":143},[136,456,175],{},[136,458,459,461,463,466,468,470,472,474,476,479,481,483,485],{"class":138,"data-cue":209,"line":228},[136,460,209],{"class":181},[136,462,292],{"class":187},[136,464,465],{"class":160},"(backend.",[136,467,269],{"class":191},[136,469,272],{"class":160},[136,471,276],{"class":275},[136,473,188],{"class":187},[136,475,281],{"class":198},[136,477,478],{"class":160},").",[136,480,298],{"class":191},[136,482,301],{"class":160},[136,484,304],{"class":191},[136,486,307],{"class":160},[309,488,489,496],{"class":311},[313,490,491,493],{"data-cue":39},[136,492,39],{"class":181},[136,494,495],{"class":319},"An even superposition on each qubit separately. Neither one is doing anything the single-qubit circuit above did not.",[313,497,498,500],{"data-cue":209},[136,499,209],{"class":181},[136,501,502,505],{"class":319},[33,503,504],{},"{'00': 254, '01': 248, '10': 249, '11': 249}"," — four outcomes now, each carrying about a quarter of the weight.",[12,507,508],{},"One qubit puts weight on two outcomes. Two qubits put weight on four. Ten put it on 1,024. Twenty-four put it on 16,777,216. Every Hadamard doubles the number of outcomes carrying weight, and each one costs a single gate.",[12,510,511],{},"Simulation pays for that doubling directly. To simulate a circuit exactly, an ordinary computer stores a complex number per outcome, sixteen bytes each, and applies every gate to all of them.",[12,513,514],{},"Twenty-four qubits is about 270 MB and runs on a laptop. Thirty is 17 GB. Forty is 18 TB. Fifty is 18 PB, the memory of the largest supercomputers on Earth. A quantum processor stores none of it: it is the state rather than a description of one, and adding a qubit adds a qubit.",[12,516,517],{},"Those numbers are for exact simulation. Circuits with little entanglement, or with a lot of repetition in them, are simulated well past fifty qubits by methods that never build the full list. Predictions about what classical machines cannot do keep being beaten, and Quantum Courier's own MaxCut benchmark ran on a simulator at twenty-four qubits without trouble.",[12,519,520],{},"Having a big state space is a reason simulation gets expensive. It is not on its own a reason a quantum computer is faster at anything. Getting a useful answer out still needs a circuit that concentrates the weights somewhere worth measuring, which is a much narrower requirement than having a lot of them.",[12,522,523],{},"Reading the weights back does not get cheaper either. A thousand shots is a thousand shots whether the register holds two outcomes or sixteen million.",[16,525,527],{"id":526},"the-gates-in-these-circuits","The gates in these circuits",[12,529,530],{},"Five gates and one instruction cover every excerpt below.",[532,533,535,546],"gate",{"token":218,"name":534},"Hadamard",[12,536,537,538,540,541,116,543,545],{},"Takes a qubit sitting at ",[33,539,35],{}," and leaves it weighted evenly between ",[33,542,35],{},[33,544,39],{},": measure it and either answer is equally likely.",[12,547,548],{},"Applied to a whole register at once it is the standard opening move. Nothing else puts weight on every possible outcome so cheaply.",[532,550,552,560],{"token":551},"ry",[12,553,554,555,557,558,332],{},"A rotation. The angle comes before the qubit and sets how likely a qubit starting at ",[33,556,35],{}," is to read ",[33,559,39],{},[12,561,562,563,565,566,568,569,571],{},"At ",[33,564,35],{}," it is certain to read ",[33,567,35],{},", at π certain to read ",[33,570,39],{},", and at π\u002F2 it gives the same even split the Hadamard does. Anything in between is a bias you choose, which is how a circuit gets odds other than fifty-fifty.",[532,573,575,583],{"token":574},"rz",[12,576,577,578,342,580,582],{},"A rotation that does not touch how often the qubit reads ",[33,579,35],{},[33,581,39],{},". It moves the phase instead: the relative angle between the two halves of the state.",[12,584,585,586,588],{},"Measure straight away and nothing in the counts depends on it. Put an ",[33,587,218],{}," in front of the measurement, which asks the qubit a different question, and it shows up.",[532,590,592,595],{"token":591},"rx",[12,593,594],{},"A rotation about a different axis. Applied to a qubit that already carries weight on both outcomes, it shifts that weight around rather than setting it from scratch.",[12,596,597],{},"An optimisation circuit later on uses it to move weight between candidate answers instead of sitting on the one it started with.",[532,599,602,608],{"token":600,"name":601},"cx","CNOT",[12,603,604,605,607],{},"Flips the second qubit when the first is ",[33,606,39],{},". On a qubit in superposition this is what ties two of them into one shared state.",[12,609,610,611,613,614,613,616,618],{},"Below it appears inside a pair, ",[33,612,600],{}," then ",[33,615,574],{},[33,617,600],{},". That is the standard way to write a two-qubit interaction using only gates the hardware provides.",[532,620,621,629],{"token":235},[12,622,623,624,342,626,628],{},"Reads a qubit into an ordinary bit and forces it to a definite ",[33,625,35],{},[33,627,39],{},". It is the one irreversible step: whatever weights the qubit carried are gone once you look.",[12,630,631],{},"So a single run tells you one outcome and nothing about the weights behind it, which is why every circuit here is run many times over.",[16,633,635],{"id":634},"a-knob-not-a-coin","A knob, not a coin",[12,637,638],{},"Francisco Estivallet's Superposition Sequencer is a step sequencer where you do not place drum hits. You place gates. On every beat the backend measures the circuit once, and what comes back decides which tracks fire.",[12,640,641,642,644],{},"The instrument is therefore a direct read on what a superposition is for. A qubit that reads ",[33,643,35],{}," every time is a track that plays every beat. A qubit weighted evenly is a track that plays about half the time. Everything between those is a bias you dial in, and the sequencer's own mapping is three lines:",[121,646,650],{"name":647,"run-href":648,"tag":649},"backend\u002Fapp\u002Fmapping\u002Fparameters.py","\u002Fu\u002Fincomputable\u002Fsuperposition-sequencer","Python · from the repo",[127,651,653],{"className":129,"code":652,"language":131,"meta":132,"style":132},"def trigger_probability(theta: float) -> float:\n    \"\"\"P = cos²(θ\u002F2). θ=0 → 1.0; θ=π → 0.0.\"\"\"\n    return math.cos(theta \u002F 2) ** 2\n",[33,654,655,685,693,724],{"__ignoreMap":132},[136,656,657,659,662,665,667,671,674,677,680,682],{"class":138,"line":139},[136,658,144],{"class":142,"aria-hidden":143},[136,660,661],{"class":156},"def",[136,663,664],{"class":191}," trigger_probability",[136,666,195],{"class":160},[136,668,670],{"class":669},"sb9H8","theta",[136,672,673],{"class":160},": ",[136,675,676],{"class":187},"float",[136,678,679],{"class":160},") -> ",[136,681,676],{"class":187},[136,683,684],{"class":160},":\n",[136,686,687,689],{"class":138,"line":151},[136,688,144],{"class":142,"aria-hidden":143},[136,690,692],{"class":691},"subq3","    \"\"\"P = cos²(θ\u002F2). θ=0 → 1.0; θ=π → 0.0.\"\"\"\n",[136,694,695,697,700,703,706,709,712,715,718,721],{"class":138,"data-cue":39,"line":170},[136,696,39],{"class":181},[136,698,699],{"class":156},"    return",[136,701,702],{"class":160}," math.",[136,704,705],{"class":191},"cos",[136,707,708],{"class":160},"(theta ",[136,710,711],{"class":187},"\u002F",[136,713,714],{"class":198}," 2",[136,716,717],{"class":160},") ",[136,719,720],{"class":187},"**",[136,722,723],{"class":198}," 2\n",[309,725,726],{"class":311},[313,727,728,730],{"data-cue":39},[136,729,39],{"class":181},[136,731,732,733,735,736,332],{"class":319},"θ is the polar angle: how far the qubit has been rotated away from a certain ",[33,734,35],{},". The track fires on the beats where the measurement returns ",[33,737,35],{},[12,739,740],{},"The README says it in the language of the instrument. A qubit at the north pole fires every beat, at the equator it is a coin flip, at the south pole it stays silent.",[12,742,743,744,747,748,751],{},"So an angle in a circuit is a rhythm you can hear. The sequencer's Qollab quickstart sets one track with ",[33,745,746],{},"circuit.ry(0.976411, 3)",", and putting that angle through the function above gives ",[33,749,750],{},"cos²(0.4882) = 0.78",". Track three fires on 78% of beats. Nobody wrote 78% anywhere; they wrote an angle, and the weighting followed from it.",[753,754],"project-card",{"builder":755,"description":756,"framework":757,"owner":758,"thumb":759,"title":760,"to":648},"Francisco Estivallet","Francisco Estivallet built a quantum music sequencer where every note comes from a circuit you design, turning a quantum computer into a playable instrument.","Python + Qiskit","incomputable","\u002F_content\u002Fimages\u002Fsuperposition-sequencer\u002Fscreenshot.webp","Superposition Sequencer",[12,762,763,764,766],{},"A coin gives you one distribution. A rotation gives you a dial, and ",[33,765,551],{}," is the dial. A dial is the first thing separating a superposition from a random number generator.",[16,768,770],{"id":769},"the-angle-the-counts-never-show","The angle the counts never show",[12,772,773],{},"A qubit's state has a second angle, and it does not appear in your results at all.",[12,775,776,779,780,116,782,784],{},[33,777,778],{},"trigger_probability"," above takes θ and nothing else. The second angle is φ, the phase: the relative angle between the ",[33,781,35],{},[33,783,39],{}," halves of the state. The sequencer's other mapping takes φ and does something completely different with it:",[121,786,787],{"name":647,"run-href":648,"tag":649},[127,788,790],{"className":129,"code":789,"language":131,"meta":132,"style":132},"MAX_SWING = 0.35  # fraction of beat interval\n\ndef swing_offset(phi: float, max_swing: float = MAX_SWING) -> float:\n    \"\"\"Map azimuthal angle φ in [0, 2π) to swing in [-max_swing, +max_swing].\"\"\"\n    normalized = (phi % (2 * math.pi)) \u002F (2 * math.pi)\n    return (2 * normalized - 1) * max_swing\n",[33,791,792,808,814,852,859,896,925],{"__ignoreMap":132},[136,793,794,796,799,802,805],{"class":138,"line":139},[136,795,144],{"class":142,"aria-hidden":143},[136,797,798],{"class":198},"MAX_SWING",[136,800,801],{"class":187}," =",[136,803,804],{"class":198}," 0.35",[136,806,807],{"class":147},"  # fraction of beat interval\n",[136,809,810,812],{"class":138,"line":151},[136,811,144],{"class":142,"aria-hidden":143},[136,813,175],{},[136,815,816,818,820,823,825,828,830,832,834,837,839,841,843,846,848,850],{"class":138,"line":170},[136,817,144],{"class":142,"aria-hidden":143},[136,819,661],{"class":156},[136,821,822],{"class":191}," swing_offset",[136,824,195],{"class":160},[136,826,827],{"class":669},"phi",[136,829,673],{"class":160},[136,831,676],{"class":187},[136,833,201],{"class":160},[136,835,836],{"class":669},"max_swing",[136,838,673],{"class":160},[136,840,676],{"class":187},[136,842,801],{"class":187},[136,844,845],{"class":198}," MAX_SWING",[136,847,679],{"class":160},[136,849,676],{"class":187},[136,851,684],{"class":160},[136,853,854,856],{"class":138,"line":178},[136,855,144],{"class":142,"aria-hidden":143},[136,857,858],{"class":691},"    \"\"\"Map azimuthal angle φ in [0, 2π) to swing in [-max_swing, +max_swing].\"\"\"\n",[136,860,861,863,866,868,871,874,877,879,882,885,887,889,891,893],{"class":138,"data-cue":39,"line":210},[136,862,39],{"class":181},[136,864,865],{"class":160},"    normalized ",[136,867,188],{"class":187},[136,869,870],{"class":160}," (phi ",[136,872,873],{"class":187},"%",[136,875,876],{"class":160}," (",[136,878,209],{"class":198},[136,880,881],{"class":187}," *",[136,883,884],{"class":160}," math.pi)) ",[136,886,711],{"class":187},[136,888,876],{"class":160},[136,890,209],{"class":198},[136,892,881],{"class":187},[136,894,895],{"class":160}," math.pi)\n",[136,897,898,900,902,904,906,908,911,914,917,919,922],{"class":138,"data-cue":209,"line":228},[136,899,209],{"class":181},[136,901,699],{"class":156},[136,903,876],{"class":160},[136,905,209],{"class":198},[136,907,881],{"class":187},[136,909,910],{"class":160}," normalized ",[136,912,913],{"class":187},"-",[136,915,916],{"class":198}," 1",[136,918,717],{"class":160},[136,920,921],{"class":187},"*",[136,923,924],{"class":160}," max_swing\n",[309,926,927,939],{"class":311},[313,928,929,931],{"data-cue":39},[136,930,39],{"class":181},[136,932,933,934,116,936,938],{"class":319},"φ is the phase: the relative angle between the ",[33,935,35],{},[33,937,39],{}," halves of the state.",[313,940,941,943],{"data-cue":209},[136,942,209],{"class":181},[136,944,945],{"class":319},"φ=0 plays maximally early, φ=π lands on the grid, φ approaching 2π plays maximally late.",[12,947,948],{},"Two circuits with the same θ and different φ draw from the same distribution. Run enough shots and the two tallies converge on each other; the differences that remain are shot noise, not φ. The sequencer still plays them differently, because it does not read φ off the shots. Instead it reads φ off a simulated state, and uses the shots only to decide which beats fire.",[12,950,951,952,954,955,960,961,964],{},"Phase is real, an ",[33,953,574],{}," gate sets it deliberately, and measuring straight away never reports it. ",[956,957,959],"a",{"href":958},"\u002Flearn\u002Fquantum-measurement","Understanding Quantum Measurement"," makes the same point about the ",[33,962,963],{},"z"," gate from the other direction: a sign flip changes the state and changes no count.",[12,966,967],{},"This is also where the word weight has been doing quiet work. A weight is not only a size: it carries a sign, and phase is what sets that sign. Two probabilities can only ever add up, but two weights of opposite sign subtract.",[12,969,970,971,975],{},"So phase becomes visible when two routes to the same outcome meet and their weights either reinforce or cancel. That mechanism is what turns a flat superposition into an answer, and it is a subject of its own: ",[956,972,974],{"href":973},"\u002Flearn\u002Fquantum-interference","Understanding Quantum Interference"," is the article about it.",[16,977,979],{"id":978},"four-superpositions-or-one","Four superpositions, or one?",[12,981,982],{},"The sequencer's sampling module opens with a warning. The mistake it guards against is easy to make and hard to see:",[121,984,986],{"name":985,"run-href":648,"tag":649},"backend\u002Fapp\u002Fquantum\u002Fsampling.py",[127,987,989],{"className":129,"code":988,"language":131,"meta":132,"style":132},"\"\"\"Correlated measurement sampling from the full statevector.\n\nIMPORTANT (spec §16.2): for entangled qubits, sampling each qubit independently\nfrom its marginal destroys the correlations. Always sample bitstrings from the\nfull statevector's probability distribution.\n\"\"\"\n\ndef sample_correlated(sv: Statevector, num_shots: int, rng=None) -> list[str]:\n    probs = sv.probabilities()\n    probs = probs \u002F probs.sum()\n    n = sv.num_qubits\n    indices = rng.choice(len(probs), size=num_shots, p=probs)\n    return [format(int(i), f\"0{n}b\") for i in indices]\n",[33,990,991,998,1004,1011,1018,1025,1032,1038,1082,1100,1122,1135,1174,1226],{"__ignoreMap":132},[136,992,993,995],{"class":138,"line":139},[136,994,144],{"class":142,"aria-hidden":143},[136,996,997],{"class":691},"\"\"\"Correlated measurement sampling from the full statevector.\n",[136,999,1000,1002],{"class":138,"line":151},[136,1001,144],{"class":142,"aria-hidden":143},[136,1003,175],{},[136,1005,1006,1008],{"class":138,"line":170},[136,1007,144],{"class":142,"aria-hidden":143},[136,1009,1010],{"class":691},"IMPORTANT (spec §16.2): for entangled qubits, sampling each qubit independently\n",[136,1012,1013,1015],{"class":138,"line":178},[136,1014,144],{"class":142,"aria-hidden":143},[136,1016,1017],{"class":691},"from its marginal destroys the correlations. Always sample bitstrings from the\n",[136,1019,1020,1022],{"class":138,"line":210},[136,1021,144],{"class":142,"aria-hidden":143},[136,1023,1024],{"class":691},"full statevector's probability distribution.\n",[136,1026,1027,1029],{"class":138,"line":228},[136,1028,144],{"class":142,"aria-hidden":143},[136,1030,1031],{"class":691},"\"\"\"\n",[136,1033,1034,1036],{"class":138,"line":248},[136,1035,144],{"class":142,"aria-hidden":143},[136,1037,175],{},[136,1039,1040,1042,1044,1047,1049,1052,1055,1058,1060,1063,1065,1068,1070,1073,1076,1079],{"class":138,"line":256},[136,1041,144],{"class":142,"aria-hidden":143},[136,1043,661],{"class":156},[136,1045,1046],{"class":191}," sample_correlated",[136,1048,195],{"class":160},[136,1050,1051],{"class":669},"sv",[136,1053,1054],{"class":160},": Statevector, ",[136,1056,1057],{"class":669},"num_shots",[136,1059,673],{"class":160},[136,1061,1062],{"class":187},"int",[136,1064,201],{"class":160},[136,1066,1067],{"class":669},"rng",[136,1069,188],{"class":160},[136,1071,1072],{"class":198},"None",[136,1074,1075],{"class":160},") -> list[",[136,1077,1078],{"class":187},"str",[136,1080,1081],{"class":160},"]:\n",[136,1083,1084,1086,1089,1091,1094,1097],{"class":138,"data-cue":39,"line":287},[136,1085,39],{"class":181},[136,1087,1088],{"class":160},"    probs ",[136,1090,188],{"class":187},[136,1092,1093],{"class":160}," sv.",[136,1095,1096],{"class":191},"probabilities",[136,1098,1099],{"class":160},"()\n",[136,1101,1103,1105,1107,1109,1112,1114,1117,1120],{"class":138,"line":1102},10,[136,1104,144],{"class":142,"aria-hidden":143},[136,1106,1088],{"class":160},[136,1108,188],{"class":187},[136,1110,1111],{"class":160}," probs ",[136,1113,711],{"class":187},[136,1115,1116],{"class":160}," probs.",[136,1118,1119],{"class":191},"sum",[136,1121,1099],{"class":160},[136,1123,1125,1127,1130,1132],{"class":138,"line":1124},11,[136,1126,144],{"class":142,"aria-hidden":143},[136,1128,1129],{"class":160},"    n ",[136,1131,188],{"class":187},[136,1133,1134],{"class":160}," sv.num_qubits\n",[136,1136,1138,1140,1143,1145,1148,1151,1153,1156,1159,1162,1164,1167,1169,1171],{"class":138,"data-cue":209,"line":1137},12,[136,1139,209],{"class":181},[136,1141,1142],{"class":160},"    indices ",[136,1144,188],{"class":187},[136,1146,1147],{"class":160}," rng.",[136,1149,1150],{"class":191},"choice",[136,1152,195],{"class":160},[136,1154,1155],{"class":187},"len",[136,1157,1158],{"class":160},"(probs), ",[136,1160,1161],{"class":275},"size",[136,1163,188],{"class":187},[136,1165,1166],{"class":160},"num_shots, ",[136,1168,12],{"class":275},[136,1170,188],{"class":187},[136,1172,1173],{"class":160},"probs)\n",[136,1175,1177,1179,1181,1184,1187,1189,1191,1194,1197,1200,1203,1206,1209,1212,1214,1217,1220,1223],{"class":138,"line":1176},13,[136,1178,144],{"class":142,"aria-hidden":143},[136,1180,699],{"class":156},[136,1182,1183],{"class":160}," [",[136,1185,1186],{"class":187},"format",[136,1188,195],{"class":160},[136,1190,1062],{"class":187},[136,1192,1193],{"class":160},"(i), ",[136,1195,1196],{"class":156},"f",[136,1198,1199],{"class":691},"\"0",[136,1201,1202],{"class":198},"{",[136,1204,1205],{"class":160},"n",[136,1207,1208],{"class":198},"}",[136,1210,1211],{"class":691},"b\"",[136,1213,717],{"class":160},[136,1215,1216],{"class":156},"for",[136,1218,1219],{"class":160}," i ",[136,1221,1222],{"class":156},"in",[136,1224,1225],{"class":160}," indices]\n",[309,1227,1228,1235],{"class":311},[313,1229,1230,1232],{"data-cue":39},[136,1231,39],{"class":181},[136,1233,1234],{"class":319},"One probability per outcome of the whole register. Four qubits means sixteen numbers here, not four.",[313,1236,1237,1239],{"data-cue":209},[136,1238,209],{"class":181},[136,1240,1241],{"class":319},"Each shot draws one outcome from that joint distribution. Whatever correlations the circuit built survive the draw.",[12,1243,1244,1245,1247],{},"Four qubits each sitting at fifty-fifty is not four coins. It is one distribution over sixteen outcomes, and only if the qubits are unentangled do those two descriptions agree. Add one ",[33,1246,600],{}," and they part company: the per-qubit odds can look completely unchanged while the joint distribution has become something else entirely.",[12,1249,1250],{},"A marginal is the distribution for one qubit once you ignore the others. Sample each qubit from its own marginal and you get four independent coins every time, which is a valid distribution and the wrong one. The sequencer's README is blunt about what that costs musically: the entanglement presets become meaningless noise, where sampling the joint distribution keeps two entangled qubits firing together.",[12,1252,1253,1254,1258],{},"So superposition is a property of the register, not a property you can inspect qubit by qubit and reassemble. ",[956,1255,1257],{"href":1256},"\u002Flearn\u002Fquantum-entanglement","Understanding Quantum Entanglement"," is the article about what the difference buys you.",[16,1260,1262],{"id":1261},"twenty-four-gates-sixteen-million-splits","Twenty-four gates, sixteen million splits",[12,1264,1265],{},"Twenty-four Hadamards is the two-qubit circuit above, carried twenty-two doublings further.",[12,1267,1268],{},"Dr. Siti Fariya's Quantum Courier races classical and quantum solvers across logistics problems. Its repository carries a separate MaxCut benchmark, which is the piece that maps onto a circuit most directly.",[12,1270,1271],{},"MaxCut splits the nodes of a graph into two groups so that as many edges as possible run between the groups rather than inside them. The benchmark uses twenty-four nodes with three edges each, thirty-six edges in total. Splitting twenty-four nodes two ways gives 16,777,216 possible splits, which is the same number the ladder above arrived at, for the same reason.",[12,1273,1274,1275,1278,1279,1282,1283,711,1285,1287,1288,711,1291,1294],{},"A graph is not written in gates, so it gets rewritten twice before it becomes a circuit. First as a cost function: every edge contributes ",[33,1276,1277],{},"-x_u - x_v + 2·x_u·x_v",", which is at its lowest when the two endpoints land on opposite sides. Then the substitution ",[33,1280,1281],{},"x = (1 - z)\u002F2"," turns those ",[33,1284,35],{},[33,1286,39],{}," variables into ",[33,1289,1290],{},"-1",[33,1292,1293],{},"+1"," spins, which is exactly what measuring a qubit gives you.",[12,1296,1297,1298,1300,1301,201,1303,201,1305,1307],{},"Single-variable terms then become an ",[33,1299,574],{}," on one qubit. Each edge's paired term becomes the ",[33,1302,600],{},[33,1304,574],{},[33,1306,600],{}," sandwich. Every edge of the graph is literally a two-qubit gate in the circuit.",[121,1309,1312],{"name":1310,"run-href":1311,"tag":649},"quantum\u002Fmaxcut_qaoa.py","\u002Fu\u002FSitifar\u002Fquantum-game-pizza-race",[127,1313,1315],{"className":129,"code":1314,"language":131,"meta":132,"style":132},"def build_maxcut_qaoa(h: dict, J: dict, n: int, gamma: float, beta: float):\n    \"\"\"Build the standard depth-1 QAOA circuit for MaxCut.\"\"\"\n    from qiskit import QuantumCircuit\n    qc = QuantumCircuit(n, n)\n\n    # Initial state: uniform superposition\n    qc.h(range(n))\n\n    # Cost layer: exp(-i * gamma * H_cost)\n    for i, hi in h.items():\n        if abs(hi) > 1e-12:\n            qc.rz(2 * gamma * hi, i)\n    for (i, j), Jij in J.items():\n        if abs(Jij) > 1e-12:\n            qc.cx(i, j)\n            qc.rz(2 * gamma * Jij, j)\n            qc.cx(i, j)\n\n    # Mixer layer: exp(-i * beta * H_mixer)\n    for i in range(n):\n        qc.rx(2 * beta, i)\n\n    qc.measure(range(n), range(n))\n    return qc\n",[33,1316,1317,1373,1380,1393,1407,1413,1420,1437,1443,1450,1471,1492,1515,1533,1551,1563,1585,1596,1603,1611,1628,1647,1654,1674,1684],{"__ignoreMap":132},[136,1318,1319,1321,1323,1326,1328,1330,1332,1335,1337,1340,1342,1344,1346,1348,1350,1352,1354,1357,1359,1361,1363,1366,1368,1370],{"class":138,"line":139},[136,1320,144],{"class":142,"aria-hidden":143},[136,1322,661],{"class":156},[136,1324,1325],{"class":191}," build_maxcut_qaoa",[136,1327,195],{"class":160},[136,1329,218],{"class":669},[136,1331,673],{"class":160},[136,1333,1334],{"class":187},"dict",[136,1336,201],{"class":160},[136,1338,1339],{"class":669},"J",[136,1341,673],{"class":160},[136,1343,1334],{"class":187},[136,1345,201],{"class":160},[136,1347,1205],{"class":669},[136,1349,673],{"class":160},[136,1351,1062],{"class":187},[136,1353,201],{"class":160},[136,1355,1356],{"class":669},"gamma",[136,1358,673],{"class":160},[136,1360,676],{"class":187},[136,1362,201],{"class":160},[136,1364,1365],{"class":669},"beta",[136,1367,673],{"class":160},[136,1369,676],{"class":187},[136,1371,1372],{"class":160},"):\n",[136,1374,1375,1377],{"class":138,"line":151},[136,1376,144],{"class":142,"aria-hidden":143},[136,1378,1379],{"class":691},"    \"\"\"Build the standard depth-1 QAOA circuit for MaxCut.\"\"\"\n",[136,1381,1382,1384,1387,1389,1391],{"class":138,"line":170},[136,1383,144],{"class":142,"aria-hidden":143},[136,1385,1386],{"class":156},"    from",[136,1388,161],{"class":160},[136,1390,164],{"class":156},[136,1392,167],{"class":160},[136,1394,1395,1397,1400,1402,1404],{"class":138,"line":178},[136,1396,144],{"class":142,"aria-hidden":143},[136,1398,1399],{"class":160},"    qc ",[136,1401,188],{"class":187},[136,1403,192],{"class":191},[136,1405,1406],{"class":160},"(n, n)\n",[136,1408,1409,1411],{"class":138,"line":210},[136,1410,144],{"class":142,"aria-hidden":143},[136,1412,175],{},[136,1414,1415,1417],{"class":138,"line":228},[136,1416,144],{"class":142,"aria-hidden":143},[136,1418,1419],{"class":147},"    # Initial state: uniform superposition\n",[136,1421,1422,1424,1427,1429,1431,1434],{"class":138,"data-cue":39,"line":248},[136,1423,39],{"class":181},[136,1425,1426],{"class":160},"    qc.",[136,1428,218],{"class":191},[136,1430,195],{"class":160},[136,1432,1433],{"class":187},"range",[136,1435,1436],{"class":160},"(n))\n",[136,1438,1439,1441],{"class":138,"line":256},[136,1440,144],{"class":142,"aria-hidden":143},[136,1442,175],{},[136,1444,1445,1447],{"class":138,"line":287},[136,1446,144],{"class":142,"aria-hidden":143},[136,1448,1449],{"class":147},"    # Cost layer: exp(-i * gamma * H_cost)\n",[136,1451,1452,1454,1457,1460,1462,1465,1468],{"class":138,"line":1102},[136,1453,144],{"class":142,"aria-hidden":143},[136,1455,1456],{"class":156},"    for",[136,1458,1459],{"class":160}," i, hi ",[136,1461,1222],{"class":156},[136,1463,1464],{"class":160}," h.",[136,1466,1467],{"class":191},"items",[136,1469,1470],{"class":160},"():\n",[136,1472,1473,1475,1478,1481,1484,1487,1490],{"class":138,"line":1124},[136,1474,144],{"class":142,"aria-hidden":143},[136,1476,1477],{"class":156},"        if",[136,1479,1480],{"class":187}," abs",[136,1482,1483],{"class":160},"(hi) ",[136,1485,1486],{"class":187},">",[136,1488,1489],{"class":198}," 1e-12",[136,1491,684],{"class":160},[136,1493,1494,1496,1499,1501,1503,1505,1507,1510,1512],{"class":138,"line":1137},[136,1495,144],{"class":142,"aria-hidden":143},[136,1497,1498],{"class":160},"            qc.",[136,1500,574],{"class":191},[136,1502,195],{"class":160},[136,1504,209],{"class":198},[136,1506,881],{"class":187},[136,1508,1509],{"class":160}," gamma ",[136,1511,921],{"class":187},[136,1513,1514],{"class":160}," hi, i)\n",[136,1516,1517,1519,1521,1524,1526,1529,1531],{"class":138,"line":1176},[136,1518,144],{"class":142,"aria-hidden":143},[136,1520,1456],{"class":156},[136,1522,1523],{"class":160}," (i, j), Jij ",[136,1525,1222],{"class":156},[136,1527,1528],{"class":160}," J.",[136,1530,1467],{"class":191},[136,1532,1470],{"class":160},[136,1534,1536,1538,1540,1542,1545,1547,1549],{"class":138,"line":1535},14,[136,1537,144],{"class":142,"aria-hidden":143},[136,1539,1477],{"class":156},[136,1541,1480],{"class":187},[136,1543,1544],{"class":160},"(Jij) ",[136,1546,1486],{"class":187},[136,1548,1489],{"class":198},[136,1550,684],{"class":160},[136,1552,1554,1556,1558,1560],{"class":138,"line":1553},15,[136,1555,144],{"class":142,"aria-hidden":143},[136,1557,1498],{"class":160},[136,1559,600],{"class":191},[136,1561,1562],{"class":160},"(i, j)\n",[136,1564,1566,1568,1570,1572,1574,1576,1578,1580,1582],{"class":138,"data-cue":209,"line":1565},16,[136,1567,209],{"class":181},[136,1569,1498],{"class":160},[136,1571,574],{"class":191},[136,1573,195],{"class":160},[136,1575,209],{"class":198},[136,1577,881],{"class":187},[136,1579,1509],{"class":160},[136,1581,921],{"class":187},[136,1583,1584],{"class":160}," Jij, j)\n",[136,1586,1588,1590,1592,1594],{"class":138,"line":1587},17,[136,1589,144],{"class":142,"aria-hidden":143},[136,1591,1498],{"class":160},[136,1593,600],{"class":191},[136,1595,1562],{"class":160},[136,1597,1599,1601],{"class":138,"line":1598},18,[136,1600,144],{"class":142,"aria-hidden":143},[136,1602,175],{},[136,1604,1606,1608],{"class":138,"line":1605},19,[136,1607,144],{"class":142,"aria-hidden":143},[136,1609,1610],{"class":147},"    # Mixer layer: exp(-i * beta * H_mixer)\n",[136,1612,1614,1616,1618,1620,1622,1625],{"class":138,"line":1613},20,[136,1615,144],{"class":142,"aria-hidden":143},[136,1617,1456],{"class":156},[136,1619,1219],{"class":160},[136,1621,1222],{"class":156},[136,1623,1624],{"class":187}," range",[136,1626,1627],{"class":160},"(n):\n",[136,1629,1631,1633,1636,1638,1640,1642,1644],{"class":138,"data-cue":227,"line":1630},21,[136,1632,227],{"class":181},[136,1634,1635],{"class":160},"        qc.",[136,1637,591],{"class":191},[136,1639,195],{"class":160},[136,1641,209],{"class":198},[136,1643,881],{"class":187},[136,1645,1646],{"class":160}," beta, i)\n",[136,1648,1650,1652],{"class":138,"line":1649},22,[136,1651,144],{"class":142,"aria-hidden":143},[136,1653,175],{},[136,1655,1657,1659,1661,1663,1665,1667,1670,1672],{"class":138,"line":1656},23,[136,1658,144],{"class":142,"aria-hidden":143},[136,1660,1426],{"class":160},[136,1662,235],{"class":191},[136,1664,195],{"class":160},[136,1666,1433],{"class":187},[136,1668,1669],{"class":160},"(n), ",[136,1671,1433],{"class":187},[136,1673,1436],{"class":160},[136,1675,1677,1679,1681],{"class":138,"line":1676},24,[136,1678,144],{"class":142,"aria-hidden":143},[136,1680,699],{"class":156},[136,1682,1683],{"class":160}," qc\n",[309,1685,1686,1693,1700],{"class":311},[313,1687,1688,1690],{"data-cue":39},[136,1689,39],{"class":181},[136,1691,1692],{"class":319},"One Hadamard per node. With n=24 that is twenty-four gates, and the register now carries equal weight on all 16,777,216 possible splits.",[313,1694,1695,1697],{"data-cue":209},[136,1696,209],{"class":181},[136,1698,1699],{"class":319},"One interaction per edge. It shifts phase by an amount that depends on whether that edge ends up cut.",[313,1701,1702,1704],{"data-cue":227},[136,1703,227],{"class":181},[136,1705,1706],{"class":319},"The mixer moves weight between splits, so the circuit is not stuck with the distribution the cost layer handed it.",[12,1708,1709,116,1711,1713,1714,116,1717,1720,1721,116,1724,1727],{},[33,1710,1356],{},[33,1712,1365],{}," are two numbers, and the circuit above is only one evaluation of them. A classical optimiser sits outside it, rebuilding and rerunning the whole circuit at each step and adjusting the pair from what comes back. It starts at ",[33,1715,1716],{},"gamma = π\u002F8",[33,1718,1719],{},"beta = π\u002F4",", which the repo takes from the 2014 QAOA paper by Farhi, Goldstone and Gutmann. The ",[33,1722,1723],{},"0.393",[33,1725,1726],{},"0.785"," in Quantum Courier's Playground excerpt are those two constants rounded.",[12,1729,1730],{},"The committed benchmark ran five random graphs at 4,096 shots on a local simulator, and QAOA beat the classical baseline on all five, averaging about 43% more cut edges.",[12,1732,1733],{},"That baseline is a one-step local search where each node decides using only its immediate neighbours and never sees the whole graph. The repo picks it deliberately and cites Carlson et al. 2023 for the choice. At depth 1 the quantum circuit also reaches only one edge away from each node, so it argues that a solver with a global view would not be like-for-like.",[12,1735,1736],{},"Twenty-four gates bought weight on 16,777,216 outcomes. The 4,096 shots read back 0.024% of them.",[753,1738],{"builder":1739,"description":1740,"framework":757,"owner":1741,"thumb":1742,"title":1743,"to":1311},"Dr. Siti Fariya","Dr. Siti Fariya built a browser game that races classical and quantum solvers across five real logistics problems, and shows honestly which one wins, and why.","Sitifar","\u002F_content\u002Fimages\u002Fquantum-courier\u002Fscreenshot.webp","Quantum Courier",[16,1745,1747],{"id":1746},"why-the-rest-of-that-circuit-exists","Why the rest of that circuit exists",[12,1749,1750,1751,1754],{},"If a flat superposition were an answer, ",[33,1752,1753],{},"build_maxcut_qaoa"," would stop after its first line. It does not, and the reason is the 0.024%.",[12,1756,1757,1758,1761],{},"An even mix over sixteen million splits, sampled 4,096 times, gives you 4,096 arbitrary splits. That is a slow, expensive way to guess. Everything after ",[33,1759,1760],{},"qc.h(range(n))"," exists to move weight off the bad splits and onto the good ones, so that when you do take those 4,096 samples they land somewhere worth looking.",[12,1763,1764,1765,201,1767,201,1769,1771,1772,116,1774,1776],{},"The two layers split the work. One ",[33,1766,600],{},[33,1768,574],{},[33,1770,600],{}," sandwich per edge shifts phase by an amount that depends on whether that edge is cut. Splits that cut more edges end up with a different phase from splits that cut fewer. The mixer then converts those phase differences into differences in weight. Both layers are parameterised by ",[33,1773,1356],{},[33,1775,1365],{},", and tuning those two numbers is what the surrounding optimiser spends its time on.",[12,1778,1779,1780,1782],{},"Phase differences turning into weight differences is interference. Why the cancellation lands where it does is a subject of its own, and ",[956,1781,974],{"href":973}," is the article about that.",[12,1784,1785],{},"The benchmark result committed to Quantum Courier's repository was produced on a local simulator, over five random graphs, against a classical one-step search. There is an IonQ path in the script too. Which of those a figure came from is worth checking before repeating it.",[16,1787,1789],{"id":1788},"the-simulator-has-the-amplitudes-the-hardware-never-will","The simulator has the amplitudes, the hardware never will",[12,1791,1792],{},"The sequencer's interface shows you a Bloch sphere per qubit and the amplitudes of the full state, updating as you add gates. Alongside that, it plays audio driven by measurements. Those are two different code paths, and only one of them could ever run on a quantum computer.",[121,1794,1796],{"name":1795,"run-href":648,"tag":649},"backend\u002Fapp\u002Fquantum\u002Fstate.py",[127,1797,1799],{"className":129,"code":1798,"language":131,"meta":132,"style":132},"def state_at_step(spec: CircuitSpec, step: int) -> StepState:\n    qc = build_subcircuit(spec, up_to_step=step)\n    bloch = get_bloch_vectors(qc)\n    sv = Statevector.from_instruction(qc)\n    return StepState(step=step, bloch_vectors=bloch, statevector=_amplitudes(sv))\n",[33,1800,1801,1828,1850,1865,1882,1919],{"__ignoreMap":132},[136,1802,1803,1805,1807,1810,1812,1815,1818,1821,1823,1825],{"class":138,"line":139},[136,1804,144],{"class":142,"aria-hidden":143},[136,1806,661],{"class":156},[136,1808,1809],{"class":191}," state_at_step",[136,1811,195],{"class":160},[136,1813,1814],{"class":669},"spec",[136,1816,1817],{"class":160},": CircuitSpec, ",[136,1819,1820],{"class":669},"step",[136,1822,673],{"class":160},[136,1824,1062],{"class":187},[136,1826,1827],{"class":160},") -> StepState:\n",[136,1829,1830,1832,1834,1836,1839,1842,1845,1847],{"class":138,"line":151},[136,1831,144],{"class":142,"aria-hidden":143},[136,1833,1399],{"class":160},[136,1835,188],{"class":187},[136,1837,1838],{"class":191}," build_subcircuit",[136,1840,1841],{"class":160},"(spec, ",[136,1843,1844],{"class":275},"up_to_step",[136,1846,188],{"class":187},[136,1848,1849],{"class":160},"step)\n",[136,1851,1852,1854,1857,1859,1862],{"class":138,"line":170},[136,1853,144],{"class":142,"aria-hidden":143},[136,1855,1856],{"class":160},"    bloch ",[136,1858,188],{"class":187},[136,1860,1861],{"class":191}," get_bloch_vectors",[136,1863,1864],{"class":160},"(qc)\n",[136,1866,1867,1869,1872,1874,1877,1880],{"class":138,"data-cue":39,"line":178},[136,1868,39],{"class":181},[136,1870,1871],{"class":160},"    sv ",[136,1873,188],{"class":187},[136,1875,1876],{"class":160}," Statevector.",[136,1878,1879],{"class":191},"from_instruction",[136,1881,1864],{"class":160},[136,1883,1884,1886,1888,1891,1893,1895,1897,1900,1903,1905,1908,1911,1913,1916],{"class":138,"data-cue":209,"line":210},[136,1885,209],{"class":181},[136,1887,699],{"class":156},[136,1889,1890],{"class":191}," StepState",[136,1892,195],{"class":160},[136,1894,1820],{"class":275},[136,1896,188],{"class":187},[136,1898,1899],{"class":160},"step, ",[136,1901,1902],{"class":275},"bloch_vectors",[136,1904,188],{"class":187},[136,1906,1907],{"class":160},"bloch, ",[136,1909,1910],{"class":275},"statevector",[136,1912,188],{"class":187},[136,1914,1915],{"class":191},"_amplitudes",[136,1917,1918],{"class":160},"(sv))\n",[309,1920,1921,1928],{"class":311},[313,1922,1923,1925],{"data-cue":39},[136,1924,39],{"class":181},[136,1926,1927],{"class":319},"Computes the state directly. No shots, no sampling: the actual complex amplitude of every basis state.",[313,1929,1930,1932],{"data-cue":209},[136,1931,209],{"class":181},[136,1933,1934,1936],{"class":319},[33,1935,1915],{}," hands the browser a real and an imaginary part per outcome, which is what draws the spheres and the bars.",[12,1938,1939,1942],{},[33,1940,1941],{},"Statevector.from_instruction"," is a simulator doing linear algebra. It can tell you the weight and the phase on every one of the register's outcomes, which is precisely the information a measurement destroys. That is why the sequencer's visuals are exact and its audio is sampled.",[12,1944,1945,1946,1949],{},"Run the same circuit on hardware and ",[33,1947,1948],{},"state_at_step"," has no counterpart. There is no call that returns the state, because there is no way to look at a quantum state without ending it. You get a tally.",[12,1951,1952],{},"Keep a simulator in the loop while you are still learning a circuit. Once the register grows, it stops being an option.",[16,1954,1956],{"id":1955},"what-a-real-machine-does-to-a-superposition","What a real machine does to a superposition",[12,1958,1959],{},"There is a second number the sequencer reads off each qubit, and it is the one that connects all of this to hardware.",[121,1961,1963],{"name":1962,"run-href":648,"tag":649},"backend\u002Fapp\u002Fquantum\u002Fbloch.py",[127,1964,1966],{"className":129,"code":1965,"language":131,"meta":132,"style":132},"for q in range(n):\n    others = [i for i in range(n) if i != q]\n    rho = partial_trace(sv, others).data\n    r_x, r_y, r_z = _bloch_from_density(rho)\n\n    r = float(np.sqrt(r_x * r_x + r_y * r_y + r_z * r_z))\n",[33,1967,1968,1983,2017,2032,2047,2053,2099],{"__ignoreMap":132},[136,1969,1970,1972,1974,1977,1979,1981],{"class":138,"line":139},[136,1971,144],{"class":142,"aria-hidden":143},[136,1973,1216],{"class":156},[136,1975,1976],{"class":160}," q ",[136,1978,1222],{"class":156},[136,1980,1624],{"class":187},[136,1982,1627],{"class":160},[136,1984,1985,1987,1990,1992,1995,1997,1999,2001,2003,2006,2009,2011,2014],{"class":138,"line":151},[136,1986,144],{"class":142,"aria-hidden":143},[136,1988,1989],{"class":160},"    others ",[136,1991,188],{"class":187},[136,1993,1994],{"class":160}," [i ",[136,1996,1216],{"class":156},[136,1998,1219],{"class":160},[136,2000,1222],{"class":156},[136,2002,1624],{"class":187},[136,2004,2005],{"class":160},"(n) ",[136,2007,2008],{"class":156},"if",[136,2010,1219],{"class":160},[136,2012,2013],{"class":187},"!=",[136,2015,2016],{"class":160}," q]\n",[136,2018,2019,2021,2024,2026,2029],{"class":138,"data-cue":39,"line":170},[136,2020,39],{"class":181},[136,2022,2023],{"class":160},"    rho ",[136,2025,188],{"class":187},[136,2027,2028],{"class":191}," partial_trace",[136,2030,2031],{"class":160},"(sv, others).data\n",[136,2033,2034,2036,2039,2041,2044],{"class":138,"line":178},[136,2035,144],{"class":142,"aria-hidden":143},[136,2037,2038],{"class":160},"    r_x, r_y, r_z ",[136,2040,188],{"class":187},[136,2042,2043],{"class":191}," _bloch_from_density",[136,2045,2046],{"class":160},"(rho)\n",[136,2048,2049,2051],{"class":138,"line":210},[136,2050,144],{"class":142,"aria-hidden":143},[136,2052,175],{},[136,2054,2055,2057,2060,2062,2065,2068,2071,2074,2076,2079,2082,2085,2087,2089,2091,2094,2096],{"class":138,"data-cue":209,"line":228},[136,2056,209],{"class":181},[136,2058,2059],{"class":160},"    r ",[136,2061,188],{"class":187},[136,2063,2064],{"class":187}," float",[136,2066,2067],{"class":160},"(np.",[136,2069,2070],{"class":191},"sqrt",[136,2072,2073],{"class":160},"(r_x ",[136,2075,921],{"class":187},[136,2077,2078],{"class":160}," r_x ",[136,2080,2081],{"class":187},"+",[136,2083,2084],{"class":160}," r_y ",[136,2086,921],{"class":187},[136,2088,2084],{"class":160},[136,2090,2081],{"class":187},[136,2092,2093],{"class":160}," r_z ",[136,2095,921],{"class":187},[136,2097,2098],{"class":160}," r_z))\n",[309,2100,2101,2108],{"class":311},[313,2102,2103,2105],{"data-cue":39},[136,2104,39],{"class":181},[136,2106,2107],{"class":319},"Throws away every other qubit and keeps what is left of this one on its own.",[313,2109,2110,2112],{"data-cue":209},[136,2111,209],{"class":181},[136,2113,2114],{"class":319},"The length of that vector. r=1 means the qubit has a state of its own; r below 1 means the description is incomplete.",[12,2116,2117,2118,2121,2122,2125],{},"The sequencer maps ",[33,2119,2120],{},"r"," to timbre, and the README is explicit that this is a decision not to hide something. Entanglement makes an individual qubit's state mixed, and the instrument treats that as real physics to be heard rather than a value to normalise away. Its ",[33,2123,2124],{},"velocity"," mapping turns a shorter vector into a quieter note.",[12,2127,2128,2129,2131],{},"On real hardware ",[33,2130,2120],{}," shrinks for a second reason. Superpositions are not stable. It decays into the environment, every gate takes time, and a circuit deep enough to be interesting is a circuit spending that time. What arrives as your counts is a mix of the distribution you designed and one you did not.",[12,2133,2134],{},"Shivani Mayekar's QuantumCanvas handles that with one line:",[121,2136,2139],{"name":2137,"run-href":2138,"tag":125},"quantum_canvas.py","\u002Fu\u002FShivaniMayekar\u002Fquantum-canvas",[127,2140,2142],{"className":129,"code":2141,"language":131,"meta":132,"style":132},"counts = job.get_counts()\ncounts = {b: c for b, c in counts.items() if c > shots * low_prob}\n",[33,2143,2144,2160,2201],{"__ignoreMap":132},[136,2145,2146,2148,2151,2153,2156,2158],{"class":138,"line":139},[136,2147,144],{"class":142,"aria-hidden":143},[136,2149,2150],{"class":160},"counts ",[136,2152,188],{"class":187},[136,2154,2155],{"class":160}," job.",[136,2157,304],{"class":191},[136,2159,1099],{"class":160},[136,2161,2162,2164,2166,2168,2171,2173,2176,2178,2181,2183,2186,2188,2191,2193,2196,2198],{"class":138,"data-cue":39,"line":151},[136,2163,39],{"class":181},[136,2165,2150],{"class":160},[136,2167,188],{"class":187},[136,2169,2170],{"class":160}," {b: c ",[136,2172,1216],{"class":156},[136,2174,2175],{"class":160}," b, c ",[136,2177,1222],{"class":156},[136,2179,2180],{"class":160}," counts.",[136,2182,1467],{"class":191},[136,2184,2185],{"class":160},"() ",[136,2187,2008],{"class":156},[136,2189,2190],{"class":160}," c ",[136,2192,1486],{"class":187},[136,2194,2195],{"class":160}," shots ",[136,2197,921],{"class":187},[136,2199,2200],{"class":160}," low_prob}\n",[309,2202,2203],{"class":311},[313,2204,2205,2207],{"data-cue":39},[136,2206,39],{"class":181},[136,2208,2209],{"class":319},"Drops outcomes that turned up too rarely to be signal. With low_prob=0.05, anything under 5% of the shots goes.",[12,2211,2212,2213,116,2216,2219,2220,116,2223,2226],{},"For a Bell state, a pair of entangled qubits that should only ever produce ",[33,2214,2215],{},"00",[33,2217,2218],{},"11",", that filter removes the ",[33,2221,2222],{},"01",[33,2224,2225],{},"10"," counts that hardware puts there anyway. It is a blunt instrument and it works because you knew what the answer was supposed to look like. On a circuit whose answer you do not already know, the same filter would happily delete a real result.",[753,2228],{"builder":2229,"description":2230,"framework":757,"owner":2231,"thumb":2232,"title":2233,"to":2138},"Shivani Mayekar","Shivani Mayekar built a visual sandbox where you drag and drop quantum operations to compose new algorithms, then run them on real hardware.","ShivaniMayekar","\u002F_content\u002Fimages\u002Fquantum-canvas\u002Fscreenshot.webp","QuantumCanvas",[12,2235,2236,2240,2241,2245],{},[956,2237,2239],{"href":2238},"\u002Flearn\u002Fdocs\u002Fcompute-backends","Choosing where your code runs"," covers the backends available on Qollab. ",[956,2242,2244],{"href":2243},"\u002Flearn\u002Fdocs\u002Fwhy-your-results-look-wrong","Why your results look wrong"," covers what to check when a circuit ran cleanly and still gave you something unexpected.",[16,2247,2249],{"id":2248},"start-with-one-qubit","Start with one qubit",[12,2251,2252],{},"Superposition is a set of weights you compose before you measure. Four consequences of that keep mattering.",[12,2254,2255],{},"An even spread of weights is cheap to create and expensive to read, so the interesting work is never in setting that up. Part of the state never reaches your counts, which is why phase can decide an algorithm and show up nowhere in a tally. Weights belong to the whole register, so a superposition cannot be inspected one qubit at a time and reassembled. And on hardware they decay while the circuit runs, so depth costs you accuracy.",[12,2257,2258],{},"Fork the Superposition Sequencer first. It is the fastest way to see the first of those. You change an angle and hear the rhythm change, and the number you dialled and the pattern you hear are connected by three lines of Python and nothing else.",[2260,2261,2263],"make-it-yours",{"fork-href":648,"title":2262},"Change an angle, hear the difference.",[12,2264,2265,2266],{},"Fork the sequencer, load a preset, and move one rotation until you can predict what you will hear. Then open the MaxCut circuit above and find the single line that sets up sixteen million weights. ",[2267,2268,2269],"strong",{},"Everything here is open and yours to build on.",[2271,2272,2273],"style",{},"html pre.shiki code .sV9Aq, html code.shiki .sV9Aq{--shiki-default:#7F848E;--shiki-default-font-style:italic}html pre.shiki code .seHd6, html code.shiki .seHd6{--shiki-default:#C678DD}html pre.shiki code .sn6KH, html code.shiki .sn6KH{--shiki-default:#ABB2BF}html pre.shiki code .sjrmR, html code.shiki .sjrmR{--shiki-default:#56B6C2}html pre.shiki code .sVbv2, html code.shiki .sVbv2{--shiki-default:#61AFEF}html pre.shiki code .sVC51, html code.shiki .sVC51{--shiki-default:#D19A66}html pre.shiki code .s_ZVi, html code.shiki .s_ZVi{--shiki-default:#E06C75;--shiki-default-font-style:italic}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sb9H8, html code.shiki .sb9H8{--shiki-default:#D19A66;--shiki-default-font-style:italic}html pre.shiki code .subq3, html code.shiki .subq3{--shiki-default:#98C379}",{"title":132,"searchDepth":151,"depth":151,"links":2275},[2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288],{"id":18,"depth":151,"text":19},{"id":54,"depth":151,"text":55},{"id":82,"depth":151,"text":83},{"id":109,"depth":151,"text":110},{"id":526,"depth":151,"text":527},{"id":634,"depth":151,"text":635},{"id":769,"depth":151,"text":770},{"id":978,"depth":151,"text":979},{"id":1261,"depth":151,"text":1262},{"id":1746,"depth":151,"text":1747},{"id":1788,"depth":151,"text":1789},{"id":1955,"depth":151,"text":1956},{"id":2248,"depth":151,"text":2249},[2290,2291,2292],"Qollab","Learn","Quantum superposition",[2294],{"username":7,"name":2295,"role":2296,"avatar":2297,"bio":2298,"links":2299},"Nicolaas Spijker","Community manager, Qollab","\u002F_content\u002Fimages\u002Fbuilders\u002Fnicolaas-spijker.webp","Nico runs the builder community at Qollab. These concept articles come out of that work: forking the projects people publish and running them. And talking with authors to learn more about their projects.",[2300,2303],{"label":2301,"href":2302},"Qollab ↗","https:\u002F\u002Fqollab.xyz\u002Fu\u002Fnico",{"label":2304,"href":2305},"GitHub ↗","https:\u002F\u002Fgithub.com\u002Fnicolaasspijker",{"username":7,"name":2295,"role":2296,"avatar":2297},null,"Putting a register into sixteen million states costs twenty-four gates. Getting an answer out of it is the hard part, and that gap is what superposition actually is.","A superposition is a set of weights you compose before you measure, not a pile of answers computed at once. What that means for the code you write.",false,"md",{"href":648,"label":2313},"Fork the sequencer","article",{},true,"\u002F_content\u002Fimages\u002Fsuperposition\u002Fog.png","\u002Fblog\u002Flearn\u002Fquantum-superposition","2026-09-09","13 min read",[],{"title":2323,"description":2324},"Quantum Superposition, Explained with Code You Can Run","A superposition is a set of weights you compose, not a pile of answers computed at once. Twenty-four gates, sixteen million states, four thousand shots. With real projects to run and fork.","blog\u002Flearn\u002Fquantum-superposition",[2327,2328,2329],"superposition","education","quantum","A4n4Kux_ilhucyibV1ZfXUjV7EsVDVk7aLMJNgxa8CY",[],[],1788994898270]