Quantum Mechanics is a elementary concept in physics that explains phenomena at a microscopic scale (like atoms and subatomic particles). This “new” (1900) subject differs from Classical Physics, which describes nature at a macroscopic scale (like our bodies and machines) and doesn’t apply on the quantum stage.
Quantum Computing is the exploitation of properties of Quantum Mechanics to carry out computations and remedy issues {that a} classical laptop can’t and by no means will.
Regular computer systems communicate the binary code language: they assign a sample of binary digits (1s and 0s) to every character and instruction, and retailer and course of that data in bits. Even your Python code is translated into binary digits when it runs in your laptop computer. For instance:
The phrase “Hi” → “h”: 01001000 and “i”: 01101001 → 01001000 01101001
On the opposite finish, quantum computer systems course of data with qubits (quantum bits), which may be each 0 and 1 on the similar time. That makes quantum machines dramatically sooner than regular ones for particular issues (i.e. probabilistic computation).
Quantum Computer systems
Quantum computer systems use atoms and electrons, as an alternative of classical silicon-based chips. Consequently, they will leverage Quantum Mechanics to carry out calculations a lot sooner than regular machines. For example, 8-bits is sufficient for a classical laptop to signify any quantity between 0 and 255, however 8-qubits is sufficient for a quantum laptop to signify each quantity between 0 and 255 on the similar time. A couple of hundred qubits can be sufficient to signify extra numbers than there are atoms within the universe.
The mind of a quantum laptop is a tiny qubit chip manufactured from metals or sapphire.
Nonetheless, essentially the most iconic half is the massive cooling {hardware} manufactured from gold that appears like a chandelier hanging inside a metal cylinder: the dilution fridge. It cools the chip to a temperature colder than outer house as warmth destroys quantum states (mainly the colder it’s, the extra correct it will get).
That’s the main sort of structure, and it’s referred to as superconducting-qubits: synthetic atoms created from circuits utilizing superconductors (like aluminum) that exhibit zero electrical resistance at ultra-low temperatures. An alternate structure is ion-traps (charged atoms trapped in electromagnetic fields in extremely‑excessive vacuum), which is extra correct however slower than the previous.
There is no such thing as a actual public depend of what number of quantum computer systems are on the market, however estimates are round 200 worldwide. As of at this time, essentially the most superior ones are:
- IBM’s Condor, the most important qubit depend constructed to date (1000 qubits), even when that alone doesn’t equal helpful computation as error charges nonetheless matter.
- Google’s Willow (105 qubits), with good error charge however nonetheless removed from fault‑tolerant giant‑scale computing.
- IonQ’s Tempo (100 qubits), ion-traps quantum laptop with good capabilities however nonetheless slower than superconducting machines.
- Quantinuum’s Helios (98 qubits), makes use of ion-traps structure with a few of the highest accuracy reported at this time.
- Rigetti Computing’s Ankaa (80 qubits).
- Intel’s Tunnel Falls (12 qubits).
- Canada Xanadu’s Aurora (12 qubits), the primary photonic quantum laptop, utilizing gentle as an alternative of electrons to course of data.
- Microsoft’s Majorana, the primary laptop designed to scale to 1,000,000 qubits on a single chip (however it has 8 qubits for the time being).
- Chinese language SpinQ’s Mini, the primary moveable small-scale quantum laptop (2 qubits).
- NVIDIA’s QPU (Quantum Processing Unit), the primary GPU-accelerated quantum system.
In the meanwhile, it’s unimaginable for a standard particular person to personal a large-scale quantum laptop, however you may entry them by means of the cloud.
Setup
In Python, there are a number of libraries to work with quantum computer systems world wide:
- Qiskit by IBM is essentially the most full high-level ecosystem for operating quantum applications on IBM quantum computer systems, excellent for inexperienced persons.
- Cirq by Google, devoted to low-level management on their {hardware}, extra fitted to analysis.
- PennyLane by Xanadu makes a speciality of Quantum Machine Studying, it runs on their proprietary photonic computer systems however it will possibly hook up with different suppliers too.
- ProjectQ by ETH Zurich College, an open-source venture that’s attempting to develop into the primary general-purpose bundle for quantum computing.
For this tutorial, I shall use IBM’s Qiskit because it’s the business chief (pip set up qiskit).
Probably the most primary code we are able to write is to create a quantum circuit (setting for quantum computation) with just one qubit and initialize it as 0. With the intention to measure the state of the qubit, we’d like a statevector, which mainly tells you the present quantum actuality of your circuit.
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
q = QuantumCircuit(1,0) #circuit with 1 quantum bit and 0 basic bit
state = Statevector.from_instruction(q) #measure state
state.possibilities() #print prob%
It means: the likelihood that the qubit is 0 (first aspect) is 100%, whereas the likelihood that the qubit is 1 (second aspect) is 0%. You possibly can print it like this:
print(f"[q=0 {round(state.probabilities()[0]*100)}%,
q=1 {spherical(state.possibilities()[1]*100)}%]")
Let’s visualize the state:
from qiskit.visualization import plot_bloch_multivector
plot_bloch_multivector(state, figsize=(3,3))
As you may see from the 3D illustration of the quantum state, the qubit is 100% at 0. That was the quantum equal of “hiya world“, and now we are able to transfer on to the quantum equal of “1+1=2“.
Qubits
Qubits have two elementary properties of Quantum Mechanics: Superposition and Entanglement.
Superposition — classical bits may be both 1 or 0, however by no means each. Quite the opposite, a qubit may be each (technically it’s a linear mixture of an infinite variety of states between 1 and 0), and solely when measured, the superposition collapses to 1 or 0 and stays like that ceaselessly. It is because the act of observing a quantum particle forces it to tackle a classical binary state of both 1 or 0 (mainly the story of Schrödinger’s cat that everyone knows and love). Due to this fact, a qubit has a sure likelihood of collapsing to 1 or 0.
q = QuantumCircuit(1,0)
q.h(0) #add Superposition
state = Statevector.from_instruction(q)
print(f"[q=0 {round(state.probabilities()[0]*100)}%,
q=1 {spherical(state.possibilities()[1]*100)}%]")
plot_bloch_multivector(state, figsize=(3,3))
With the superposition, we launched “randomness”, so the vector state is between 0 and 1. As a substitute of a vector illustration, we are able to use a q-sphere the place the scale of the factors is proportional to the likelihood of the corresponding time period within the state.
from qiskit.visualization import plot_state_qsphere
plot_state_qsphere(state, figsize=(4,4))
The qubit is each 0 and 1, with 50% of likelihood respectively. However what occurs if we measure it? Generally it is going to be a hard and fast 1, and typically a hard and fast 0.
outcome, collapsed = state.measure() #Superposition disappears
print("measured:", outcome)
plot_state_qsphere(collapsed, figsize=(4,4)) #plot collapsed state
Entanglement — classical bits are impartial of each other, whereas qubits may be entangled with one another. When that occurs, qubits are ceaselessly correlated, regardless of the space (usually used as a mathematical metaphor for love).
q = QuantumCircuit(2,0) #circuit with 2 quantum bits and 0 basic bit
q.h([0]) #add Superposition on the first qubit
state = Statevector.from_circuit(q)
plot_bloch_multivector(state, figsize=(3,3))
We now have the primary qubit in Superposition between 0-1, the second at 0, and now I’m going to Entangle them. Consequently, if the primary particle is measured and collapses to 1 or 0, the second particle will change as effectively (not essentially to the identical outcome, one may be 0 whereas the opposite is 1).
q.cx(control_qubit=0, target_qubit=1) #Entanglement
state = Statevector.from_circuit(q)
outcome, collapsed = state.measure([0]) #measure the first qubit
plot_bloch_multivector(collapsed, figsize=(3,3))
As you may see, the primary qubit that was on Superposition was measured and collapsed to 1. On the similar time, the second quibit is Entangled with the primary one, subsequently has modified as effectively.
Conclusion
This text has been a tutorial to introduce Quantum Computing fundamentals with Python and Qiskit. We realized how one can work with qubits and their 2 elementary properties: Superposition and Entanglement. Within the subsequent tutorial, we’ll use qubits to construct quantum fashions.
Full code for this text: GitHub
I hope you loved it! Be happy to contact me for questions and suggestions or simply to share your attention-grabbing tasks.
👉 Let’s Join 👈

(All pictures are by the creator except in any other case famous)



