Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/numpy/doc/constants.py
7771 views
"""1=========2Constants3=========45.. currentmodule:: numpy67NumPy includes several constants:89%(constant_list)s10"""11#12# Note: the docstring is autogenerated.13#14import re15import textwrap1617# Maintain same format as in numpy.add_newdocs18constants = []19def add_newdoc(module, name, doc):20constants.append((name, doc))2122add_newdoc('numpy', 'pi',23"""24``pi = 3.1415926535897932384626433...``2526References27----------28https://en.wikipedia.org/wiki/Pi2930""")3132add_newdoc('numpy', 'e',33"""34Euler's constant, base of natural logarithms, Napier's constant.3536``e = 2.71828182845904523536028747135266249775724709369995...``3738See Also39--------40exp : Exponential function41log : Natural logarithm4243References44----------45https://en.wikipedia.org/wiki/E_%28mathematical_constant%294647""")4849add_newdoc('numpy', 'euler_gamma',50"""51``γ = 0.5772156649015328606065120900824024310421...``5253References54----------55https://en.wikipedia.org/wiki/Euler-Mascheroni_constant5657""")5859add_newdoc('numpy', 'inf',60"""61IEEE 754 floating point representation of (positive) infinity.6263Returns64-------65y : float66A floating point representation of positive infinity.6768See Also69--------70isinf : Shows which elements are positive or negative infinity7172isposinf : Shows which elements are positive infinity7374isneginf : Shows which elements are negative infinity7576isnan : Shows which elements are Not a Number7778isfinite : Shows which elements are finite (not one of Not a Number,79positive infinity and negative infinity)8081Notes82-----83NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic84(IEEE 754). This means that Not a Number is not equivalent to infinity.85Also that positive infinity is not equivalent to negative infinity. But86infinity is equivalent to positive infinity.8788`Inf`, `Infinity`, `PINF` and `infty` are aliases for `inf`.8990Examples91--------92>>> np.inf93inf94>>> np.array([1]) / 0.95array([ Inf])9697""")9899add_newdoc('numpy', 'nan',100"""101IEEE 754 floating point representation of Not a Number (NaN).102103Returns104-------105y : A floating point representation of Not a Number.106107See Also108--------109isnan : Shows which elements are Not a Number.110111isfinite : Shows which elements are finite (not one of112Not a Number, positive infinity and negative infinity)113114Notes115-----116NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic117(IEEE 754). This means that Not a Number is not equivalent to infinity.118119`NaN` and `NAN` are aliases of `nan`.120121Examples122--------123>>> np.nan124nan125>>> np.log(-1)126nan127>>> np.log([-1, 1, 2])128array([ NaN, 0. , 0.69314718])129130""")131132add_newdoc('numpy', 'newaxis',133"""134A convenient alias for None, useful for indexing arrays.135136Examples137--------138>>> newaxis is None139True140>>> x = np.arange(3)141>>> x142array([0, 1, 2])143>>> x[:, newaxis]144array([[0],145[1],146[2]])147>>> x[:, newaxis, newaxis]148array([[[0]],149[[1]],150[[2]]])151>>> x[:, newaxis] * x152array([[0, 0, 0],153[0, 1, 2],154[0, 2, 4]])155156Outer product, same as ``outer(x, y)``:157158>>> y = np.arange(3, 6)159>>> x[:, newaxis] * y160array([[ 0, 0, 0],161[ 3, 4, 5],162[ 6, 8, 10]])163164``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``:165166>>> x[newaxis, :].shape167(1, 3)168>>> x[newaxis].shape169(1, 3)170>>> x[None].shape171(1, 3)172>>> x[:, newaxis].shape173(3, 1)174175""")176177add_newdoc('numpy', 'NZERO',178"""179IEEE 754 floating point representation of negative zero.180181Returns182-------183y : float184A floating point representation of negative zero.185186See Also187--------188PZERO : Defines positive zero.189190isinf : Shows which elements are positive or negative infinity.191192isposinf : Shows which elements are positive infinity.193194isneginf : Shows which elements are negative infinity.195196isnan : Shows which elements are Not a Number.197198isfinite : Shows which elements are finite - not one of199Not a Number, positive infinity and negative infinity.200201Notes202-----203NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic204(IEEE 754). Negative zero is considered to be a finite number.205206Examples207--------208>>> np.NZERO209-0.0210>>> np.PZERO2110.0212213>>> np.isfinite([np.NZERO])214array([ True])215>>> np.isnan([np.NZERO])216array([False])217>>> np.isinf([np.NZERO])218array([False])219220""")221222add_newdoc('numpy', 'PZERO',223"""224IEEE 754 floating point representation of positive zero.225226Returns227-------228y : float229A floating point representation of positive zero.230231See Also232--------233NZERO : Defines negative zero.234235isinf : Shows which elements are positive or negative infinity.236237isposinf : Shows which elements are positive infinity.238239isneginf : Shows which elements are negative infinity.240241isnan : Shows which elements are Not a Number.242243isfinite : Shows which elements are finite - not one of244Not a Number, positive infinity and negative infinity.245246Notes247-----248NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic249(IEEE 754). Positive zero is considered to be a finite number.250251Examples252--------253>>> np.PZERO2540.0255>>> np.NZERO256-0.0257258>>> np.isfinite([np.PZERO])259array([ True])260>>> np.isnan([np.PZERO])261array([False])262>>> np.isinf([np.PZERO])263array([False])264265""")266267add_newdoc('numpy', 'NAN',268"""269IEEE 754 floating point representation of Not a Number (NaN).270271`NaN` and `NAN` are equivalent definitions of `nan`. Please use272`nan` instead of `NAN`.273274See Also275--------276nan277278""")279280add_newdoc('numpy', 'NaN',281"""282IEEE 754 floating point representation of Not a Number (NaN).283284`NaN` and `NAN` are equivalent definitions of `nan`. Please use285`nan` instead of `NaN`.286287See Also288--------289nan290291""")292293add_newdoc('numpy', 'NINF',294"""295IEEE 754 floating point representation of negative infinity.296297Returns298-------299y : float300A floating point representation of negative infinity.301302See Also303--------304isinf : Shows which elements are positive or negative infinity305306isposinf : Shows which elements are positive infinity307308isneginf : Shows which elements are negative infinity309310isnan : Shows which elements are Not a Number311312isfinite : Shows which elements are finite (not one of Not a Number,313positive infinity and negative infinity)314315Notes316-----317NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic318(IEEE 754). This means that Not a Number is not equivalent to infinity.319Also that positive infinity is not equivalent to negative infinity. But320infinity is equivalent to positive infinity.321322Examples323--------324>>> np.NINF325-inf326>>> np.log(0)327-inf328329""")330331add_newdoc('numpy', 'PINF',332"""333IEEE 754 floating point representation of (positive) infinity.334335Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for336`inf`. For more details, see `inf`.337338See Also339--------340inf341342""")343344add_newdoc('numpy', 'infty',345"""346IEEE 754 floating point representation of (positive) infinity.347348Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for349`inf`. For more details, see `inf`.350351See Also352--------353inf354355""")356357add_newdoc('numpy', 'Inf',358"""359IEEE 754 floating point representation of (positive) infinity.360361Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for362`inf`. For more details, see `inf`.363364See Also365--------366inf367368""")369370add_newdoc('numpy', 'Infinity',371"""372IEEE 754 floating point representation of (positive) infinity.373374Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for375`inf`. For more details, see `inf`.376377See Also378--------379inf380381""")382383384if __doc__:385constants_str = []386constants.sort()387for name, doc in constants:388s = textwrap.dedent(doc).replace("\n", "\n ")389390# Replace sections by rubrics391lines = s.split("\n")392new_lines = []393for line in lines:394m = re.match(r'^(\s+)[-=]+\s*$', line)395if m and new_lines:396prev = textwrap.dedent(new_lines.pop())397new_lines.append('%s.. rubric:: %s' % (m.group(1), prev))398new_lines.append('')399else:400new_lines.append(line)401s = "\n".join(new_lines)402403# Done.404constants_str.append(""".. data:: %s\n %s""" % (name, s))405constants_str = "\n".join(constants_str)406407__doc__ = __doc__ % dict(constant_list=constants_str)408del constants_str, name, doc409del line, lines, new_lines, m, s, prev410411del constants, add_newdoc412413414