• 概率分布实现(可视化)


    二项分布式

    import numpy as np
    import matplotlib.pyplot as plt
    list = np.random.binomial(n=10, p=0.5,size = 10000)
    plt.hist(list, bins = 8,color = 'g', alpha = 0.4,edgecolor = 'b')
    plt.show()

    泊松分布式

    import numpy as np
    import matplotlib.pyplot as plt
    list = np.random.poisson(9,10000)
    plt.hist(list, bins = 8, color = 'r', alpha = 0.4, edgecolor = 'r')
    plt.show()

    均匀分布

    list = np.random.uniform(0,10,10000)
    plt.hist(list,bins = 7,color = 'g', alpha = 0.4, edgecolor  = 'b')
    plt.show()

    正态分布

    list = np.random.normal(0,1,10000)
    plt.hist(list, bins = 8, color = 'r', alpha = 0.5, edgecolor = 'r')
    plt.show()

    指数分布

    list = np.random.exponential(0.125, 10000)
    plt.hist(list, bins=8,color = 'g', alpha = 0.4, edgecolor = 'b')
    plt.show()

  • 相关阅读:
    HDU 1813 Escape from Tetris
    BZOJ 2276 Temperature
    BZOJ 4499 线性函数
    BZOJ 3131 淘金
    HDU 5738 Eureka
    POJ 2409 Let it Bead
    POJ 1286 Necklace of Beads
    POJ 1696 Space Ant
    Fox And Jumping
    Recover the String
  • 原文地址:https://www.cnblogs.com/bigtreei/p/11967397.html
Copyright © 2020-2023  润新知