Difference between revisions of "File:Signumplot.png"

From specialfunctionswiki
Jump to: navigation, search
(<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 x1=np.arange(-4,-0.05,0.01); x2=np.arange(0.05,4,0.01); def g1(x): return -1 def g2(x):...)
 
(No difference)

Latest revision as of 19:51, 14 December 2017

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

x1=np.arange(-4,-0.05,0.01);
x2=np.arange(0.05,4,0.01);

def g1(x):
    return -1
def g2(x):
    return 1
f1=np.vectorize(g1)
f2=np.vectorize(g2)

y1=f1(x1)
y2=f2(x2)

fig, ax = plt.subplots()

plt.xlabel(r'$x$')
plt.ylabel(r'$\mathrm{sgn}(x)$')

plt.plot(x1,y1,linewidth=2,color='Black')
plt.scatter([0],[0],color='Black')
plt.scatter([0],[1],facecolors='none',edgecolors='Black')
plt.scatter([0],[-1],facecolors='none',edgecolors='Black')
plt.plot(x2,y2,linewidth=2,color='Black')

plt.xlim(-4,4)

plt.savefig('signumplot.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
current19:51, 14 December 2017Thumbnail for version as of 19:51, 14 December 2017885 × 846 (16 KB)Tom (talk | contribs)<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 x1=np.arange(-4,-0.05,0.01); x2=np.arange(0.05,4,0.01); def g1(x): return -1 def g2(x):...
  • You cannot overwrite this file.

The following page links to this file:

Metadata