Difference between revisions of "File:Chebyshevthetaplot.png"

From specialfunctionswiki
Jump to: navigation, search
(Category:Plot <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import fractions from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 10, 10 def isValid ( n ): if (n <=0): ret...)
 
(Tom uploaded a new version of "File:Chebyshevthetaplot.png")
 
(2 intermediate revisions by the same user not shown)
Line 61: Line 61:
 
plt.xlim(0,400)
 
plt.xlim(0,400)
 
#plt.ylim(-0.3,8.5)
 
#plt.ylim(-0.3,8.5)
plt.savefig('chebyshevvarthetaplot.png',bbox_inches='tight',pad_inches=0.15)</pre>
+
plt.savefig('chebyshevthetaplot.png',bbox_inches='tight',pad_inches=0.15)</pre>

Latest revision as of 06:23, 22 June 2016

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
import fractions
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 isPrimePower (n , d ):
        return ( math . log (n , d ) - int ( math . log (n , d ))==0)



def Mangoldt ( n ):
        if not isValid ( n ):
                return 0
        d = 2
        while (d <= n ):
                # Find a divisor
                if ( n % d ==0):
                        # Check if n is d to some power
                        if ( isPrimePower (n , d )):
                                return log ( d )
                        else :
                                # If not , it must be a product
                                # of different divisors .
                                return 0
                d += 1
        return 0

def chebyshevvartheta ( 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,400,1);
f=np.vectorize(chebyshevvartheta)
y=f(x)

fig, ax = plt.subplots()

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

plt.scatter(x,y,linewidth=0.01,color='Black')
plt.xlim(0,400)
#plt.ylim(-0.3,8.5)
plt.savefig('chebyshevthetaplot.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
current06:23, 22 June 2016Thumbnail for version as of 06:23, 22 June 2016884 × 876 (24 KB)Tom (talk | contribs)Category:Plot <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import fractions from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 10, 10 def isValid ( n ): if (n <=0): ret...
06:20, 22 June 2016Thumbnail for version as of 06:20, 22 June 2016886 × 885 (24 KB)Tom (talk | contribs)Category:Plot <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import fractions from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 10, 10 def isValid ( n ): if (n <=0): ret...
  • You cannot overwrite this file.

The following 2 pages link to this file:

Metadata