File:Mobiusglyph.png

From specialfunctionswiki
Revision as of 09:47, 16 June 2016 by Tom (talk | contribs) (Category:mobiusglyph <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 2.4,2.4 def numberOfFactors(n): counter = 0 while (n > 1):...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Mobiusglyph.png(186 × 192 pixels, file size: 2 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'] = 2.4,2.4

def numberOfFactors(n):
        counter = 0
        while (n > 1):
                i=2
                while (i <= n):
                        if(n%i ==0):
                                n /= i
                                counter += 1
                                break
                        i += 1
        return counter

def isDivisibleBySquare(n):
        i=2
        while(i**2 <= n):
                if (n%(i**2)==0):
                        return 1
                i += 1
        return 0

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

def mobius(n):
        if not isValid(n):
                return 0
        elif (n==1):
                return 1
        elif(isDivisibleBySquare(n)):
                return 0
        else:
                return (-1)**numberOfFactors(n)

x=np.arange(0,30,1)
f=np.vectorize(mobius)
y=f(x)

fig, ax = plt.subplots()
ax.spines['left'].set_position('center')
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position('center')
ax.spines['top'].set_color('none')
ax.spines['left'].set_smart_bounds(True)
ax.spines['bottom'].set_smart_bounds(True)
ax.xaxis.set_ticks_position('none')
plt.tick_params(axis='x', which='both', bottom='off', top='off', labelbottom='off')
plt.tick_params(axis='y', which='both', left='off', right='off', labelleft='off')

plt.scatter(x,y,linewidth=5,color='Black')

plt.savefig('mobiusglyph.png',bbox_inches='tight',pad_inches=0.0)

File history

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

Date/TimeThumbnailDimensionsUserComment
current00:49, 22 June 2016Thumbnail for version as of 00:49, 22 June 2016186 × 192 (2 KB)Tom (talk | contribs)Category:mobiusglyph <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 2.4,2.4 def numberOfFactors(n): counter = 0 while (n > 1):...
09:47, 16 June 2016Thumbnail for version as of 09:47, 16 June 2016186 × 192 (2 KB)Tom (talk | contribs)Category:mobiusglyph <pre>#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from mpmath import * from pylab import rcParams rcParams['figure.figsize'] = 2.4,2.4 def numberOfFactors(n): counter = 0 while (n > 1):...
  • You cannot overwrite this file.

There are no pages that link to this file.

Metadata