File:Mangoldtplot.png

From specialfunctionswiki
Jump to: navigation, search
Original file(868 × 876 pixels, file size: 25 KB, MIME type: image/png)
#!/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 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

x=np.arange(0,3000,1);
f=np.vectorize(mangoldt)
y=f(x)

fig, ax = plt.subplots()

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

plt.scatter(x,y,linewidth=0.01,color='Black')
plt.xlim(0,3000)
plt.ylim(-0.3,8.5)
plt.savefig('mangoldtplot.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
current05:57, 22 June 2016Thumbnail for version as of 05:57, 22 June 2016868 × 876 (25 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 page links to this file:

Metadata