Why bother with an approximate solution when you can get an exact solution?
The reason to have an 'approximate' simulation rather than an exact simulation (and result) is that it more closely resembles our understanding of and interaction with a real quantum computer.
In a real quantum computer, the state of the qubits before measurement is indeed the exact superposition, but retrieving information from this system will always be done through measurements, and those measurements cannot give the full system state - they will only give one bit of information per measurement. Repeated experiments + measurements then allows us to approximate the exact state we believe the system to be in.
Is an exact simulator available in Qiskit?
Qiskit can indeed handle exact simulations - there is the 'statevector_simulator' which will do this; you can retrieve it with aer.get_backend('statevector_simulator')
. Note that this does not allow for density matrix simulations, so the methods to simulate noise and error are severely limited. The statevector can then be retrieved from the results
object using the .get_statevector()
method. See also this webpage from IBM/qiskit.
How does an approximate simulator work?
The simulations do not collapse the superpositions before the actual measurements - if the superpositions were collapsed in an intermediary state of the circuit, there can be no simulations of all things that make a quantum computer 'quantum' - entanglement, interference etc.
For simplicity, if we assume the measurement to take place at the very end of the circuit, just before the measurement the entire state of the system is known (which would be a $2^{n} \times 2^{n}$ density matrix; however you can use various insights and tricks to reduce the memory usage. It will always be exponential though.)
A measurement is then a random draw from the distribution of possible measurement outcomes, weighted to their probabilities. For a statevector, this is of course the $|\alpha|$'s and $|\beta|$'s. For density matrices, it is a bit more intricate as you use projection matrices.