File:Chebyshevplotfrom0to50.png

From specialfunctionswiki
Revision as of 02:12, 28 November 2016 by Tom (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Original file(868 × 885 pixels, file size: 17 KB, MIME type: image/png)
#!/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