# Quantum Programming

--

A Quantum computer looks to harness all the power of quantum mechanics and by this delivering an unheard quantity of processing power that would outstrip even todays most powerful supercomputers.

What is a qubit?

Today’s normal computers work with bits, that are a stream of electrical or optical pulses representing “1s” or “0s”. So everything you do in your computer, send emails, use youtube are essentially a long string of binary digits.

In the Other hand, Quantum computers use qubits (or quantum bit) are the basic unit of quantum information. The qubit is the quantum version of the classical binary bit physically realized with a two-state device.

Quantum mechanics has two phenomenons that make them very powerful and capable of solving some of the hardest calculations. this are the principles of coherent superposition and quantum entanglement, even though this are concepts very hard to grasp and understand i will do my best to explain as short and fast as possible.

First we have the principle of superposition. We already said that traditional computers work with binary digits, “1” and “0”, in the quantum playground this is obsolete, now it just doesn't have to be one of these two options, it can be “0” and “1” at the same time, or be more “1” then “0”. basically is the probability that digits can be fluid, it doesn't have to be one or the other it can be both, and also variations of both.

Second we have the principle of Entanglement, that's even more mind-blowing. It's a counter-intuitive phenomena in quantum physics that can easily confuse anymore(starting be me). A pair or group of particles is entangled when the quantum state of each particle cannot be described independently of the quantum state of the other particles.

When two qubits are entangled there exists a special connection between them. The entanglement will become clear from the results of measurements. The outcome of the measurements on the individual qubits could be 0 or 1. However, the outcome of the measurement on one qubit will always be correlated to the measurement on the other qubit. This is always the case, even if the particles are separated from each other by a large distance.

Basically saying that it doesn't matter how big of a distance two qubits are separated one from another. they can apparently send information between each other instantly!!! how crazy is that?!

We can see the real power of quantum!!! The fact that qubits can be entangled, makes a quantum computer more powerful than a classical computer. With the information stored in superposition, some problems can be solved exponentially faster.

With ruby, and many other programming languages you can script and code quantum-ready simulations that are far more powerful than any simulations done at a convencional computing level.

Since creating an example of how a quantum computer would process a problem would probably be out of my hand for now i will copy/paste and example from the web (https://www.dwavesys.com/quantum-computing):

“In nature, physical systems tend to evolve toward their lowest energy state: objects slide down hills, hot things cool down, and so on. This behavior also applies to quantum systems. To imagine this, think of a traveler looking for the best solution by finding the lowest valley in the energy landscape that represents the problem.

Classical algorithms seek the lowest valley by placing the traveler at some point in the landscape and allowing that traveler to move based on local variations. While it is generally most efficient to move downhill and avoid climbing hills that are too high, such classical algorithms are prone to leading the traveler into nearby valleys that may not be the global minimum. Numerous trials are typically required, with many travelers beginning their journeys from different points.

In contrast, quantum annealing begins with the traveler simultaneously occupying many coordinates thanks to the quantum phenomenon of superposition. The probability of being at any given coordinate smoothly evolves as annealing progresses, with the probability increasing around the coordinates of deep valleys. Quantum tunneling allows the traveller to pass through hills — rather than be forced to climb them — reducing the chance of becoming trapped in valleys that are not the global minimum. Quantum entanglement further improves the outcome by allowing the traveler to discover correlations between the coordinates that lead to deep valleys.”

So, in another words quantum computers don’t process problems the same way traditional computers do. The second one if we are working to find the closest exit path of a labyrinth its going to check each of the paths and options one by one, taking a very long time to go through all the options.

In the other hand, quantum computers would be able to check many paths from many different starting points at the same time, and use all that data to find the best route very quickly.