Let's say I have a qubit
$$\left| \psi \right> = (\alpha_1 + i\alpha_2 ) \left|0\right> + (\beta_1 + i\beta_2 )\left|1\right>$$

so when we measure it will calculate $|\alpha_1 + i\alpha_2|^2$ and $|\beta_1 + i\beta_2|^2$ ,and it will give the state with highest probability.

enter preformatted text here

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

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

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()

Now the code to run on Quantum computer is

enter preformatted text here
#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
result = job.result()

when we run this on Quantum computer we will get a graph with probabilities on it are those probabilities calculated using $|\alpha_1 + i\alpha_2|^2$ and $|\beta_1 + i\beta_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?


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.