Rozdział 4.1.1

import scipy.stats as stats

u = stats.uniform.rvs(loc= 0, scale= 1, size= 10, random_state= 1313)
print(u)
## [ 0.99250241  0.03101313  0.85090992  0.98288816  0.20383509  0.49741385
##   0.27774076  0.88546349  0.65512953  0.83098086]

Rozdział 4.1.2

import scipy.stats as stats

stats.uniform.rvs(loc= 0, scale= 1, size= 5)
stats.uniform.cdf(loc= 0, scale= 1, x= 0.5)
stats.uniform.pdf(loc= 0, scale= 1, x= 0.5)
stats.uniform.ppf(loc= 0, scale= 1, q= 0.1)
from scipy import *
import scipy.stats as stats
import matplotlib.pyplot as plt
import matplotlib.pylab as mpl

mpl.rcParams["font.size"] = 15

x = arange(-4, 4, 0.01)

fig = plt.figure(figsize=(8,6))
ax1 = fig.add_subplot(1, 1, 1)
ax2 = ax1.twinx()
ax1.plot(x,stats.norm.pdf(x), color='C0', linestyle='-', linewidth=3)
ax2.plot(x,stats.norm.cdf(x), color='C1', linestyle='--', linewidth=3)
ax1.set_ylabel('stats.norm.pdf(x)', color='C0')
ax2.set_ylabel('stats.norm.cdf(x)', color='C1')
ax1.set_xlabel('x')
plt.tight_layout()
plt.savefig('rys_4.1.png')