File:QHO-catstate-even2-animation.gif
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
QHO-catstate-even2-animation.gif (300 × 200 pixels, file size: 234 KB, MIME type: image/gif, looped, 100 frames, 5.0 s)
File information
Structured data
Captions
Summary
[edit]DescriptionQHO-catstate-even2-animation.gif |
English: Animation of the probability distribution of the quantum wave function of a Schrödinger cat state of α=2 in a Quantum harmonic oscillator. The two coherent contributions interfere in the center which is characteristic for a cat-state. |
Date | |
Source |
Own work This plot was created with Matplotlib. |
Author | Geek3 |
Other versions | QHO-catstate-even2-animation-color.gif |
Source Code
[edit]The plot was generated with Matplotlib.
Python Matplotlib source code |
---|
#!/usr/bin/python
# -*- coding: utf8 -*-
from math import *
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
plt.rc('path', snap=False)
plt.rc('mathtext', default='regular')
# image settings
fname = 'QHO-catstate-even2-animation'
width, height = 300, 200
ml, mr, mt, mb = 35, 8, 22, 45
x0, x1 = -5, 5
y0, y1 = 0, 1.2
nframes = 100
fps = 20
# physics settings
alpha0 = 2.0
omega = 2*pi
def coherent(alpha, x, omega, t, l=1.0):
# Definition of coherent states
# https://en.wikipedia.org/wiki/Coherent_states
psi = (pi*l**2)**-0.25 * np.exp(
-0.5/l**2 * (x - sqrt(2)*l * alpha.real)**2
+ 1j*sqrt(2)/l * alpha.imag * x
+ 0.5j * (alpha0**2*sin(2*omega*t) - omega*t))
return psi
def animate(nframe):
print str(nframe) + ' ',
t = float(nframe) / nframes * 0.5 # animation repeats after t=0.5
alpha = e ** (-1j * omega * t) * alpha0
ax.cla()
ax.axis((x0, x1, y0, y1))
ax.grid(True)
x = np.linspace(x0, x1, 2 * width)
# Definition of cat states in terms of coherent states:
# https://en.wikipedia.org/wiki/Cat_state
psi = coherent(alpha, x, omega, t) + coherent(-alpha, x, omega, t)
psi /= sqrt(2 * (1 + exp(-2*alpha0**2)))
y = np.abs(psi)**2
plt.plot(x, y, lw=2, color='#0000cc')
ax.set_yticks(ax.get_yticks()[:-1])
# create figure and axes
plt.close('all')
fig, ax = plt.subplots(1, figsize=(width/100., height/100.))
bounds = [float(ml)/width, float(mb)/height,
1.0 - float(mr)/width, 1.0 - float(mt)/height]
fig.subplots_adjust(left=bounds[0], bottom=bounds[1],
right=bounds[2], top=bounds[3], hspace=0)
# axes labels
fig.text(0.5 + 0.5 * float(ml-mr)/width, 4./height,
r'$x\ \ [(\hbar/(m\omega))^{1/2}]$', ha='center')
fig.text(5./width, 1.0, '$|\psi|^2$', va='top')
anim = animation.FuncAnimation(fig, animate, frames=nframes)
anim.save(fname + '_.gif', writer='imagemagick', fps=fps)
import os
# compress with gifsicle
commons = 'https://commons.wikimedia.org/wiki/File:'
cmd = 'gifsicle -O3 -k64 --careful --comment="' + commons + fname + '.gif"'
cmd += ' < ' + fname + '_.gif > ' + fname + '.gif'
if os.system(cmd) == 0:
os.remove(fname + '_.gif')
else:
print 'warning: gifsicle not found!'
os.remove(fname + '.gif')
os.rename(fname + '_.gif', fname + '.gif')
|
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following licenses:
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
This file is licensed under the Creative Commons Attribution 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
You may select the license of your choice.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 13:03, 4 October 2015 | 300 × 200 (234 KB) | Geek3 (talk | contribs) | legend added | |
21:25, 20 September 2015 | 300 × 200 (162 KB) | Geek3 (talk | contribs) | {{Information |Description ={{en|1=Animation of the probability distribution of the quantum wave function of a Schrödinger cat state of α=2 in a [[:en:Quantum harmonic oscill... |
You cannot overwrite this file.
File usage on Commons
The following 2 pages use this file:
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
GIF file comment | https://commons.wikimedia.org/wiki/File:QHO-catstate-even2-animation.gif |
---|