• Python: 3.8.11
  • Scipy: 1.6.2
  • OS: Ubuntu Kylin 20.04
  • Conda: 4.10.1
  • Jupyter lab: 3.1.4

Code sample

import scipy.special
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
Copy the code
# number = 100
x = np.linspace(-10.10.100)
x

array([-10.        ,  -9.7979798 ,  -9.5959596 ,  -9.39393939,
        -9.19191919,  -8.98989899,  -8.78787879,  -8.58585859,
        -8.38383838,  -8.18181818,  -7.97979798,  -7.77777778,
        -7.57575758,  -7.37373737,  -7.17171717,  -6.96969697,
        -6.76767677,  -6.56565657,  -6.36363636,  -6.16161616,
        -5.95959596,  -5.75757576,  -5.55555556,  -5.35353535,
        -5.15151515,  -4.94949495,  -4.74747475,  -4.54545455,
        -4.34343434,  -4.14141414,  -3.93939394,  -3.73737374,
        -3.53535354,  -3.33333333,  -3.13131313,  -2.92929293,
        -2.72727273,  -2.52525253,  -2.32323232,  -2.12121212,
        -1.91919192,  -1.71717172,  -1.51515152,  -1.31313131,
        -1.11111111,  -0.90909091,  -0.70707071,  -0.50505051,
        -0.3030303 ,  -0.1010101 ,   0.1010101 ,   0.3030303 ,
         0.50505051.0.70707071.0.90909091.1.11111111.1.31313131.1.51515152.1.71717172.1.91919192.2.12121212.2.32323232.2.52525253.2.72727273.2.92929293.3.13131313.3.33333333.3.53535354.3.73737374.3.93939394.4.14141414.4.34343434.4.54545455.4.74747475.4.94949495.5.15151515.5.35353535.5.55555556.5.75757576.5.95959596.6.16161616.6.36363636.6.56565657.6.76767677.6.96969697.7.17171717.7.37373737.7.57575758.7.77777778.7.97979798.8.18181818.8.38383838.8.58585859.8.78787879.8.98989899.9.19191919.9.39393939.9.5959596 ,   9.7979798 ,  10.        ])
Copy the code
y = scipy.special.expit(x)
y

array([4.53978687 e-05.5.55606489 e-05.6.79983174 e-05.8.32200197 e-05.1.01848815 e-04.1.24647146 e-04.1.52547986 e-04.1.86692945 e-04.2.28478855 e-04.2.79614739 e-04.3.42191434 e-04.4.18766684 e-04.5.12469082 e-04.6.27124987 e-04.7.67413430 e-04.9.39055039 e-04.1.14904229 e-03.1.40591988 e-03.1.72012560 e-03.2.10440443 e-03.2.57431039 e-03.3.14881358 e-03.3.85103236 e-03.4.70911357 e-03.5.75728612 e-03.7.03711536 e-03.8.59898661 e-03.1.05038445 e-02.1.28252101 e-02.1.56514861 e-02.1.90885420 e-02.2.32625358 e-02.2.83228820 e-02.3.44451957 e-02.4.18339400 e-02.5.07243606 e-02.6.13831074 e-02.7.41067363 e-02.8.92170603 e-02.1.07052146 e-01.1.27951705 e-01.1.52235823 e-01.1.80176593 e-01.2.11963334 e-01.2.47663801 e-01.2.87185901 e-01.3.30246430 e-01.3.76354517 e-01.4.24816868 e-01.4.74768924 e-01.5.25231076 e-01.5.75183132 e-01.6.23645483 e-01.6.69753570 e-01.7.12814099 e-01.7.52336199 e-01.7.88036666 e-01.8.19823407 e-01.8.47764177 e-01.8.72048295 e-01.8.92947854 e-01.9.10782940 e-01.9.25893264 e-01.9.38616893 e-01.9.49275639 e-01.9.58166060 e-01.9.65554804 e-01.9.71677118 e-01.9.76737464 e-01.9.80911458 e-01.9.84348514 e-01.9.87174790 e-01.9.89496155 e-01.9.91401013 e-01.9.92962885 e-01.9.94242714 e-01.9.95290886 e-01.9.96148968 e-01.9.96851186 e-01.9.97425690 e-01.9.97895596 e-01.9.98279874 e-01.9.98594080 e-01.9.98850958 e-01.9.99060945 e-01.9.99232587 e-01.9.99372875 e-01.9.99487531 e-01.9.99581233 e-01.9.99657809 e-01.9.99720385 e-01.9.99771521 e-01.9.99813307 e-01.9.99847452 e-01.9.99875353 e-01.9.99898151 e-01.9.99916780 e-01.9.99932002 e-01.9.99944439 e-01.9.99954602 e-01])
Copy the code
plt.grid()
plt.plot(x,y)
Copy the code

Learning to recommend

  • Python documentation – English
  • Python documentation – Chinese
  • Python code PEP
  • Google version of the Python specification
  • Python source code
  • Python PEP
  • Optimal kirin
  • The nuggets platform
  • Gitee platform


Python is open source, cross-platform, interpretive, interactive, and worth learning. Python’s design philosophy: elegant, unambiguous, simple. Advocate one way, preferably only one way to do one thing. Code should be written in accordance with specifications to facilitate communication and understanding. Every language has its own unique ideas. Beginners need to change their thinking, practice and accumulate.