LoginSignup
4

More than 5 years have passed since last update.

【Python】時間発展する箱の中の粒子

Last updated at Posted at 2018-07-25

時間発展する箱の中の粒子を書きました

おもに参考にさせていただいた文献は

入門 量子ダイナミクス(上) 時間依存の量子力学を中心に
David J. Tannor (原著), 山下 晃一 (翻訳)
です。
Python3.6.3で書きました。

説明

時間に依存するSchrödinger方程式
8FA459E4-67D5-4596-B255-9D0F55CCFD6E.jpeg

を満たすψはこれらの線形結合
BC4C4B2D-0614-41F5-BECD-8C39C961AE5A.jpeg


8FA459E4-67D5-4596-B255-9D0F55CCFD6E.jpeg
を満たします。
というわけで、0≦x≦πの箱の中の粒子のn=1のときの解をφa、n=2のときの解をφbとして、これら2つの線形結合
14149350-A22F-4470-A3C3-B32C2529A168.jpeg

の確率存在密度
A94FB29A-F07B-4E77-B7D2-1E00F8FDADF8.jpeg

をグラフにしてみました。
今回はa=0.9,b=0.1としました。

コード

mixture.py
import matplotlib
matplotlib.use("Agg")
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

time,x = np.mgrid[-3.141592:3.141592:40j,0:3.1415:100j]
wavefunction1 = 1.414213 * np.sin(x) * np.exp(-1j * time)
wavefunction2 = 1.414213 * np.sin(2 * x) * np.exp(-4j * time)
wave_mixture = 0.9 * wavefunction1 + 0.1 * wavefunction2
probability_density_wave_mixture = np.conj(wave_mixture) * wave_mixture

#plot
fig = plt.figure()

imgs = []

for i in range(40):
    img = plt.plot(x[i],np.real(probability_density_wave_mixture[i]), linewidth =4, color="#2e0fc1")
    imgs.append(img)


ani = animation.ArtistAnimation(fig, imgs, interval=70)
ani.save("output3.gif", writer="imagemagick")

作業環境

Debian 4.9.82
Python3.6.3 Anaconda

またgifの保存にはImagemagickを入れる必要があります。

sudo apt-get install imagemagick

参考にさせていただいた本、サイト

入門 量子ダイナミクス(上) 時間依存の量子力学を中心に
David J. Tannor (原著), 山下 晃一 (翻訳)

matplotlib でアニメーションを作る

【python】水素様原子のpx軌道の存在確率密度plot

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4