DIY: Physical Random Number Generators & Double Slit Experiment

One of the benefits of Quantum Computing is their ability to generate truly random numbers.

Since classical computers are deterministic machines, governed by algorithms, they are inherently predictable. Therefor any number generated by a classical computer, even if it seems complex is actually based on a set of conditions or algorithm, which therefor makes it a “pseudo random number”, rather than truly random.

To generate truly random numbers you need to rely on a physical processor or phenomena that are unpredictable, examples of this include radioactive decay, electronic noise or even atmospheric noise.

Since QC is essentially based on a physical process and the probabilistic nature of quantum mechanics, its qubits can exist in a superposition state, this means they can represent a combination of 0 and 1 simultaneously, this state/property can be harnessed by QRNG (Quantum random number generators) to produce truly random numbers.

As a fun project, I decided to build a small physical QRNG using an Arduino, laser diode, beam splitter and two photo resistors. The basic premise is that you pulse the laser, it sends a wave/particle (both!) through the beam splitter, 50% of the time it should hit one of the two photo resistors, providing you with a random string of “1”s or “0”s.

While a very simple, basic and small example, it is a fun experiment. Check out OpenQbit.com if you would like to build your own. To make this a little easier, I laser cut a template/outline for the beam splitter for holding each of the components.

Enjoy Randomness? Check out these blog, sites, references: http://www.reallyreallyrandom.com

Non Quantum RNG generator using zener noise: http://www.reallyreallyrandom.com/zener/breadboard/

Nice video explaining the seed variables used and middle squares: https://www.khanacademy.org/computing/computer-science/cryptography/crypt/v/random-vs-pseudorandom-number-generators

Generating Random Numbers with QisKit & IBM Quantum Hardware

Generating true random strings using classical computers is not as easy as you may think. Unlike deterministic processes that follow specific algorithms and patterns, achieving true randomness poses a challenge in the realm of classical computing. Classical computers operate based on predetermined instructions and logical operations, which inherently lack the inherent unpredictability required for true randomness.

In contrast, true randomness involves an element of unpredictability that goes beyond the deterministic nature of classical computing. Attempts to generate random strings on classical computers often involve algorithms that simulate randomness, but these are ultimately constrained by the deterministic nature of the underlying hardware and software. read more

DIY: Ion Trap Quantum Computer

An ion is a atom with one of the outer electrons removed (normally removed by pointing a laser beam at it) – forming positively charged ion.
Ion trapping is done in a vacuum chamber to isolate the ions from the external environment as much as possible. (And avoid other atoms in the air from bumping and

  • Atoms
    • Consist of 3 components, a proton and neutron (called the nucleus) in the center and electrons which orbit this nucleus
    • 117 different types
    • Are elements the same as atoms
    • Every element is unique and has an atomic number
      • That number tells you the number of protons in every atom of the element. The atomic number is also called the proton number.
      • read more

  • Quantum Algorithms – Complexity Classes Notes

    Traveling sales person problem

    Solve problems which are NP hard – and they can’t be solved in polynomial time.

    P versus NP problem: full polynomial versus nondeterministic polynomial problem

    A P problem is one that can be solved in “polynomial time,” which means that an algorithm exists for its solution such that the number of steps in the algorithm is bounded by a polynomial function of n, where n corresponds to the length of the input for the problem. Thus, P problems are said to be easy, or tractable. A problem is called NP if its solution can be guessed and verified in polynomial time, and nondeterministic means that no particular rule is followed to make the guess. read more

    Bookmark: Quantum Links

    IBM Quantum Challenge

    This was a fun 4 day program with the IBM Quantum Challenge. I probably spent +- 30 hours working through the 4 challenges, and during this time I recognized I really needed to learn more of the fundamental math aspects which Physics is built upon. In the end I completed all the work, the final challenge was a monster for someone with little theoretical knowledge in the field but after a few hints and tips from the team, I had a score which was acceptable.

    This was the final requirements:

    What circuit would make such a complicated unitary?

    Is there some symmetry, or is it random? We just updated Qiskit with the introduction of a quantum circuit library (https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/circuit/library). This library gives users access to a rich set of well-studied circuit families, instances of which can be used as benchmarks (quantum volume), as building blocks in building more complex circuits (adders), or as tools to explore quantum computational advantage over classical computation (instantaneous quantum polynomial complexity circuits).from qiskit import QuantumCircuit from may4_challenge.ex4 import check_circuit, submit_circuit

    Using only single qubit rotations and CNOT gates, find a quantum circuit that approximates that unitary  by a unitary  up to an error , such that  !

    Note that the norm we are using here is the spectral norm, .

    This can be seen as the largest scaling factor that the matrix  has on any initial (normalized) state . One can show that this norm corresponds to the largest singular value of , i.e., the square root of the largest eigenvalue of the matrix , where  denotes the conjugate transpose of .

    When you submit a circuit, we remove the global phase of the corresponding unitary  before comparing it with  using the spectral norm. For example, if you submit a circuit that generates , we remove the global phase  from  before computing the norm, and you will have a successful submission. As a result, you do not have to worry about matching the desired unitary, , up to a global phase.

    As the single-qubit gates have a much higher fidelity than the two-qubit gates, we will look at the number of CNOT-gates, , and the number of u3-gates, , to determine the cost of your decomposition as

    Try to optimize the cost of your decomposition.

    Note that you will need to ensure that your circuit is composed only of  and  gates. The exercise is considered correctly solved if your cost is smaller than 1600.

    import qiskit.extensions.quantum_initializer.isometry as isometry from qiskit.quantum_info.operators import Operator import qiskit.compiler.transpile as transpile from scipy.linalg import hadamard from math import pi qc = QuantumCircuit(4) #apply hadamard using u3 gates qc.u3(pi/2,0,pi,[0]) qc.u3(pi/2,0,pi,[1]) qc.u3(pi/2,0,pi,[2]) qc.u3(pi/2,0,pi,[3]) #k=HUH Y=np.diag(k*np.exp(-2j*pi/3)) qc.diagonal(list(Y),[0,1,2,3]) qc.u3(pi/2,0,pi,[0]) qc.u3(pi/2,0,pi,[1]) qc.u3(pi/2,0,pi,[2]) qc.u3(pi/2,0,pi,[3]) qc3=transpile(qc, basis_gates=['u3', 'cx'],optimization_level=3) check_circuit(qc3) Circuit stats: ||U-V||_2 = 2.5785120546697708e-15 (U is the reference unitary, V is yours, and the global phase has been removed from both of them). Cost is 51 Great! Your circuit meets all the constrains. Your score is 51. The lower, the better! Feel free to submit your answer and remember you can re-submit a new circuit at any time! qc3.draw(output='mpl') read more