
- Michael A. Nielsen, Isaac L. Chuang, "Quantum Computation and Quantum Information"
- Phillip Kaye, Raymond Laflamme, and Michele Mosca, "An Introduction to Quantum Computing"
I am a professor emeritus of CS at Kanagawa Institute of Technology, Japan. Originally my specialty was parallel and distributed systems. My current interests include machine learning, natural language processing, creating mobile apps with MIT App Inventor, and quantum computing. In the web version of this blog, clicking the icon on the right (a plastic sphere) will take you to the "List of Quantum Computing Articles". - Fujio Yamamoto (for e-mail, add "@ieee.org" after "yamamotof")

前報では、量子もつれの不思議さを感じられるMermin-Peres Magic Gameについて述べた。今回は、量子特有の別の性質、量子重ね合わせ(superposition)を巧みに利用した「偽コイン発見」Counterfeit Coin Puzzleについて簡単に書いてみたい。
🔴偽コイン(Counterfeit Coin)発見パズル
n個のコインのうちに、k個の偽物が混じっているとする。偽物は、いずれも正常なものよりも一定量だけ軽い。どれが偽物かを特定したい。ここでは(左右の皿に同数のコインを入れて均衡を測るため)天秤を使う。では、何回、天秤で測定すれば偽物を特定できるか。それを解くための計算量に関する研究はすでに発表されている。
具体例で検討する。今、8個のコインのうち1個が偽物(n = 8、k = 1)について考える。この場合、2回だけ天秤で測れば偽物を特定できることが分かっている。
🔴量子天秤では1回の測定で偽物を特定できるという事実
量子計算ではなぜそれができるのかについては、IBM Qiskitの解説[1]や書籍[2]などに詳しく掲載されている。本稿では、whyではなく、howについてだけ示す。つまり、「こうすればできる」というメモとして叙述する。
(1)「量子天秤」Quantum Beam Balanceを作る
例えば、11111001のような、1が偶数個のバイナリストリングを考える。これは、コインq7q6q5q4q3q2q1q0に対応するが、q1とq2を除く6個のコインを皿に載せた状態を意味する。左右どちらの皿に載せるかは問題ではない。下図は、そのようなすべてのバイナリストリングの重ね合わせ状態(superposition)を作る仕掛けである。その作成が成功した場合は、最下段の量子ビットq8が0となり、失敗の場合は1となる。その成功の確率は0.5なので、成功するまで繰り返せば良い。
このsuperpositionの作成が成功した場合(q8の測定結果が0の場合)、図の右端に置かれたCNOT(制御付きNOT)が働いて、偽コインのインデックス(この場合は3)が設定される。念のためだが、これによって予め答えを教えている訳ではなく、偽物のコインを一つ入れたに過ぎない。この時点で、必要な量子天秤を構成したということになる。
(2)量子天秤で偽コインを特定する
引き続き、下図の量子回路を適用すると、偽コインを特定できる。回路の説明は略すが、注目すべきは、この回路を1回通すだけで、すなわち、量子天秤で1回だけ測定するだけで結果が出ることである!
参考資料
[1] Quantum Counterfeit Coin Problem,
https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/games/quantum_counterfeit_coin_problem.ipynb
[2] Vladimir Silva, Quantum Computing by Practice (Chapter 8), APress, 2024.
---------------------------------
private memo:
Anaconda -
/IBM_Qiskit_Local_Sim_OK/Completed_qiskit1x/Counterfeit_coin_IBM_2.ipynb
---------------------------------
So far, I have created many quantum apps and several quantum circuit simulators. Recently, I have revised these. Enjoy the videos showing how they work!
So far, I have created many quantum apps and several quantum circuit simulators. Recently, I have completed the mobile quantum circuit simulator V2 for n-Qubit! I would like to provide an overview of it again. Please refer to here and here for details.
The app URL has changed, please contact me if you need it.
🔴Check out the introductory video for this simulator here!
🔴 Features of the n-Qubit mobile quantum circuit simulator
🔴 Ten built-in quantum circuit examples
The ten examples above show what kind of quantum circuits can be simulated, so please use them as a reference when configuring your own quantum circuits.
これまでに多数の量子アプリと、幾つかの量子回路シミュレータを自作してきたが、このほど、n-Qubit用モバイル量子回路シミュレータV2が完成した!改めて、その概要を示したい。詳細はこちら(英文)とこちら(英文)を参照願いたい。
The app URL has changed, please contact me if you need it.
🔴Check out the introductory video for this simulator here!
🔴 n-Qubitモバイル量子回路シミュレータの特徴
🔴 組み込まれている10件の量子回路例題
具体的にどのような量子回路のシミュレーションが可能なのかを、上記に述べた10件の例題で示すので、ご自分の量子回路を構成する際の参考にしていただきたい。
Abstract: I have developed several quantum circuit simulator apps that run on mobile phones. Although my apps are not as good as well-known simulators such as Qiskit and Quirk, they are suitable for taking your mobile phone out of your pocket and learning the basics of quantum computing anytime, anywhere. No Internet connection is required. Until now, my simulators were for up to 3 qubits, but this time, I have made major design changes to enable it to handle any n qubits. (However, due to resource constraints on mobile phones, in reality, I am mainly assuming use of about 6 qubits.) These make it possible to run a large number of examples that are published in general quantum computing textbooks. These apps are currently unreleased, but I will provide them (.apk files for Android) immediately to anyone who is willing to try. Please contact me. (You can find my email address in the header of my blog.)
The app URL has changed, please contact me if you need it.
(▶️Please see the revised version V2 information here)
🔴Check out the introductory video for this simulator here!
🔴Two types of mobile phone apps developed
The following two quantum circuit simulators were developed.
(1) Simulator for n-qubit (app name: nQsim_9)
A new circuit description format similar to IBM's QASM was introduced. I also considered a GUI method in which qubits and quantum gates are set with buttons, but due to the limitations of mobile phone screen size and operability, I ultimately decided on a method in which quantum circuits are described in text. Fortunately, the description of quantum gates is very simple, and the number of qubits required for general learning is not very large, so I thought that there would be no major problems with this method. Rather, this method of creating a quantum circuit diagram by hand and writing (typing) quantum gates while looking at it would be more likely to deepen understanding.
(2) Simulator for one quantum bit (app name: sQ_b2)
This is an app specialized for one quantum bit, and the quantum state when various quantum gates are applied is graphically displayed on a disk-like image. The quantum bit state is also displayed on the Bloch sphere, which is useful for deepening understanding.
See Fig.1 for an overview of this app. The user describes the quantum circuit in text format. For concrete examples, please refer to the built-in examples.
(2) Example: Bit-Flip Error Correction
This example is an application of quantum teleportation and is considered important, so the details are shown in Fig. 2. First, click ① to import the example circuit. In this example, 5-qubit is used, and a bit-flip error occurs in quantum bit q2. When the Go button is clicked in ②, a measurement result reflecting the error, that is, (q4q3=10) is obtained. Based on this result, in ③, a new quantum gate for error correction is provided. Next, when Go After Meas. button is clicked in ④, a new quantum state shown in ⑤ is obtained. Here, the error has certainly been corrected !
In this example, the following point is worth noting: namely, since the bottom two qubits (q3 and q4) are not entangled with the top three, measurements on the bottom two qubits make them collapsed, but will leave the top three unchanged.
[Note] When you use the "Go after meas" button, do not long-click the "clear" button. Doing so will cause the current quantum state to be completely lost. To clear the circuit description area, simply click the "clear" button.
(3) Other quantum circuit examples
Five examples other than the error correction above are shown in Fig. 3 to Fig. 5 for your reference. In the Fig.3, Grover's algorithm is demonstrated. The left hand side figure (a) shows flipping the phase of the target basis |01⟩ via the oracle. Then, amplitude amplification (b) is applied, and finally we can see the answer |01⟩.
In Fig.4(a), the GHZ circuit is illustrated which gives strong entanglement. A demonstration of applying QFT (Quantum Fourier Transform) is given in Fig.4(b).Toffoli gate is applied in Fig.5(a) and SWAP gate is applied in Fig.5(b) to perform a modulo calculation.[Notice 1] In the current version, error checking is not performed on the circuit description. If any strange results are obtained, please refer to the circuit description in the above example and review it. Also, the function to import handwritten circuit diagrams displayed to the right of the circuit is not supported.
[Notice 2] By using MIT App Inventor again, I was able to achieve significant efficiency in app development. The 1-qubit version of the simulator was developed using only App Inventor. The overall control and graphical parts of the n-qubit version were also developed using App Inventor, but most of the quantum state calculations (such as unitary matrix operations with complex coefficients) were created in Javascript (about 350 lines). The WebViewer function of App Inventor allowed us to call up the Javascript program smoothly.
This is a graphical representation of operations on a single qubit using a disk and a Bloch sphere. In Fig. 6, a quantum state is set on the Bloch sphere using two sliders (θ and φ). In Fig. 7, the quantum state is changed using various quantum gates. Small disks on the right side of the Bloch sphere show the change in state before and after the application of the quantum gate. No detailed explanation might be necessary. Please try it out for yourself !
まだまだ猛暑続きだが、8月に入ってしまった。ここで、改めて量子コンピューティングの学びについて述べたい。そのきっかけは、米国のある有名高校(多分、日本の超難関高校に相当)の先生からいただいたメールである。それは、彼がある別の米国人からの紹介で、私の量子コンピューティングの学びに関するこのブログを知ったことによる。彼は次のように述べているのだが、大いに共感できる。
彼は、この高校の数理系の教員だが、量子物理学で博士号を持つという素晴らしい人物である。物理学関係の研究所での勤務経験もある。この高校での来年度に向けて、「革新的テクノロジー」というパイロットクラスを編成し、高校低学年で、最初にAIと機械学習を教え、次に量子情報を教える予定とのこと。量子に関することをできるだけ早く教え始めることは可能であり、必要であると考えているようである。一般の大人は、ずっと古典物理学的な観点の世界で生きてきたので、量子の世界に入ることにはかなり抵抗があるが、若い生徒はそうではなく、量子の概念や論理に素直に入ることができると感じると述べている。
彼は、教育におけるゲームに関する教師向けのSEPTプログラムに参加し、同僚と一緒に量子コンピューティングを教えるためのカードゲームを作成している。さらに関連アプリも作成したいとのこと。その際に私(山本)の作成したアプリを利用したり、参考にしたいとのことであった。一方、私の量子関係アプリは、振り返ってみると、造りがかなり複雑になったり、冗長であるところも多い。もっと、シンプルで扱いやすい構造にして、生徒にも親しめるアプリに改造したいと考えているところである。
これまでに作ってきたブロッホ球模型と、量子関係アプリのいくつかの画面を、改めて以下に掲載する。これを眺めならが、どのように改善すべきかを考える。厳しい暑さが過ぎた頃には目処をつけたいのだが、保証はできない... だが、この分野で著名なMITの教授から頂いた以下のコメントが大いに励みになっている。
"I greatly enjoyed reading your blog post article. Your handmade plastic Bloch sphere is very appealing, and I appreciate how you are making such a kind effort to reach a new and young audience who may someday be important to the field.", by Prof. Isaac Chuang (MIT)
![]() my Bloch sphere my quantum apps logo |
![]() |