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] 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 + 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?