2023年12月25日月曜日

Try Deutsch's and Grover's algorithms in my quantum circuit simulator

I wrote about the quantum circuit application (simulator) that I created using three mobile phones in previous articles. This time, I confirmed that Deutsch's and Grover's algorithms work correctly with this simulator. Note that in the diagram below, Alice's qubit (q0) and Bob's qubit (q1) are assigned to different mobile phones. The effects of each quantum gate are sent via CloudBD to a mobile phone for control.

Deutsch's algorithm

Many explanations regarding this have already been published, so I will omit the details. The Deutsch algorithm determines whether a function whose inputs are all 0 or 1 and whose function value also takes 0 or 1 is a constant function or a balanced function. Its feature is that by creating a special mechanism called Oracle, the judgment can be made with only one function evaluation.

Fig.1 and Fig.2 show that the Deutsch algorithm works correctly when the input is one variable using my quantum circuit simulator.

Grover's algorithm

Grover's algorithm searches for specific data in an unstructured data set. In the first stage of this algorithm, the data to be searched is first marked. In a quantum bit system, this means inverting the phase of the probability amplitude of the corresponding basis vector. This is achieved by creating a circuit called Oracle, just as in the case of Deutsch. Next, in the subsequent stage, a quantum circuit for amplifying the probability amplitude is assembled and executed. As a result, only the probability of the corresponding basis vector becomes 100%, so a search result can be obtained.

Figures 3 to 6 show that, using my quantum circuit simulator, the Grover algorithm works correctly in the case of classical 2-bit information (4 pieces of data) and obtains the desired results.

2023年12月19日火曜日

Superdense coding using my mobile quantum simulator

Japanese abstract
前のポストにおいて、2量子ビットシステムを3台のモバイルフォンで探究するためのアプリ(量子回路シミュレータ)を開発した。今回これを利用して、Superdense codingを実装してみた。Superdense codingは、少ない量子ビットを送ることでたくさんの古典ビット情報を送ることができるアルゴリズムである。このアルゴリズムは、量子重ね合わせと量子もつれを巧みに利用しており、これによって、私の開発したモバイルフォンアプリが正しく動作することを確認できた。

English abstract
In the previous post, I developed an app (quantum circuit simulator) to explore a two-qubit system using three mobile phones. This time I used this to implement Superdense coding. Superdense coding is an algorithm that can send many classical bits of information by sending fewer qubits. This algorithm makes clever use of quantum superposition and entanglement, and I was able to confirm that the mobile phone app I developed worked correctly. 

Superdense coding that sends classical 2-bit information with 1 qubit
Here, we will deal with Superdense coding, which allows you to send classical 2-bit information (any of 00, 01, 10, 11) by just sending one qubit. The details of the theory are carefully described in reference [1]. I implemented this algorithm with reference to that description. This will be explained specifically using Fig.1 and Fig.2.

Fig.1 shows the preparation phase. In the left column of Fig.1, Alice and Bob each have one qubit. Each is assigned to one mobile phone. The various quantum gates shown in the figure can be applied to freely change the qubit state. Here, (1) Alice applies Hadamard gate H to the initial state |0> to create a superposition state. On the other hand, (2) Bob applied the Pauli X gate to the initial state |1> and changed the state to |0>. These quantum states are transmitted to the control mobile phone on the right side via the real-time database CloudBD. Then, (3) tensor product is calculated to consider these two qubits as one system. Next, (4) Applying the CNOT gate creates a quantum entangled state. In other words, notice that the ”Entangled?” label has changed from false to true.

In Fig.2, (5)Alice applies  Pauli gate Y. As we will see later, applying this Y gate actually means selecting the classical 2-bit information "11". It then sends this qubit to Bob. On the other hand, at this point,  (6) Bob does not take any new action. The control mobile device on the right side of the figure (7)updates the tensor product to reflect Alice's application of the Y gate, but the entangled state is maintained. At this point, Bob will have a total of two qubits: the qubit sent by Alice and the qubit he originally had. Next, Bob has the control mobile device (8)apply the reverse Bell circuit. As a result, the quantum entanglement disappears ("Entangled?" false), and the probability of the basis vector |11> becomes 100%. In other words, if Bob makes a measurement here, he will get the classical bit information "11".

The most important point here is that Bob has no idea what Alice sent him before taking the measurements. Nevertheless, no matter which classical 2-bit information Alice sends, Bob can always simply apply the reverse Bell circuit. That way, Bob can get the information that Alice sent! This is the great thing about Superdense coding.

When sending classical bit information other than "11", it is shown in Fig.3. If Alice would like to send "00", she applies the I gate (no action). If she sends "01" she applies the X gate, and if she sends "10" she applies the Z gate. In any of these cases, as mentioned above, Bob only needs to perform the measurement after applying the reverse Bell circuit.

References
[1] Chris Bernhardt: Quantum Computing for Everyone, The MIT Press, 2020.
https://www.chrisbernhardt.info/

2023年12月15日金曜日

Quantum entanglement experiment using multiple mobile phones

Japanese abstract
今回は、量子コンピューティングで最も神秘的な原理である「量子もつれ」を、自作モバイルアプリで探究する。その特徴は、1量子ビットを1台のモバイルフォンに割り当て、2つの量子間のもつれ関係を、(リアルタイム性を持つ)クラウドデータベースを経由して作り出すことである。遠く離れた2台のモバイルフォン間でこれを実験することにより、遠隔量子間のもつれ現象を模倣し、理解を深めることができる。これこそが、このアプリを開発した理由なのである。このような高度な機能の実現を容易にしてくれるMIT App Inventorに改めて感謝したい!

English abstract
I would like to explore the most mysterious principle in quantum computing, "quantum entanglement", using a mobile app I created. Its major feature is that one qubit (quantum bit) is assigned to one mobile phone, and the entanglement relationship between two qubits is created via a cloud database (with real-time capabilities). By experimenting with this between two mobile phones far apart, it is possible to mimic and better understand the phenomenon of entanglement between remote quanta. That is the reason why I developed this app. Thanks again to MIT App Inventor for making it easy to achieve such advanced functionality!

Manipulate a single qubit
In a previous post, I described a mobile application for a single qubit. Even when limited to a single qubit, it is possible to create any quantum state using various quantum gates. Using this app, we were able to learn the basics of quantum superposition and measurement. However, to handle the most mysterious and important principle of quantum entanglement, we need at least two qubits. So, what method should we use to handle more than two qubits in mobile apps? This will be explained below.

Explore quantum entanglement by assigning one qubit to one mobile phone
The new app targets a two-qubit system, with one qubit assigned to one mobile phone. Perhaps this method will reduce the complexity of the app. To mimic quantum entanglement, we need to consider multiple qubits as a system, rather than looking at each one individually. To do this, I decided to use another mobile phone to calculate the tensor product of all qubits. The measurement result of one quantum bit in an entangled state automatically and instantly changes the state of the other quantum bit. The real-time Cloud DB included in MIT App Inventor was useful in achieving this.

Experimental example of quantum entanglement

(1)IBM Quantum Composer
Let's take the most basic quantum entanglement as an example. Fig.1 shows the case using IBM Quantum Composer. Prepare two qubits q0 and q1. First, apply the Hadamard gate H to q0 to create a superposition state, and leave q1 in its initial state (|0⟩). At this stage, q0 has no relationship with q1.
Next, if we apply a CNOT(0,1) gate to two qubits (control bit is q0, target bit is q1), both become entangled. Then, for example, when q0 is measured, the states of q0 and q1 will be either 00 or 11. In other words, the measurement result of q0 is immediately reflected in q1. This is quantum entanglement.

The mathematical model for this example problem is explained in detail in reference [1].

(2) Mimic quantum entanglement with three mobile phones
What was done with IBM Quantum was achieved with three mobile phones. As shown in Fig. 2(a), quantum bits qubit_0 and qubit_1 are each assigned to one mobile phone, and the third mobile phone performs control. Hadamard Gate H has already been applied to qubit_0. Once the quantum states (probability amplitudes) of qubit_0 and qubit_1 are stored in CloudDB, the third mobile phone calculates the tensor product to treat the two qubits as one system. As a result, four disks (corresponding to the four basis vectors) are displayed, and the probabilities and phases are shown. Fig.2(b) shows the actual screens of the three mobile phones on which this was performed.
The third mobile phone then applies the CNOT(0,1) gate to these two qubits. This creates a quantum entangled state as shown in Fig. 3(a). Fig.3(b) shows the actual screens of the three mobile phones at this time.
Once entangled in this way, the two mobile phones set up their Cloud DBs so that they can sense when the other has taken a measurement. As shown in Fig. 4(a), when it senses the other party's measurement, it immediately changes its own state based on the already stored quantum entanglement information. Fig.4(b) is the actual screen at that time.
(Note) This example is an entanglement in which two qubits are in the Bell state. In entanglement cases other than the Bell state, the measurement result of one does not necessarily definitively determine the other state. It depends on the nature of Entanglement at that time. Quantum entanglement generally refers to a correlation, but its strength varies.

