numpy.random.standard_cauchy

random.standard_cauchy(size=None)

从模式为0的标准柯西分布中提取样本。

也被称为洛伦兹分布。

注解

新代码应该使用 standard_cauchy A方法 default_rng() 请参阅 快速启动 .

参数
sizeint或int的元组,可选

输出形状。如果给定的形状是,例如, (m, n, k) 然后 m * n * k 取样。默认值为无,在这种情况下返回单个值。

返回
samplesndarray或scalar

提取的样品。

参见

Generator.standard_cauchy

应该用于新代码。

笔记

全柯西分布的概率密度函数是

System Message: WARNING/2 (P(x;x\u 0,\gamma)=\frac{1}{\pi\gamma\bigl[1+)

latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)) Runaway argument? P(x;x\u 0,\gamma )=\frac {1}{\pi \gamma \bigl [1+\end {split}\ETC. ! File ended while scanning use of \split. <inserted text> \par <*> math.tex ! Emergency stop. <*> math.tex No pages of output. Transcript written on math.log.

标准柯西分布集 x_0=0\gamma=1

柯西分布出现在被驱动谐振子问题的解中,也描述了谱线展宽。它还描述了以随机角度倾斜的线切割X轴时的值分布。

在研究假设正态性的假设检验时,观察检验是如何对柯西分布的数据进行的,这是它们对重尾分布敏感度的一个很好的指标,因为柯西分布看起来很像高斯分布,但尾部较重。

工具书类

1

NIST/Sematech E-统计方法手册,“柯西分布”,https://www.itl.nist.gov/div898/handbook/eda/section3/eda3663.htm

2

柯西分布〉,摘自《数学世界——沃尔夫拉姆网络资源》。http://mathworld.wolfram.com/cauchydistribution.html

3

维基百科,“Cauchy发行版”https://en.wikipedia.org/wiki/Cauchy_发行版

实例

绘制样本并绘制分布图:

>>> import matplotlib.pyplot as plt
>>> s = np.random.standard_cauchy(1000000)
>>> s = s[(s>-25) & (s<25)]  # truncate distribution so it plots well
>>> plt.hist(s, bins=100)
>>> plt.show()
../../../_images/numpy-random-standard_cauchy-1.png