File:Gamma function.svg
Summary
Description |
English: The gamma function. |
Date | |
Source | Own work Category:Unspec SVG created with Matplotlib#00060414Gamma%20function.svg |
Author | Rumil |
Source code
from math import gamma
from numpy import arange, array
import matplotlib as mp
import matplotlib.pyplot as plot
lw_grid = 1.6
lw_line = 2
axes_color = "#505050"
blue = [0,0.2,0.6,0.8]
green = [0,0.46,0,0.8]
magenta = [0.6,0,0.4,0.8]
black = [0,0,0,0.8]
style = {
"axes.linewidth": lw_grid,
"grid.linewidth": lw_grid,
"grid.linestyle": "solid",
"grid.color": "#e0e0d4",
"lines.linewidth": 2,
# "lines.markersize": 10,
"xtick.labelsize": 14,
"ytick.labelsize": 14,
}
mp.rcParams.update(style)
fig = plot.figure()
ax = fig.add_subplot(1,1,1)
ax.spines['bottom'].set_color(axes_color)
ax.spines['top'].set_color(axes_color)
ax.spines['right'].set_color(axes_color)
ax.spines['left'].set_color(axes_color)
ax.spines['bottom'].set_zorder(10)
ax.spines['top'].set_zorder(10)
ax.spines['right'].set_zorder(10)
ax.spines['left'].set_zorder(10)
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.xaxis.grid()
ax.yaxis.grid()
ax.set_axisbelow(True)
ax.xaxis.set_tick_params(width=lw_grid, length=10,
pad=8,color=axes_color,direction='inout')
ax.yaxis.set_tick_params(width=lw_grid, length=10,
pad=8,color=axes_color,direction='inout')
ax.set_aspect('equal')
X=[-6,6]
Y=[-6,6]
ax.axis(X+Y)
ax.set_xticks(list(range(X[0],0,1))+list(range(1,X[1]+1,1)))
ax.set_yticks(list(range(Y[0],0,1))+list(range(1,X[1]+1,1)))
def f(x):
try:
return gamma(x)
except:
return float("nan")
x = arange(0, 10, 0.01)
y = array(map(f,x))
ax.plot(x,y, color=blue, zorder=3, linewidth=lw_line)
for k in range(-6,0):
x = arange(k, k+1, 0.0001)
y = array(map(f,x))
ax.plot(x,y, color=blue, zorder=3, linewidth=lw_line)
plot.savefig("gamma.svg",bbox_inches='tight')
# plot.show()
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
![]() ![]() |
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|