Return to

Quantum computer emulator in python?

I thought about making a quantum computer emulator in python, would that be possible?


No? Based on my very limited knowledge, one of the purposes of quantum computing is for massive random number generation for encryption. True random numbers. And the only real reason we need quantum is the traditional computers are programmed and there firnot actually random.

So while you could make a thing that acts like a quantum computer it would never be able to actually do quantum computing.

Edit: and there is the whole, if we could just code them, then why are there billions being invented in building new quantum computers argument. Might be a fun project though as a learning tool for programming.

Though I know next to nothing about the actuality of them.

That would very much depend on what exactly it is you want do achieve. You can implement known working algorithms for quantum computers.

You might be able to fake the (observable) behaviour of a quantum computer. If that is good enough, go ahead knock yourself out.

Edit: I hid the following section, because it is misleading for what you seem to be interested in and would need a lot more context. Sorry about that.

not relevant

What you can’t do is “simulate” a quantum computer in the most strict sense of the word. Even countable infinite storage could not hold the information you need to hold. There are a few (very simple) analytical problems that are solvable but the vast majority of the problems you would be interested in can’t be solved analytically for an observable. This means a purely analytical and numerical solution is out the window.

Disclaimer: I attended (introductory) courses and lectures on quantum physics. The result is I now know, that I know very little.

1 Like

In theory yes you could, having studied quantum computers and the corresponding algorithms, should you? no.

Python is terrible for efficiency. In C++ with GPGPU computing, you could maybe simulate one qubit. But it won’t be useful for anything. It’s not a real qubit and you need thousands of qubits to be able to do anything.

Fact is, you can’t do anything with a simulated quantum system on a modern computer, and there is no point anyway since you can buy actual single qubit depth quantum computers for only a few hundred thousand and IBM along with others offer the ability to rent computation time on quantum systems with greater than 1 qubit depth.

1 Like

^ This right there! If Rex-Regum is interested in true (although very limited) quantum computing, there are commercial solutions out there.

The question is, does OP want an emulator or more of a demonstration tool. Anyways, I would strongly recommend OP to read more about quantum computing and quantum simulators first and/or find someone that has experience on the subject. @Rex-Regum , if you are interested I can compile a reading list.

I have on my free time sucked in so much info about quantum physics, so we can all say that we know so much of nothing we don’t know.

Python would be the right language because it is easy and simple and it could be a stepping stone for the future generation of coders.

What about having this on a bot net? We could use millions of devices doing 1 qubit or a half of it and we could have thousands. I mean, we have the computational power it is just how we should use it. The emulator would serve as a stepping stone for quantum coders who do not have the luxury of working with IBM, Google, NASA or D-Wave to get access to a quantum computer and test the unwinnable ai of pac man or something.

The purpose would be educational only.

But my second question how does Q# work, I haven’t read the page yet.


Meaning no offence but it seems like you have not understood how quantum entanglement works. You can’t spread computational workloads across individual nodes with quantum computing.
(In theory you can but for all practical purposes this idea does not work. Even in lab condition it is very hard to keep coherence in a q-bit system, spreading them apart is an incredible engineering feat on its own.)

I am still not sure what exactly you want to do. Like I mentioned above, a universal emulator is fundamentally not possible. If you want to “fake” the results you can do that, however it would be useful for demonstrative purposes only. It seems like I am wrong here when you limit yourself to certain problems.

The answer in this post illustrates another problem, if you purely base “simulation” on the underlying mathematics you run into memory limitations very fast.

1 Like

IBM offers free access to real quantum computers.

I gree that python is the wrong language for an emulator. If you just want to make the thing easy to use write it in C and create python bindings.


Microsoft has quantum computing simulator kit…

1 Like


That I read without noticing that I read about emulation.

But we are not those corporations, now the coders united need to do some wacktag lowpow emulator that will be the salt in the corporation eyes. If you can understand what I’m saying, if not do not even reply :slight_smile:

1 Like

You could play with the quantum stuff in minecraft?


Ye, that qcraft mod? I have been testing it but never got the concept of it.

The right language is the language capable of doing the task. Python on the most powerful consumer systems is not capable in the slightest. If you truly want to dive into developing quantum systems, look into Q#. It’s a language designed for working with quantum computers. It’s not designed for emulating quantum systems however.

Even if you managed to simulate 1 Qubit each on 1,000 systems, how are you going to entangle them? How are they going to directly effect each other while being relatively enormous distance away relying on consumer based networking. Not even a direct fibre line between two systems is going to be enough.

If you are asking questions like these, it seems like you really don’t have a grasp on the basics of quantum computing. This isn’t something you can just pick up in a month. I spent 6 months last year studying quantum systems and how to work with them. I have years of experience developing consumer software. And I know I don’t have the knowledge to be able to develop software for a quantum system, let alone develop an emulator.

If you are really serious about quantum systems, Pick up some books first and study them. Here are the books I started with.

Also there are plenty of simulators developed already.


I would also suggest to look at other peoples work in that direction

Here is an interesting list of links (unfortunately not all work):

If you want to use python maybe you can write an API for libquantum or something similar.

1 Like

Yes. Yes you can. I believe there is a library out already to achieve just that by some scientists working to abstract quantum computing to the script level. I think you can play around with the basic quantum instruction set and port the code to the real thing. …where was it…

1 Like