Summary
By developing an application that mimics quantum entanglement, I have gained a deeper understanding of the meaning of the tensor product of multiple qubits and the phenomenon of quantum entanglement. This time, I used CNOT(0,1), but you can also use CNOT(1,0) with the control bit and target bit reversed. Additionally, other gates can be combined to create quantum entanglement.

References
[1] Chris Bernhardt: Quantum Computing for Everyone, The MIT Press, 2020.

2023年12月5日火曜日

Final version of my single-qubit apps

I recently completed the final versions of two apps for single-qubit manipulation!

These apps were developed in a short period of time using MIT App Inventor. Although many existing blocks could be used effectively, some ingenuity was required to represent the qubit states on the Bloch sphere. The problem was to project 3D coordinate data (x, y, z) onto a 2-dimensional plane, and I was able to solve this problem by using the isometric projection method.

(1) Displaying the results of successive application of quantum gates
Five types of quantum gates (Z, X, Y, H, T) can be used. The figure below (b) shows the result of successively applying H, T, and H to the quantum bit |0>. The final qubit state is shown as a big red dot on the Bloch sphere on the left. Small disks are also shown to the right. The area of the filled disk indicates the probability of each basis (|0>, |1>). A straight line coming out from the center of the circle indicates the phase. At the bottom of the Bloch sphere, some numerical values indicating quantum states are also shown.

(2) Conversion to make the phase of α 0 in qubit α|0>+β|1>
In order to represent a quantum bit on a Bloch sphere, the phase of α needs to be 0, and the phase of β needs to be the relative phase (φ) to it. The app shown below achieves this functionality. This is also a transformation that makes the imaginary part of the complex number α 0. Figure (b) below confirms that this conversion function is working correctly.

2023年12月2日土曜日

Dynamic representation of qubit for arbitrary θ and Φ

The static Bloch sphere model image is good, but it would be even better if we could dynamically represent the quantum bit state for arbitrary θ and Φ values !

I made this possible with a smartphone app! 

Generally speaking, it is somewhat difficult to create a 3D representation using MIT App Inventor, but it was relatively easy to map points on a Bloch sphere with a radius of 1 onto a 2D plane using Isometric projection.
Also check out the short video in action below.


2023年12月1日金曜日

Developing the most basic app to understand Qubit state (3)

Sometimes we need to go back to basics!
In the third article in this series, I'll compare my app's results with that of IBM Quantum Composer to confirm that it's working correctly. In my app I can use quantum gates Z, X, Y, T, H.  The T is a quantum gate that adds the phase of e^iφ to the qubit |1>. By default, φ=π/4. Also, H is a Hadamard gate. Here, as an example, H, T, and H are successively applied in this order to the quantum bit initial state |0>.

Fig.1 shows (a) the execution results of my app and (b) the execution results of IBM Quantum. In (a), the probability (area of the colored disk) and phase (the angle of the straight line coming out from the center of the circle) are shown for |0> and |1>. On the other hand, in (b), the results are displayed only for |1>. Although the way the disks are displayed is slightly different, it can be seen that the probabilities and phases of both are the same. However, the values of probability amplitude (amplitude in (a) and Output state in (b)) seem to be different. This will be explained in Fig.2.
Fig.2 explains that although the expressions of the probability amplitudes of the two are different, they are the same quantum state. In my app, the phase with respect to |0> is zero, and the phase of |1> is the relative phase to it. This does not seem to be the case with IBM Quantum. In fact, when I input IBM's probability amplitude numbers into my app's function state2relphase, the results I got matched my app's representation of probability amplitudes. This result confirms that my app is working perfectly correctly, at least for this example.