Quantum State

Posted 元之田

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Quantum State相关的知识,希望对你有一定的参考价值。

Qubit State

Notation

We need a name for this state. Let’s be unimaginative and call it 0. Similarly, there exists a qubit state that is certain to output a 1. We’ll call this 1. These two states are completely mutually exclusive. Either the qubit definitely outputs a 0, or it definitely outputs a 1. There is no overlap. One way to represent this with mathematics is to use two orthogonal vectors.

∣ 0 ⟩ = [ 1 0 ] ∣ 1 ⟩ = [ 0 1 ] |0\\rangle=\\left[\\beginarrayl1 \\\\ 0\\endarray\\right] \\quad|1\\rangle=\\left[\\beginarrayl0 \\\\ 1\\endarray\\right] 0=[10]1=[01]

With vectors we can describe more complex states than just ∣ 0 ⟩ |0\\rangle 0 and ∣ 1 ⟩ . |1\\rangle . 1. For example, consider the vector
∣ q 0 ⟩ = [ 1 2 i 2 ] \\left|q_0\\right\\rangle=\\left[\\beginarrayc \\frac1\\sqrt2 \\\\ \\fraci\\sqrt2 \\endarray\\right] q0=[2 12 i]

Since the states ∣ 0 ⟩ |0\\rangle 0 and ∣ 1 ⟩ |1\\rangle 1 form an orthonormal basis, we can represent any 2 D 2 \\mathrmD 2D vector with a combination of these two states. This allows us to write the state of our qubit in the alternative form:
∣ q 0 ⟩ = 1 2 ∣ 0 ⟩ + i 2 ∣ 1 ⟩ \\left|q_0\\right\\rangle=\\frac1\\sqrt2|0\\rangle+\\fraci\\sqrt2|1\\rangle q0=2 10+2 i1

This vector, ∣ q 0 ⟩ \\left|q_0\\right\\rangle q0 is called the qubit’s statevector, it tells us everything we could possibly know about this qubit. For now, we are only able to draw a few simple conclusions about this particular example of a statevector: it is not entirely ∣ 0 ⟩ |0\\rangle 0 and not entirely ∣ 1 ⟩ |1\\rangle 1. Instead, it is described by a linear combination of the two. In quantum mechanics, we typically describe linear combinations such as this using the word ‘superposition’.

Exploring Qubits with Qiskit (How to initiate quantum states)

from qiskit import QuantumCircuit, assemble, Aer
from qiskit.visualization import plot_histogram, plot_bloch_vector
from math import sqrt, pi
qc = QuantumCircuit(1) # Create a quantum circuit with one qubit

In our quantum circuits, our qubits always start out in the state ∣ 0 ⟩ . |0\\rangle . 0. We can use the initialize() method o transform this into any state. We give initialize () the vector we want in the form of a list, and tell it which qubit(s) we want to initialize in this state:

qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit
initial_state = [0,1]   # Define initial_state as |1>
qc.initialize(initial_state, 0) # Apply initialisation operation to the 0th qubit
qc.draw()  # Let's view our circuit


We can then use one of Qiskit’s simulators to view the resulting state of our qubit. To begin with we will use the statevector simulator, but we will explain the different simulators and their uses later.

svsim = Aer.get_backend('statevector_simulator') # Tell Qiskit how to simulate our circuit
qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit
initial_state = [0,1]   # Define initial_state as |1>
qc.initialize(initial_state, 0) # Apply initialisation operation to the 0th qubit
qobj = assemble(qc)     # Create a Qobj from the circuit for the simulator to run
result = svsim.run(qobj).result() # Do the simulation and return the result
out_state = result.get_statevector()
print(out_state) # Display the output state vector

[ 0. + 0. j 1. + 0. j ] \\left[\\beginarrayll 0 .+0 . j & 1 .+0 . j] \\endarray\\right. [0.+0.j1.+0.j]

qc.measure_all()
qc.draw()

qobj = assemble(qc)
result = svsim.run(qobj).result()
counts = result.get_counts()
plot_histogram(counts)


We can see that we (unsurprisingly) have a 100 % 100 \\% 100% chance of measuring ∣ 1 ⟩ |1\\rangle 1. This time, let’s instead put our qubit into a superposition and see what happens. We will use the state ∣ q 0 ⟩ \\left|q_0\\right\\rangle q0 from earlier in this section:
∣ q 0 ⟩ = 1 2 ∣ 0 ⟩ + i 2 ∣ 1 ⟩ \\left|q_0\\right\\rangle=\\frac1\\sqrt2|0\\rangle+\\fraci\\sqrt2|1\\rangle q0=2 10+2 i1
By initial_state, we can create a new quantum state.

initial_state = [1/sqrt(2), 1j/sqrt(2)]  # Define state |q_0>
qc = QuantumCircuit(1) # Must redefine qc
qc.initialize(initial_state, 0) # Initialize the 0th qubit in the state `initial_state`
qobj = assemble(qc)
state = svsim.run(qobj).result().get_statevector() # Execute the circuit
print(state)       

[ 0.70710678 + 0. j 0. + 0.70710678 j ] \\left[\\beginarrayccc 0.70710678+0 . j & 0 . & +0.70710678 \\mathrmj] \\endarray\\right. [0.70710678+0.j0.+0.70710678j]

qobj = assemble(qc)
results = svsim.run(qobj).result().get_counts()
plot_histogram(results)

Measurement

Rule

There is a simple rule for measurement. To find the probability of measuring a state ∣ ψ ⟩ |\\psi\\rangle ψ in the state ∣ x ⟩ |x\\rangle x we do:
p ( ∣ x ⟩ ) = ∣ ⟨ x ∣ ψ ⟩ ∣ 2 p(|x\\rangle)=|\\langle x \\mid \\psi\\rangle|^2 p(x)=xψ2

If we look at the state ∣ q 0 ⟩ \\left|q_0\\right\\rangle q0 from before, we can see the probability of measuring ∣ 0 ⟩ |0\\rangle 0 is indeed 0.5 0.5 0.5 :
∣ q 0 ⟩ = 1 2 ∣ 0 ⟩ + i 2 ∣ 1 ⟩ ⟨ 0 ∣ q 0 ⟩ = 1 2 ⟨ 0 ∣ 0 ⟩ + i 2 ⟨ 0 ∣ 1 ⟩ = 1 2 ⋅ 1 + i 2 ⋅ 0 = 1 2 ∣ ⟨ 0 ∣ q 0 ⟩ ∣ 2 = 1 2 \\beginaligned \\left|q_0\\right\\rangle &=\\frac1\\sqrt2|0\\rangle+\\fraci\\sqrt2|1\\rangle \\\\ \\left\\langle 0 \\mid q_0\\right\\rangle &=\\frac1\\sqrt2\\langle 0 \\mid 0\\rangle+\\fraci\\sqrt2\\langle 0 \\mid 1\\rangle \\\\ &=\\frac1\\sqrt2 \\cdot 1+\\fraci\\sqrt2 \\cdot 0 \\\\ &=\\frac1\\sqrt2 \\\\ \\left|\\left\\langle 0 \\mid q_0\\right\\rangle\\right|^2 &=\\frac12 \\endaligned q00q00q02<

以上是关于Quantum State的主要内容,如果未能解决你的问题,请参考以下文章

Quantum Hierarchical State Machine (量子层级状态机)

Firefox 57 / Quantum:模拟打印样式

讲解ECE2231 Introduction to Quantum Mechanics

使用 Firefox Quantum 检查 Websocket 帧

Quantum Amplititude Amplification

『Firefox Quantum』中文命名征集活动