ラベル polarization の投稿を表示しています。 すべての投稿を表示
ラベル polarization の投稿を表示しています。 すべての投稿を表示

2023年8月10日木曜日

A Thunkable app reproducing the polarized filters experiments

I created an app in Thunkable that faithfully reproduces the photon polarization experiment. Thunkable is a no-code programming system, similar to MIT App Inventor, but it incorporates a unique concept and is mainly an application development environment for advanced users.

●Purpose of the app
The main aim of the app is to familiarize students with the fundamentals of quantum computing through photon polarization. What I am doing here is an experiment in which linear polarizers are superimposed and images are viewed. When two polarizing sheets are stacked vertically (axis angle 0°) as in Fig.1(a), it is clearly visible, but when the front sheet is tilted 90° as in Fig.1(b), it is not visible at all. However, if another polarizing sheet is inserted between these two sheets at an angle of 45° as in Fig.1(c), it can be seen to some extent. Since the polarizing sheet is a filter, it is hard to imagine that it is better to see three polarizers than two. No matter how many times I try, it still surprises me. 
●App overview
The newly developed Thunkable app, as shown in Fig. 2, faithfully reproduces this mysterious phenomenon on a smartphone screen.
Also, please take a look at the video below, which shows the operation in the order of (a), (b), and (c) in Fig.2. The installation of the polarizing sheet is specified using a switch, and the angle of its axis can be changed by operating a slider.


●Mathematical model behind the app
This phenomenon can be explained by the quantum computing model shown in Fig.3. That is, it can be explained using an ordered orthonormal basis that corresponds to the orientation of the polarizer. The details are explained in the section “The Basis Associated with a Given Polarization Direction” in Reference [1].

●Important points when creating the app
When developing this app, it is necessary to find the probability p that a photon polarized at an arbitrary angle θ passes through a polarizing sheet with a tilt angle α. It can be calculated using the formula shown in Fig.4.
By reflecting this probability of passing proportionally to the transparency of the colored paint, we were able to reproduce a close-to-realistic appearance on the smartphone screen.

(Note) In this app, calculations are made assuming that the square polarizer is large enough. Therefore, when a small polarizing plate is used as shown below, the appearance of the edge portion may differ from the actual experimental results.
●Link to the app
(This app has been tested on Android, but not yet on iOS.)

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

2023年5月8日月曜日

"Quantum Computing for Everyone" 再訪2 - IBM Qによる測定

[要旨] 偏光板の重ね合わせによる不思議については、すでに、前報(こちら)で述べた数学モデルが、その全てを説明している。だが、それを量子コンピュータ実機(IBM Quantum)でも確認することにした。それによって、"量子の測定"への理解を深め、Qiskitによる量子プログラミングにも親しむことができる。

■複数の偏光板を重ねて物を見る
 その実験を図1に再掲する。2枚の偏光板の軸を共に0°で重ねた場合は良く見える(a)が、2枚目を90°に傾けると全く見えない(b)。しかし、それら2枚の間に、45°に傾けた偏光板を挿入するとだいぶ見えてくる(c)。それを解明する数学モデルに従って、各偏光板を通過する光子(photon)の個数を、量子コンピュータ実機で計測するのである。

■偏光板を通過する光子の個数の測定(IBM Quantum利用)
 蛍光灯などの環境下では毎秒膨大な数の光子が放出されるが、ここでは、見ている画像「年賀」から、2万個の光子が放出されていると仮定する。図1(c)のケースで、3枚目(一番手前)の偏光板を通過した光子の数は何個か?これを、IBM Quantum実機で計測した結果を図2に示した。
 偏光板を見ることが量子(本例では光子)の測定となる。その結果、偏光板を通過した光子は、その偏光板の軸と同じ方向に偏光している。その方向は、対応する正規直交基底の第一ベクトルと同一である。そして、測定結果の古典ビット0は通過した光子に、古典ビット1は吸収された光子に対応させる。測定結果を古典ビット0, 1の出現カウントで表したのが図2である。
 数学モデルによれば、図1(c)のケースでは、各偏光板を通過するごとに、その光子の個数は確率的にちょうど半減する。しかし、図3に示した量子コンピュータによる実測では、古典ビット0の方が、1よりも多く出現する傾向が見られる。利用したマシンibmq_manilaは、無料で使える少し以前のものである。エラー発生率が比較的高いように見える。ただし、最近、急速に進化した新機種が投入されているので、そのエラー率は低減していると思われる。だが、使用料はかなり高額なので、試していない。

 ここで、「実測」という言葉を使ったが、「シミュレーションではない」という意味である。シミュレーションでは、計算された確率に従って測定結果が決まるが、今回の量子コンピュータの利用においては、その確率は当方が計算したものではなく、量子現象そのものとして決まるという意味合いである。

 念の為、ほとんど何も見えない、図1(b)のケースもやってみた。図4に示す通り、1枚目を通過した光子の8.4%しか2枚目を通過しない(94.6%は吸収された)という結果となった。図5は、測定結果の0, 1出現頻度である。これでもやや多め(理論的には0%)だが、実験的な量子コンピュータによる結果として受け入れ、納得する。



■Qiskitプログラミング補足
 今回のQiskitを利用した量子プログラミングで気づいたことを忘備録として残す。
  • 2万光子を発生させるのだが、量子ビットは1ビットのみとした。それは|0>に初期設定されているので、それにアダマールゲートHを施した。宙ぶらりんの状態にするためだ。不特定方向の2万光子を発生させることは、量子測定を2万ショット行うことで代用する。
  • 偏光板による測定では、軸方向を任意に設定できるように、組み込みのゲートを使わずに、ユニタリ行列を与えてゲート機能として動作させた。
  • 1枚目は軸方向0°なので、それを通過する光子は確実に半数となり、その状態は全て|0>となる。ここから本実験は始まる。
  • 2枚目の偏光板(軸方向45°)へ入ってくる光子は垂直に偏光しており、3枚目の偏光板(軸方向90°)へ入ってくる光子は45°の向きに偏光していることに注意する。
  • 偏光板へ入ってくる光子の個数は、前段の偏光板を通過した光子の個数となるので、それがその偏光板による測定のショット回数となるように(人手で)設定した。すなわち、各偏光板毎に新たなjobとして順にマシンへ投入した。もっと良い方法があるかもしれない。
  • Qiskitコード例は、ChatGPTとの対話からも得られた。例えば、ユニタリ行列をゲートとして利用する具体例など。
■感 想
 数学モデルで解明されているなら、量子コンピュータを使う必要はないだろう、という声も聞こえてきそうだが、それは違う。実際に量子プログラミングを行い、実行結果を観察すれば、それまで気づかなかった重要な事項も発見でき、また、量子現象への理解は確実に深まる。

----------------------------------------
FoYo private note:
IBM Quantum lab /Orthogonal_Bases/UnitaryMatrix_ex3.ipynb