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

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

QHO-Fockstate0123-animation-color.gif(300 × 300 פיקסלים, גודל הקובץ: 318 ק"ב, סוג MIME‏: image/gif, בלולאה, 105 תמונות, 5.2 שניות)

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

תקציר

תיאור
English: Animation of the quantum wave functions of Fock states with n=0..3 in a Quantum harmonic oscillator. The probability distributions are drawn along the ordinate, while the phase is encoded by color. The Hermite function wave packets are static in time but their quantum phase changes due to vacuum energy.
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
 
. Matplotlib עם‎‎ נוצרה ה GIF תמונת מפת סיביות
יוצר Geek3
גרסאות אחרות QHO-Fockstate0123.png

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
from numpy.polynomial.hermite import Hermite
import colorsys
from scipy.interpolate import interp1d
import os, sys

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

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

# physics settings
omega = 2 * pi

def color(phase):
    hue = (phase / (2*pi) + 2./3.) % 1
    light = interp1d([0, 1, 2, 3, 4, 5, 6], # adjust lightness
                     [0.64, 0.5, 0.55, 0.48, 0.70, 0.57, 0.64])(6 * hue)
    hls = (hue, light, 1.0) # maximum saturation
    rgb = colorsys.hls_to_rgb(*hls)
    return rgb

def animate(nframe):
    print str(nframe) + ' ',; sys.stdout.flush()
    t = 2.0 * float(nframe) / nframes
    
    for nfock in range(4):
        ax = axi[3-nfock]
        fig.sca(ax)
        ax.cla()
        ax.grid(True)
        ax.axis((x0, x1, y0, y1))
        if nfock != 0:
            ax.set_xticklabels([])
        plt.yticks([0.0, 0.2, 0.4, 0.6], ['0.0', '0.2', '0.4', ''])
        
        # dummy plot for legend
        ax.plot(0, 0, color=(1,1,1,0), label=r'$\vert{}\rangle$'.format(nfock))
        
        # Definition of Fock-states in terms of Hermite functions:
        # https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator
        psi_fock = np.eye(1, nfock+1, nfock).flatten()
        a_hermite = [psi_fock[n] * pi**-0.25 / sqrt(2.**n*factorial(n))
                        * e**(-1j * omega * (n+0.5) * t) for n in range(1+nfock)]
        # doc: http://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.hermite.Hermite.html
        H = Hermite(a_hermite)
        
        x = np.linspace(x0, x1, int(ceil(1+w_px)))
        x2 = x - px_w/2.
        psi_x = np.exp(-x**2 / 2.0) * H(x)
        phi_x = np.angle(np.exp(-(x2)**2 / 2.0) * H(x2))
        y = np.abs(psi_x)**2
        
        # plot color filling
        for x_, phi_, y_ in zip(x, phi_x, y):
            ax.plot([x_, x_], [0, y_], color=color(phi_), lw=2*0.72)
        
        ax.plot(x, y, lw=2, color='black')
        leg = ax.legend(handlelength=0, handletextpad=0, borderpad=0.1,
                  borderaxespad=0.35, loc='upper left', fontsize=17)
        leg.get_frame().set_linewidth(0.0)

# create figure and axes
plt.close('all')
fig, axi = plt.subplots(4, sharey=True,
                        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+mc+mh) # 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')

# start animation
if 0 != os.system('convert -version > ' +  os.devnull):
    print 'imagemagick not installed!'
    # warning: imagemagick produces somewhat jagged and therefore large gifs
    anim = animation.FuncAnimation(fig, animate, frames=nframes)
    anim.save(fname + '.gif', writer='imagemagick', fps=fps)
else:
    # unfortunately the matplotlib imagemagick backend does not support
    # options which are necessary to generate high quality output without
    # framewise color palettes. Therefore save all frames and convert then.
    if not os.path.isdir(fname):
        os.mkdir(fname)
    fnames = []
    
    for frame in range(nframes):
        animate(frame)
        imgname = os.path.join(fname, fname + '{:03d}'.format(frame) + '.png')
        fig.savefig(imgname)
        fnames.append(imgname)
    
    # compile optimized animation with ImageMagick
    cmd = 'convert -loop 0 -delay ' + str(100 / fps) + ' '
    cmd += ' '.join(fnames) # now create optimized palette from all frames
    cmd += r' \( -clone 0--1 \( -clone 0--1 -fill black -colorize 100% \) '
    cmd += '-append +dither -colors 255 -unique-colors '
    cmd += '-write mpr:colormap +delete \) +dither -map mpr:colormap '
    cmd += '-alpha activate -layers OptimizeTransparency '
    cmd += fname + '.gif'
    os.system(cmd)
    
    for fnamei in fnames:
        os.remove(fnamei)
    os.rmdir(fname)

רישיון

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

כיתובים

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

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

מוצג

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

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

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית00:54, 11 באוקטובר 2015תמונה ממוזערת לגרסה מ־00:54, 11 באוקטובר 2015‪300 × 300‬ (318 ק"ב)Geek3better compression
16:29, 4 באוקטובר 2015תמונה ממוזערת לגרסה מ־16:29, 4 באוקטובר 2015‪300 × 300‬ (590 ק"ב)Geek3legend added
01:31, 21 בספטמבר 2015תמונה ממוזערת לגרסה מ־01:31, 21 בספטמבר 2015‪300 × 300‬ (595 ק"ב)Geek3{{Information |Description ={{en|1=Animation of the quantum wave functions of Fock states with n=0..3 in a Quantum harmonic oscillator. The [[:en:Probability distribution|p...

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