Difference between revisions of "File:Chebyshevplotfrom0to50.png"

From specialfunctionswiki
Jump to: navigation, search
(Category:Plot <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 10, 10 def isValid(n): if (n <=0): return 0 elif...)
 
 
Line 31: Line 31:
  
 
fig, ax = plt.subplots()
 
fig, ax = plt.subplots()
 
#xlabels = [item.get_text() for item in ax.get_xticklabels()]
 
#xlabels=[r'$-4$',r'$-3$',r'$-2$',r'$-1$',r'$0$',r'$1$',r'$2$',r'$3$',r'$4$']
 
#ax.set_xticks([-4,-3,-2,-1,0,1,2,3,4])
 
#ax.set_xticklabels(xlabels,horizontalalignment='center')
 
  
 
plt.xlabel(r'$x$')
 
plt.xlabel(r'$x$')
 
plt.ylabel(r'$\vartheta(x)$')
 
plt.ylabel(r'$\vartheta(x)$')
 
#plt.ylim(0,200)
 
#plt.xlim(0,20)
 
  
 
plt.plot(x,y,linewidth=2,color='Black')
 
plt.plot(x,y,linewidth=2,color='Black')
  
 
plt.savefig('chebyshevplot.png',bbox_inches='tight',pad_inches=0.15)</pre>
 
plt.savefig('chebyshevplot.png',bbox_inches='tight',pad_inches=0.15)</pre>

Latest revision as of 02:12, 28 November 2016

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
from mpmath import *
from pylab import rcParams
rcParams['figure.figsize'] = 10, 10

def  isValid(n):
        if (n <=0):
                return 0
        elif (n-int(n) != 0):
                return 0
        return 1

def  isPrime(n):
        return  not (n < 2 or any(n % i == 0 for i in  range(2, int(n**0.5)+1)))

def  Chebyshev(n):
        if not  isValid(n):
                return 0
        chebyshev = 0
        for p in  range(1,n):
                if (isPrime(p)):
                        chebyshev  += log(p)
        return  chebyshev

x=np.arange(0,50,0.01);
f=np.vectorize(lambda x: Chebyshev(floor(x)))
y=f(x)

fig, ax = plt.subplots()

plt.xlabel(r'$x$')
plt.ylabel(r'$\vartheta(x)$')

plt.plot(x,y,linewidth=2,color='Black')

plt.savefig('chebyshevplot.png',bbox_inches='tight',pad_inches=0.15)

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current02:09, 28 November 2016Thumbnail for version as of 02:09, 28 November 2016868 × 885 (17 KB)Tom (talk | contribs)Category:Plot <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 10, 10 def isValid(n): if (n <=0): return 0 elif...
  • You cannot overwrite this file.

The following page links to this file:

Metadata