קובץ:QHO-coherentstate1-animation-color.gif

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיפדיה, האנציקלופדיה החופשית

QHO-coherentstate1-animation-color.gif(300 × 200 פיקסלים, גודל הקובץ: 727 ק"ב, סוג MIME‏: image/gif, בלולאה, 160 תמונות, 8.0 שניות)

ויקישיתוף זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה.

תקציר

תיאור
English: Animation of the quantum wave function of a coherent state of initial α=1 in a Quantum harmonic oscillator. The probability distribution is drawn along the ordinate, while the phase is encoded by color. The gaussian wave packet oscillates sinusoidally in the harmonic potential.
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
 
. Matplotlib עם‎‎ נוצרה ה GIF תמונת מפת סיביות
יוצר Geek3
גרסאות אחרות QHO-coherentstate1-animation.gif

Source Code

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, colors, colorbar
import numpy as np
import colorsys
from scipy.interpolate import interp1d

plt.rc('path', snap=False)
plt.rc('mathtext', default='regular')

# image settings
fname = 'QHO-coherentstate1-animation-color'
width, height = 300, 200
ml, mr, mt, mb, mh, mc = 35, 19, 22, 45, 12, 6
x0, x1 = -4, 4
y0, y1 = 0.0, 0.7
nframes = 160
fps = 20

# physics settings
alpha0 = 1.0
omega = 2*pi

def color(phase):
    phase1 = ((phase / (2*pi)) % 1 + 1) % 1
    hue = (interp1d([0, 1./3, 1.2/3, 0.5, 1], # spread yellow a bit
                    [0, 1./3, 1.3/3, 0.5, 1])(phase1) + 2./3.) % 1
    light = interp1d([0, 1, 2, 3, 4, 5, 6], # adjust lightness
                     [0.64, 0.5, 0.56, 0.48, 0.75, 0.57, 0.64])(6 * hue)
    hls = (hue, light, 1.0) # maximum saturation
    rgb = colorsys.hls_to_rgb(*hls)
    return rgb

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.real * x
                + 0.5j * (alpha0**2*sin(2*omega*t) - omega*t))
    return psi

def animate(nframe):
    print str(nframe) + ' ',
    t = float(nframe) / nframes * 2.0 # animation repeats after t=2.0
    alpha = e ** (-1j * omega * t) * alpha0
    
    ax.cla()
    ax.grid(True)
    ax.axis((x0, x1, y0, y1))
    
    x = np.linspace(x0, x1, int(ceil(1+w_px)))
    x2 = x - px_w/2.
    
    psi = coherent(alpha, x, omega, t)
    psi2 = coherent(alpha, x2, omega, t)
    phi = np.angle(psi2)
    y = np.abs(psi)**2
    
    # plot color filling
    for x_, phi_, y_ in zip(x, phi, y):
        ax.plot([x_, x_], [0, y_], color=color(phi_), lw=2*0.72)
    
    ax.plot(x, y, lw=2, color='black')
    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+mc+mh)/width, 1.0 - float(mt)/height]
fig.subplots_adjust(left=bounds[0], bottom=bounds[1],
                    right=bounds[2], top=bounds[3], hspace=0)
w_px = width - (ml+mr+mh+mc) # plot width in pixels
px_w = float(x1 - x0) / w_px # width of one pixel in plot units

# axes labels
fig.text(0.5 + 0.5 * float(ml-mh-mc-mr)/width, 4./height,
         r'$x\ \ [(\hbar/(m\omega))^{1/2}]$', ha='center')
fig.text(5./width, 1.0, '$|\psi|^2$', va='top')

# colorbar for phase
cax = fig.add_axes([1.0 - float(mr+mc)/width, float(mb)/height,
                    float(mc)/width, 1.0 - float(mb+mt)/height])
cax.yaxis.set_tick_params(length=2)
cmap = colors.ListedColormap([color(phase) for phase in
                              np.linspace(0, 2*pi, 384, endpoint=False)])
norm = colors.Normalize(0, 2*pi)
cbar = colorbar.ColorbarBase(cax, cmap=cmap, norm=norm,
                    orientation='vertical', ticks=np.linspace(0, 2*pi, 3))
cax.set_yticklabels(['$0$', r'$\pi$', r'$2\pi$'], rotation=90)
fig.text(1.0 - 10./width, 1.0, '$arg(\psi)$', ha='right', va='top')
plt.sca(ax)

# start animation
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 -k256 --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')

רישיון

אני, בעל זכויות היוצרים על היצירה הזאת, מפרסם אותה בזאת תחת הרישיונות הבאים:
GNU head מוענקת בכך הרשות להעתיק, להפיץ או לשנות את המסמך הזה, לפי תנאי הרישיון לשימוש חופשי במסמכים של גנו, גרסה 1.2 או כל גרסה מאוחרת יותר שתפורסם על־ידי המוסד לתוכנה חופשית; ללא פרקים קבועים, ללא טקסט עטיפה קדמית וללא טקסט עטיפה אחורית. עותק של הרישיון כלול בפרק שכותרתו הרישיון לשימוש חופשי במסמכים של גנו.
w:he:Creative Commons
ייחוס
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס 3.0 לא מותאם.
הנכם רשאים:
  • לשתף – להעתיק, להפיץ ולהעביר את העבודה
  • לערבב בין עבודות – להתאים את העבודה
תחת התנאים הבאים:
  • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
הנכם מוזמנים לבחור את הרישיון הרצוי בעיניכם.

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג

פריטים שמוצגים בקובץ הזה

מוצג

היסטוריית הקובץ

ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית16:21, 4 באוקטובר 2015תמונה ממוזערת לגרסה מ־16:21, 4 באוקטובר 2015‪200 × 300‬ (727 ק"ב)Geek3legend added
00:57, 21 בספטמבר 2015תמונה ממוזערת לגרסה מ־00:57, 21 בספטמבר 2015‪200 × 300‬ (810 ק"ב)Geek3{{Information |Description ={{en|1=Animation of the quantum wave function of a Schrödinger cat state of α=1 in a Quantum harmonic oscillator. The [[:en:Probability distrib...

אין בוויקיפדיה דפים המשתמשים בקובץ זה.

מטא־נתונים