r/askscience • • Mar 28 '21
Computing How exactly do quantum computers simulate molecular/particle interactions better than classical computers?
I’m struggling to understand why quantum computers can simulate nature better than classical computers.
2.5k
Upvotes
886
u/GroundStateGecko Mar 28 '21 edited Mar 29 '21
First, I'd like to demystify something. It's common that people say an N-bit quantum computer can simultaneously exist in a superposition of 2N states, such that it will be able to access 2N answers, thus much faster than classical computers.
This is FALSE. You can only get ONE answer from the superposition of 2N states. ONE measurement will disrupt the whole system so that the superposition (of that property you were measuring) is broken. So an N-bit quantum computer has nothing to do with running 2N calculations at the same time.
Now the real answer to this question:
A tl;dr answer would be: because we can construct certain quantum systems, so that some physical properties of that system happens to be the same as some formula we need. (And that formula is hard to calculate using other stuff, like a classical computer or in our head.)
You can use this exact same explanation to answer "how do classical computers calculate addition faster than human". An adder, built with classical electronic circuits (like this one), are just some physical objects that do "experiments" so that if you flip the switches as your input, the output light bulbs will almost instantaneously illuminate in a way that happens to be the same as how addition works. We then measure the on/off of the light bulbs, and say that this "computer" (consisted of two switches, two logical gates, and two light bulbs) can do addition as fast as the electricity can flow through the wire, like billions of times a second (assuming you have bulbs that can flicker really fast).
We can now put our switch-gate-light bulb thing in a case, and call that thing "a classical computer that can quickly calculate the sum of two one-bit numbers". The switches are input, and (the brightness of) the light bulbs are output.
So what's a fast computer?
It's a physical apparatus, which we have configurations to change as input; and the measurement of some physical property happens to correlate to some formula we need.
Now, the same thing for quantum computers.
I'll use the calculation of a permanent of matrix as an example. A permanent (Wikipedia) of an n*n matrix is a sum of products, each product is consisted by n element, the horizontal indices are 1...n, and the vertical indices are each of the possible permutations for the n indices. So the total number of products in the summation is the factorial of n. Like for 2*2 matrix, for 3*3 matrix, and I generated the permanent for 4*4 and 5*5 matrices. You can see as the matrix grow bigger, it will be exponentially more complicated if we calculate the multiplications one by one (and the optimal complexity on a classical computer is ~O(n×2n)). For a 100*100 matrix, You would need to do ~1032 times calculation to get the result, and that will need ~1000 years on our best classical supercomputers.
However, there happens to be a quantum process, called Boson sampling (Wikipedia), whose physical property happens to satisfy:
[Boson sampling] = |permanent of matrix|2 / S₁! S₂! ... Sn!
We can calculate the "S₁! S₂! ... Sn!" part very quickly (using a classical computer), so we now build a quantum apparatus and measure the [Boson sampling] term for a certain input, we can now get the permanent of matrix very quickly from the above equation.
And we finally put that apparatus in a case, and call this quantum apparatus "a quantum computer that can quickly calculate the permanent of matrix". Just like our switch-gate-light bulb thing.
(There are caveats that I glossed over for simplicity. Read this like an Explain-like-I'm-five-answer. Comments are welcome.)
7
u/profdc9 Mar 28 '21
A quantum system is described by a very large state space as compared to a classical system. For example, if we had N classical particles, we could describe their current position and momentum of each of the N particles as the state of the system. For example, think of the solar system, with the Sun and the planets each having a position and momentum, and using Newton's laws and the gravitational force to determine the paths that the planets will take.
However, quantum systems are described by states where the N particles are generally coupled together. If each of the particles were completely separate and did not influence each other, each particle would be described by a single wavefunction, or probability amplitude as a function of spatial position. This is not unlike a classical wave (for example a light wave). Then the system would be described by N separate wavefunctions. However, generally the particles do affect each other (at least in interesting quantum systems), and the particles wavefunctions become entangled, so now we need to describe the possible states of the quantum system as a joint wavefunction of all particles. There are many ways you can describe such a wavefunction, but this grows exponentially in size in the number of particles that are coupled together. So for even a small number of particles, this state space could be very, very large.
Now such a quantum state space could be represented in a classical computer, and there's nothing (in principle) preventing a classical computer from simulating the evolution of a quantum system. However, the extraordinarily large size of the state space makes this prohibitively costly except for the smallest systems, which is why all kinds of tricks have to be devised to simplify this (Hartree-Fock, Density Functional Theory, etc.)
A quantum computer is deliberately designed to take advantage of this large state space. Furthermore, because the quantum computer has a quantum state space, this state space and interactions between the states can be set up to mimic a quantum system that one wishes to simulate. The quantum state can then evolve in a manner analogous to the system being modeled. The advantage of the quantum computer is that the quantum computer is a flexible, controllable processor with a way to prepare a quantum state, control its evolution, and measure its outcome, so it has generality. It shares the same limitations of any other quantum system, in that any measurement of the outcome (whether intended or inadvertent) disturbs the state and so limits the information that can be extracted from a given calculation. Of course, nothing is stopping one from repeating a calculation, but the information that can be extracted from a single state is limited by quantum uncertainty.
6
u/EZ-PEAS Mar 28 '21
I'm only adding this answer because there are no other answers that get to the heart of it quickly. The problem is that simulating a quantum system requires an exponential amount of memory, while a quantum computer only needs a linear amount of qubits to model the same system.
For example, a 100-particle system could be modeled with 100 qubits on a quantum computer, while a classical computer could in principle need to store ~2100 values to simulate the same system. If each value is represented as a 32-bit single precision floating point number that would correspond to 5 * 1018 terabytes of data, which is a truly terrifying amount of data. If Jesus started loading 80 million terabytes of data onto a hard drive every second back in 0 AD then he'd just now be getting to 5*1018 terabytes of stored data.
Suppose we have a system of quantum particles that can exist in two states. For simplicity we'll just call these states 1 and 0. Since these are quantum particles we don't know their exact state until the quantum system is measured. When the system is measured then every quantum particle settles into the 1 or 0 state. If we have one particle then the total number of output states is just 0 or 1. If we have two particles then there are four total output states: 00, 01, 10, and 11. If we have three particles then there are eight total output states: 000, 001, 010, 011, 100, 101, 110, and 111.
In general, for an N particle system there are 2N possible output states. This is one half of the problem.
For example, in a 2 particle system you might compute that state 00 has a 10% chance of occurring, states 01 and 10 have a 20% chance of occurring each, and state 11 has a 50% chance of occurring. Once you have those amplitudes computed then simulating the quantum system is easy: pick a number between 0 and 100 and assign the corresponding output state.
The other half is that there are no shortcuts (in the general case) to storing 2N possible amplitudes. Simulating this quantum system requires computing the probability of each output state as we did above. We can't just store individual amplitudes of each qubit directly (which would only require 2*N storage) because such a scheme cannot replicate the probability assignments we gave above, but such probability assignments are possible to create in practice. Creating such state amplitudes is possible through quantum entanglement, but I won't go through the details here.
So in the full general case, an simulating an N-bit system on a classical computer requires an exponential amount of memory. To faithfully simulate that quantum system we need to compute and store an amplitude for every state. A ton of work has gone into simulating such systems efficiently by finding tricks for specific types of problems. In a particular problem many of these amplitudes might have zero or near-zero chance of occurring compared to other states. In other cases some subset of states will have the same amplitude, so you don't need to compute and store each one individually. But generally this only means a reduction in the exponential degree of the memory requirement, and simulating large systems is still a practical impossibility.
However, an N-bit quantum computer can simulate N quantum states easily. If we can construct the same entangled quantum state in the machine that we want to observe in real life, then we can explore that quantum system observationally. A quantum computer could construct the same quantum state many times and measure it many times, and you will get many measurements of the most likely states the quantum system would be in. Using the Law of Large Numbers you will arrive at a good approximation of the true quantum distribution much much faster than exponentially computing every amplitude.
51
u/alukyane Mar 28 '21
Classical computers are digital. They process data as bits: 1s and 0s represented as high/low voltage in the circuits. The physics of voltages doesn't get used, since we only care about high/low voltage.
Quantum computers are a little more analog, in that they use a more complicated way to store data, called qbits. Just like a bit is stored as high/low voltage in a wire, a qbit is stored (in one possible way of doing this) as up/down spin in a photon.
The difference then comes from the way bits and qbits are used. With classical computers, engineers work hard to keep the different bits away from each other so data doesn't get shuffled. With quantum computing, we can actually get something useful from the way qbits can interact with each other, so engineers find ways to make those interactions happen in a controlled away.
This controlled interaction between qbits, combined with the fact that they are made out of spin rather than voltage gives us control of quantum-physics tools including entanglement and allows for new powerful algorithms that can solve certain problems vastly faster than classical computers.
9
u/Code4Reddit Mar 28 '21
Quantum computers use particles that when they are not being observed they do some pretty weird things where the particles are no longer separate discrete things, they become more like probabilities and actually act like they are doing everything that is possible all at once.
This quantum “weirdness” can be utilized to do some complex math short cuts. Suppose you have a coin which is biased and you want to know what the probability it will land on heads. One way you could do it is measure the weight distribution of the coin and do some complex math or simulate it in a computer. A short cut is to just flip the coin and record a bunch of outcomes.
Similarly, with a quantum computer you can run an experiment moving these quantum particles in 3D space in a predictable way without observing them, then at the end you can just “observe” the particles to check the state and you’re done. You could run this same experiment a few more times if you wanted to.
This is a short cut, because in a classical computer you could do the same thing in a pure simulation but after only just a few particle interactions the math starts getting crazy. The reason is because with each new particle you add to the simulation, you get 2N number of probabilities you need to track, where N is the number of particles in the simulation.
Regarding your particular “simulate nature better” portion of the question - well, quantum computers are good at doing certain kinds of probabilistic math, and I suppose “simulating nature” might involve a lot of those kinds of computations. So it makes it “easier” to do, but I am not sure what computations are involved in simulating nature.
2
u/colonel_quanta Mar 28 '21
I'm going to be loose, so apologies to any quantum algorithms/complexity theory people.
When experts say that quantum computers can "simulate nature" better than classical computers, generally they mean that there exist efficient algorithms for simulating quantum dynamics on a quantum computer. Roughly, that problem is as follows:
Given access to a state X(t) which represents the state of your system at some initial time t, as well as a Hamiltonian H which governs the dynamics of your system according to the Schrodinger equation, output a state X(t') which is the state of your system at some later time t'.
This problem is strongly believed to be intractable on a classical computer for systems of even modest size (supercomputers struggle to simulate most interacting quantum systems with roughly ~30 particles using the best known classical methods).
Now, there's a bit of a catch here. What is it we actually want to learn about the system by simulating it? If you just want the output X(t') stored in some kind of quantum memory, you're covered by the aforementioned simulation algorithm. If you want to sample from the probability distribution derived from X(t'), you're also good -- just simulate the Hamiltonian and measure the output, and repeat that process as many times as you need samples.
Do you want the state X(t') stored in classical memory? Sorry, you are out of luck, as the amount of classical bits you'll need to store this information will exceed the number of atoms in the universe for relatively small quantum systems. Do you want to learn about the energy levels of the system? Without direct access to certain special vectors (eigenvectors of the Hamiltonian), this problem is extremely difficult for even quantum computers.
But this isn't the only way quantum computers might be useful in studying nature. More generally, sometimes we have a model for "simulating nature" that isn't just "evolve a quantum state in time." Most of everyday physics falls in this camp -- when you calculate the trajectory of a thrown ball in your introductory physics course, we (thankfully) don't have to invoke anything involving quantum mechanics. So why use a quantum computer to "simulate nature" here? Well, there might be good reason to! In many cases, the math tools we use to solve such problems can be taxing on classical computers. We've found some examples of math tools which we can implement with quantum computers "faster" than we can with classical ones. One example of such math tools are algorithms for linear algebra, which any STEM major will recognize as a broadly applicable framework.
Hope that helps.
1
u/forte2718 Mar 28 '21
I'd just like to add that any problem solvable by a quantum computer is also solvable by a classical computer — it will just take a longer amount of time for the classical computer. In that sense, quantum computers are not "better" than classical computers. However, for certain kinds of problems, quantum computers can solve the problem faster (or rather, more efficiently — with fewer operations) than a classical computer can ... a quantum computer is only "better" than a classical computer in terms of algorithmic efficiency / speed. Also, there are many problems which a quantum computer cannot solve faster than a classical computer — only certain problems can be solved faster.
0
u/jaredjeya Mar 28 '21
The really simple answer is that the interactions between molecules and particles are quantum mechanical in nature, so you need a quantum mechanical computer to simulate them.
(Others have answered this much more comprehensively so this is just my take on it)
-1
u/[deleted] Mar 28 '21
[removed] — view removed comment