3 ms·
I never got really far explaining myself what a quantum computer is. From what I understand, this is what we can do with a quantum bit: class Qbit {
by TekMol 9y ago
I never got really far explaining myself what a quantum computer is. From what I understand, this is what we can do with a quantum bit:
class Qbit
{
var $p;
function randomize($p)
{
$this->p=$p;
}
function observe()
{
if ( $this->p > random() ) $this->p=1;
else $this->p=0;
return $this->p;
}
}
The interesting things probably get possible when you have multiple qbits. Not just a normal array of qbits, but qbits that have some kind of interaction (entanglement?).
Would it be possible to simulate 'multiqbits' in a piece of code similarly small as the one above?
- ikeboy 9y agohttps://www.scottaaronson.com/democritus/lec10.html https://www.scottaaronson.com/democritus/lec10.html Here's a start.
- TekMol 9y agoThank you. But I don't think in formulas. I think in code.
- ianai 9y agoIgnore the equations and read the words. From a quick look, they have some customized notation but also heuristically valid descriptions.
- Thimothy 9y agohttps://www.smbc-comics.com/comic/the-talk-3 https://www.smbc-comics.com/comic/the-talk-3 I like this one better.
- ikeboy 9y agoYou can poke around https://quantumexperience.ng.bluemix.net/qx/experience https://quantumexperience.ng.bluemix.net/qx/experience and see if there's anything helpful
- deleted 9y ago[deleted]
- linkmotif 9y agoWhat’s the difference?
- sampo 9y agoTo store the state of one quantum bit, you need both the amplitude for state 0 and the amplitude for state 1. You need to store 2 numbers. For a memory of N qubits, you need to store the amplitude for each bit configuration, so 2^N numbers. This is totally doable, and people have written quantum computer simulation software.
- rollcat 9y agohttps://smbc-comics.com/comic/the-talk-3 https://smbc-comics.com/comic/the-talk-3
- throwaway080383 9y agoOn a mobile device so hard to write out proper code, but basically as I understand it, for an n-qubit system, you could imitate this with a class containing - A length 2^n array of complex numbers, such that the sum of the norms of those numbers is always 1. Each element represent a possible length n bit string. - An "observe" method, which returns a given length n bit string with probability equal to the norm of the corresponding complex number in the array. - Various "transform" methods. These are all linear unitary operators (matrices with special properties) on the array, but I think you can't pick and choose them arbitrarily; see https://en.m.wikipedia.org/wiki/Quantum_gate https://en.m.wikipedia.org/wiki/Quantum_gate All the usual bit operations are valid, but there are operations which don't have classical analogs, like this one in a 2-qbit system: "Maintain the probabilities of 00 or 11, but average the respective probabilities of 01 and 10". The fact that you're working with complex numbers and not just probabilities is mathematically how entanglement can play a role, but I don't have a good minimal example of how this is helpful.
- jcranmer 9y agoYou're missing several important things: * The amplitude of a qubit is effectively a complex probability instead of a real one. * Don't think of an n-qubit machine as having n instances of qubit. The representation you want is essentially: struct quantum_state { uint64_t bits; complex_t amplitude; }; struct quantum_register { int num_bits; size_t num_states; struct quantum_state *states; }; (quantum registers are usually emulated as sparse vectors for space efficiency). From a simulation perspective, quantum computers are just linear algebra operations, albeit over the complex field instead of the reals. The difficulty is that the equivalent vectors and matrices are of exponential size (2^n for an n-qubit computer), and the interesting operations don't exhibit regular patterns that permit aggressive optimization.
- TekMol 9y agoThe amplitude of a qubit is effectively a complex probability instead of a real one Does this have any implications as long as there is only one qbit?