TransWikia.com

Can I see Probability in complex form after measuring the state of the qubit on quantum computer?

Quantum Computing Asked on June 20, 2021

Let’s say I have a qubit
$$left| psi right> = (alpha_1 + ialpha_2 ) left|0right> + (beta_1 + ibeta_2 )left|1right>$$

so when we measure it will calculate $|alpha_1 + ialpha_2|^2$ and $|beta_1 + ibeta_2|^2$ ,and it will give the state with highest probability.

enter preformatted text here

vector = [159+625j,3+71j]  

print(vector)
norm = np.linalg.norm(vector)
print(norm)
qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit
initial_state = vector/np.linalg.norm(vector)
print('initial state is')
print(initial_state)
qc.initialize(initial_state, 0) 
qc.x(0) ###### for not gate
qc.h(0) ####### for hadamard gate
a = qc.draw() 
print(a)

simulator = Aer.get_backend('statevector_simulator') 
qobj = assemble(qc)     # Create a Qobj from the circuit for the simulator to run
result = simulator.run(qobj).result() # Do the simulation and return the result
out_state = result.get_statevector()
print(out_state)

Now the code to run on Quantum computer is

enter preformatted text here
IBMQ.load_account()
#provider = IBMQ.get_provider = ('ibm-q')
provider = IBMQ.load_account()
qcomp= provider.get_backend('ibmq_qasm_simulator')
job = execute(qc,backend=qcomp)
from qiskit.tools.monitor import  job_monitor
job_monitor(job)
result = job.result()
plot_histogram(result.get_counts(qc))

when we run this on Quantum computer we will get a graph with probabilities on it are those probabilities calculated using $|alpha_1 + ialpha_2|^2$ and $|beta_1 + ibeta_2|^2$ these formulas?
is it possible to extract in the form of a complex number like $a+ib$ not just like 0.865 or something like that, can I see what are my $alpha$‘s and $beta$ ‘s after measuring?

One Answer

You can use state vector simulator on IBM Q to get amplitudes but this is simulation.

In practise, you have to use quantum tomography to get the state vector. In short, the tomography allows you to look at a quantum state from different angles which actually means to measure copies of the state in different basis. See more information here.

To do so for one qubit, the link provided by KAJ226 is the most useful way how to do so easily.

Answered by Martin Vesely on June 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP