Fitxer:LogGamma Analytic Function.png
De testwiki
Salta a la navegació
Salta a la cerca
Mida d'aquesta previsualització: 800 × 533 píxels. Altres resolucions: 320 × 213 píxels | 640 × 427 píxels.
Fitxer original (900 × 600 píxels, mida del fitxer: 108 Ko, tipus MIME: image/png)
Aquest fitxer prové de Wikimedia Commons i pot ser usat per altres projectes. La descripció de la seva pàgina de descripció es mostra a continuació.
Resum
| DescripcióLogGamma Analytic Function.png |
English: Logarithmic Gamma Function Modulus and Phase; the analytic log-Gamma function |
| Data | |
| Font | Treball propi |
| Autor | stsmith |
Llicència
Jo, el titular dels drets d'autor d'aquest treball, el public sota la següent llicència:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- Sou lliure de:
- compartir – copiar, distribuir i comunicar públicament l'obra
- adaptar – fer-ne obres derivades
- Amb les condicions següents:
- reconeixement – Heu de donar la informació adequada sobre l'autor, proporcionar un enllaç a la llicència i indicar si s'han realitzat canvis. Podeu fer-ho amb qualsevol mitjà raonable, però de cap manera no suggereixi que l'autor us dóna suport o aprova l'ús que en feu.
- compartir igual – Si modifiqueu, transformeu, o creeu a partir del material, heu de distribuir les vostres contribucions sota una llicència similar o una de compatible amb l'original.
Python Code
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import scipy.special as sps
# Import lighting object for shading surface plots.
from matplotlib.colors import LightSource
# Legible plot style defaults
# http://matplotlib.org/api/matplotlib_configuration_api.html
# http://matplotlib.org/users/customizing.html
mpl.rcParams['figure.figsize'] = (10.0, 5.0)
mpl.rc('font',**{'family': 'sans-serif', 'weight': 'bold', 'size': 14})
mpl.rc('axes',**{'titlesize': 20, 'titleweight': 'bold', 'labelsize': 16, 'labelweight': 'bold'})
mpl.rc('legend',**{'fontsize': 14})
mpl.rc('figure',**{'titlesize': 16, 'titleweight': 'bold'})
mpl.rc('lines',**{'linewidth': 2.5, 'markersize': 18, 'markeredgewidth': 0})
mpl.rc('mathtext',**{'fontset': 'custom', 'rm': 'sans:bold', 'bf': 'sans:bold', 'it': 'sans:italic', 'sf': 'sans:bold', 'default': 'it'})
# plt.rc('text',usetex=False) # [default] usetex should be False
mpl.rcParams['text.latex.preamble'] = [r'\usepackage{amsmath,sfmath} \boldmath']
realmin = np.finfo(np.double).tiny
# Define grid of points.
xpoints = np.linspace(-3.5, 6, int(np.round((6+3.5)*20))+1)
ypoints = np.linspace(-4, 4, (4+4)*20+1)
X, Y = np.meshgrid(xpoints, ypoints)
# n.b. np.gammaln, np.log(sps.gamma(X+Y*1j)) branch cuts are messed up
# e.g. xf = scipy.optimize.minimize(lambda x: np.abs(np.log(sps.gamma(x[0]+x[1]*1j))), np.array([4.,4.]), method='Nelder-Mead', tol=1.e-12)
F = sps.loggamma(X+Y*1j)
M = np.abs(F)
# n.b. this is phase of -log(gamma(z)), not log(gamma(z))
P = np.arctan2(-F.imag,-F.real)
nanscale = 1.33
M = np.where(np.isnan(M),nanscale*np.nanmax(M),M)
P = np.where(np.isnan(P),0.,P)
# Create an hsv array
H = (P+np.pi)/(2*np.pi)
S = np.ones_like(H)
V = 1.-(M-M.min())/(M.max()-M.min())
# Set view parameters for all subplots.
azimuth = 290
altitude = 41
# Create empty figure.
fig = plt.figure(figsize=(9,6))
# n.b. 1-hsv colors the colors the phase of -log(gamma(z)) correctly w.r.t. hsv cmap
facecolors = 1.-mpl.colors.hsv_to_rgb(np.dstack((H,S,V)))
f = 0.25
facecolors = f + (1-f)*facecolors
# light = LightSource(azimuth+20, altitude-10)
light = LightSource(120, 20)
illuminated_surface = light.shade_rgb(facecolors, M)
# Create a subplot with 3d plotting capabilities.
# This command will fail if Axes3D was not imported.
ax = fig.add_subplot(111, projection='3d')
ax.view_init(altitude, azimuth)
ax.plot_surface(X, Y, M, rstride=1, cstride=1, linewidth=0,
antialiased=False, facecolors=illuminated_surface, shade=True)
plt.xlabel('X',labelpad=10)
plt.ylabel('iY',labelpad=10)
plt.title('$\log\,\Gamma(z)$')
ax.set_zlabel('Modulus',labelpad=5)
ax.set_xlim([xpoints.min(), xpoints.max()])
ax.set_ylim([ypoints.min(), ypoints.max()])
ax.set_zlim([0, np.floor(M.max()/nanscale/2)*2])
ax.grid(False)
ax.text(0.5, 0.25, 1.5, r'$0! = 1$', (1,0.5,0.5))
ax.text(1.5, 0.5, 1.25, r'$1! = 1$', (1,0.5,0.5))
cax = fig.add_axes([0.9, 0.25, 0.015, 0.5])
cb = mpl.colorbar.ColorbarBase(cax, cmap=plt.cm.hsv, spacing='proportional', ticks=[0, 0.5, 1])
cb.ax.set_yticklabels(['$-\pi$', '$0$', '$\pi$'])
cb.set_label('Phase',labelpad=-10)
plt.savefig('./loggamma.png')
Llegendes
Afegeix una explicació d'una línia del que representa aquest fitxer
Elements representats en aquest fitxer
representa l'entitat
Algun valor sense element de Wikidata
26 abr 2017
Historial del fitxer
Cliqueu una data/hora per veure el fitxer tal com era aleshores.
| Data/hora | Miniatura | Dimensions | Usuari/a | Comentari | |
|---|---|---|---|---|---|
| actual | 14:51, 26 abr 2017 | 900 × 600 (108 Ko) | wikimediacommons>Stsmith | User created page with UploadWizard |
Ús del fitxer
La pàgina següent utilitza aquest fitxer: