package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val get_py : string -> Py.Object.t

Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.

module Int : sig ... end
module Orthopoly1d : sig ... end
module Cephes : sig ... end
val airy : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

airy(x, out1, out2, out3, out4, / , out=(None, None, None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

airy(z)

Airy functions and their derivatives.

Parameters ---------- z : array_like Real or complex argument.

Returns ------- Ai, Aip, Bi, Bip : ndarrays Airy functions Ai and Bi, and their derivatives Aip and Bip.

Notes ----- The Airy functions Ai and Bi are two independent solutions of

.. math:: y''(x) = x y(x).

For real `z` in -10, 10, the computation is carried out by calling the Cephes 1_ `airy` routine, which uses power series summation for small `z` and rational minimax approximations for large `z`.

Outside this range, the AMOS 2_ `zairy` and `zbiry` routines are employed. They are computed using power series for :math:`|z| < 1` and the following relations to modified Bessel functions for larger `z` (where :math:`t \equiv 2 z^

/2

/3`):

.. math::

Ai(z) = \frac

\pi \sqrt{3

}

K_

/3

(t)

Ai'(z) = -\fracz\pi \sqrt{3

}

K_

/3

(t)

Bi(z) = \sqrt\frac{z

}

\left(I_

1/3

}

(t) + I_

/3

(t) \right)

Bi'(z) = \fracz\sqrt{3

}

\left(I_

2/3

}

(t) + I_

/3

(t)\right)

See also -------- airye : exponentially scaled Airy functions.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

Examples -------- Compute the Airy functions on the interval -15, 5.

>>> from scipy import special >>> x = np.linspace(-15, 5, 201) >>> ai, aip, bi, bip = special.airy(x)

Plot Ai(x) and Bi(x).

>>> import matplotlib.pyplot as plt >>> plt.plot(x, ai, 'r', label='Ai(x)') >>> plt.plot(x, bi, 'b--', label='Bi(x)') >>> plt.ylim(-0.5, 1.0) >>> plt.grid() >>> plt.legend(loc='upper left') >>> plt.show()

val arange : ?start:[ `I of int | `F of float ] -> ?step:[ `I of int | `F of float ] -> ?dtype:Np.Dtype.t -> stop:[ `F of float | `I of int ] -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

arange(start, stop, step,, dtype=None)

Return evenly spaced values within a given interval.

Values are generated within the half-open interval ``start, stop)`` (in other words, the interval including `start` but excluding `stop`). For integer arguments the function is equivalent to the Python built-in `range` function, but returns an ndarray rather than a list. When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use `numpy.linspace` for these cases. Parameters ---------- start : number, optional Start of interval. The interval includes this value. The default start value is 0. stop : number End of interval. The interval does not include this value, except in some cases where `step` is not an integer and floating point round-off affects the length of `out`. step : number, optional Spacing between values. For any output `out`, this is the distance between two adjacent values, ``out[i+1] - out[i]``. The default step size is 1. If `step` is specified as a position argument, `start` must also be given. dtype : dtype The type of the output array. If `dtype` is not given, infer the data type from the other input arguments. Returns ------- arange : ndarray Array of evenly spaced values. For floating point arguments, the length of the result is ``ceil((stop - start)/step)``. Because of floating point overflow, this rule may result in the last element of `out` being greater than `stop`. See Also -------- numpy.linspace : Evenly spaced numbers with careful handling of endpoints. numpy.ogrid: Arrays of evenly spaced numbers in N-dimensions. numpy.mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions. Examples -------- >>> np.arange(3) array([0, 1, 2]) >>> np.arange(3.0) array([ 0., 1., 2.]) >>> np.arange(3,7) array([3, 4, 5, 6]) >>> np.arange(3,7,2) array([3, 5])

val arccos : ?out: [ `Ndarray of [> `Ndarray ] Np.Obj.t | `Tuple_of_ndarray_and_None of Py.Object.t ] -> ?where:[> `Ndarray ] Np.Obj.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

Trigonometric inverse cosine, element-wise.

The inverse of `cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``.

Parameters ---------- x : array_like `x`-coordinate on the unit circle. For real arguments, the domain is -1, 1. out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.

Returns ------- angle : ndarray The angle of the ray intersecting the unit circle at the given `x`-coordinate in radians 0, pi. This is a scalar if `x` is a scalar.

See Also -------- cos, arctan, arcsin, emath.arccos

Notes ----- `arccos` is a multivalued function: for each `x` there are infinitely many numbers `z` such that `cos(z) = x`. The convention is to return the angle `z` whose real part lies in `0, pi`.

For real-valued input data types, `arccos` always returns real output. For each value that cannot be expressed as a real number or infinity, it yields ``nan`` and sets the `invalid` floating point error flag.

For complex-valued input, `arccos` is a complex analytic function that has branch cuts `-inf, -1` and `1, inf` and is continuous from above on the former and from below on the latter.

The inverse `cos` is also known as `acos` or cos^-1.

References ---------- M. Abramowitz and I.A. Stegun, 'Handbook of Mathematical Functions', 10th printing, 1964, pp. 79. http://www.math.sfu.ca/~cbm/aands/

Examples -------- We expect the arccos of 1 to be 0, and of -1 to be pi:

>>> np.arccos(1, -1) array( 0. , 3.14159265)

Plot arccos:

>>> import matplotlib.pyplot as plt >>> x = np.linspace(-1, 1, num=100) >>> plt.plot(x, np.arccos(x)) >>> plt.axis('tight') >>> plt.show()

val around : ?decimals:int -> ?out:[> `Ndarray ] Np.Obj.t -> a:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Evenly round to the given number of decimals.

Parameters ---------- a : array_like Input data. decimals : int, optional Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary. See `ufuncs-output-type` for more details.

Returns ------- rounded_array : ndarray An array of the same type as `a`, containing the rounded values. Unless `out` was specified, a new array is created. A reference to the result is returned.

The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float.

See Also -------- ndarray.round : equivalent method

ceil, fix, floor, rint, trunc

Notes ----- For values exactly halfway between rounded decimal values, NumPy rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -0.5 and 0.5 round to 0.0, etc.

``np.around`` uses a fast but sometimes inexact algorithm to round floating-point datatypes. For positive `decimals` it is equivalent to ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has error due to the inexact representation of decimal fractions in the IEEE floating point standard 1_ and errors introduced when scaling by powers of ten. For instance, note the extra '1' in the following:

>>> np.round(56294995342131.5, 3) 56294995342131.51

If your goal is to print such values with a fixed number of decimals, it is preferable to use numpy's float printing routines to limit the number of printed decimals:

>>> np.format_float_positional(56294995342131.5, precision=3) '56294995342131.5'

The float printing routines use an accurate but much more computationally demanding algorithm to compute the number of digits after the decimal point.

Alternatively, Python's builtin `round` function uses a more accurate but slower algorithm for 64-bit floating point values:

>>> round(56294995342131.5, 3) 56294995342131.5 >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 (16.06, 16.05)

References ---------- .. 1 'Lecture Notes on the Status of IEEE 754', William Kahan, https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF .. 2 'How Futile are Mindless Assessments of Roundoff in Floating-Point Computation?', William Kahan, https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf

Examples -------- >>> np.around(0.37, 1.64) array(0., 2.) >>> np.around(0.37, 1.64, decimals=1) array(0.4, 1.6) >>> np.around(.5, 1.5, 2.5, 3.5, 4.5) # rounds to nearest even value array(0., 2., 2., 4., 4.) >>> np.around(1,2,3,11, decimals=1) # ndarray of ints is returned array( 1, 2, 3, 11) >>> np.around(1,2,3,11, decimals=-1) array( 0, 0, 0, 10)

val binom : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

binom(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

binom(n, k)

Binomial coefficient

See Also -------- comb : The number of combinations of N things taken k at a time.

val c_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (first kind) quadrature.

Compute the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the first kind, :math:`C_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-2, 2` with weight function :math:`w(x) = 1 / \sqrt

- (x/2)^2

`. See 22.2.6 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val cg_roots : ?mu:bool -> n:int -> alpha:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Gegenbauer quadrature.

Compute the sample points and weights for Gauss-Gegenbauer quadrature. The sample points are the roots of the n-th degree Gegenbauer polynomial, :math:`C^\alpha_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = (1 - x^2)^\alpha - 1/2`. See 22.2.3 in AS_ for more details.

Parameters ---------- n : int quadrature order alpha : float alpha must be > -0.5 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val chebyc : ?monic:bool -> n:int -> unit -> Py.Object.t

Chebyshev polynomial of the first kind on :math:`-2, 2`.

Defined as :math:`C_n(x) = 2T_n(x/2)`, where :math:`T_n` is the nth Chebychev polynomial of the first kind.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- C : orthopoly1d Chebyshev polynomial of the first kind on :math:`-2, 2`.

Notes ----- The polynomials :math:`C_n(x)` are orthogonal over :math:`-2, 2` with weight function :math:`1/\sqrt

- (x/2)^2

`.

See Also -------- chebyt : Chebyshev polynomial of the first kind.

References ---------- .. 1 Abramowitz and Stegun, 'Handbook of Mathematical Functions' Section 22. National Bureau of Standards, 1972.

val chebys : ?monic:bool -> n:int -> unit -> Py.Object.t

Chebyshev polynomial of the second kind on :math:`-2, 2`.

Defined as :math:`S_n(x) = U_n(x/2)` where :math:`U_n` is the nth Chebychev polynomial of the second kind.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- S : orthopoly1d Chebyshev polynomial of the second kind on :math:`-2, 2`.

Notes ----- The polynomials :math:`S_n(x)` are orthogonal over :math:`-2, 2` with weight function :math:`\sqrt

- (x/2)

^2`.

See Also -------- chebyu : Chebyshev polynomial of the second kind

References ---------- .. 1 Abramowitz and Stegun, 'Handbook of Mathematical Functions' Section 22. National Bureau of Standards, 1972.

val chebyt : ?monic:bool -> n:int -> unit -> Py.Object.t

Chebyshev polynomial of the first kind.

Defined to be the solution of

.. math:: (1 - x^2)\fracd^2dx^2T_n - x\fracddxT_n + n^2T_n = 0;

:math:`T_n` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- T : orthopoly1d Chebyshev polynomial of the first kind.

Notes ----- The polynomials :math:`T_n` are orthogonal over :math:`-1, 1` with weight function :math:`(1 - x^2)^

1/2

}

`.

See Also -------- chebyu : Chebyshev polynomial of the second kind.

val chebyu : ?monic:bool -> n:int -> unit -> Py.Object.t

Chebyshev polynomial of the second kind.

Defined to be the solution of

.. math:: (1 - x^2)\fracd^2dx^2U_n - 3x\fracddxU_n

  1. n(n + 2)U_n = 0;

:math:`U_n` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- U : orthopoly1d Chebyshev polynomial of the second kind.

Notes ----- The polynomials :math:`U_n` are orthogonal over :math:`-1, 1` with weight function :math:`(1 - x^2)^

/2

`.

See Also -------- chebyt : Chebyshev polynomial of the first kind.

val cos : ?out: [ `Ndarray of [> `Ndarray ] Np.Obj.t | `Tuple_of_ndarray_and_None of Py.Object.t ] -> ?where:[> `Ndarray ] Np.Obj.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

Cosine element-wise.

Parameters ---------- x : array_like Input array in radians. out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.

Returns ------- y : ndarray The corresponding cosine values. This is a scalar if `x` is a scalar.

Notes ----- If `out` is provided, the function writes the result into it, and returns a reference to `out`. (See Examples)

References ---------- M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. New York, NY: Dover, 1972.

Examples -------- >>> np.cos(np.array(0, np.pi/2, np.pi)) array( 1.00000000e+00, 6.12303177e-17, -1.00000000e+00) >>> >>> # Example of providing the optional output parameter >>> out1 = np.array(0, dtype='d') >>> out2 = np.cos(0.1, out1) >>> out2 is out1 True >>> >>> # Example of ValueError due to provision of shape mis-matched `out` >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) Traceback (most recent call last): File '<stdin>', line 1, in <module> ValueError: operands could not be broadcast together with shapes (3,3) (2,2)

val eval_chebyc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebyc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebyc(n, x, out=None)

Evaluate Chebyshev polynomial of the first kind on -2, 2 at a point.

These polynomials are defined as

.. math::

C_n(x) = 2 T_n(x/2)

where :math:`T_n` is a Chebyshev polynomial of the first kind. See 22.5.11 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyt`. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- C : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebyc : roots and quadrature weights of Chebyshev polynomials of the first kind on -2, 2 chebyc : Chebyshev polynomial object numpy.polynomial.chebyshev.Chebyshev : Chebyshev series eval_chebyt : evaluate Chebycshev polynomials of the first kind

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Examples -------- >>> import scipy.special as sc

They are a scaled version of the Chebyshev polynomials of the first kind.

>>> x = np.linspace(-2, 2, 6) >>> sc.eval_chebyc(3, x) array(-2. , 1.872, 1.136, -1.136, -1.872, 2. ) >>> 2 * sc.eval_chebyt(3, x / 2) array(-2. , 1.872, 1.136, -1.136, -1.872, 2. )

val eval_chebys : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebys(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebys(n, x, out=None)

Evaluate Chebyshev polynomial of the second kind on -2, 2 at a point.

These polynomials are defined as

.. math::

S_n(x) = U_n(x/2)

where :math:`U_n` is a Chebyshev polynomial of the second kind. See 22.5.13 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyu`. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- S : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebys : roots and quadrature weights of Chebyshev polynomials of the second kind on -2, 2 chebys : Chebyshev polynomial object eval_chebyu : evaluate Chebyshev polynomials of the second kind

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Examples -------- >>> import scipy.special as sc

They are a scaled version of the Chebyshev polynomials of the second kind.

>>> x = np.linspace(-2, 2, 6) >>> sc.eval_chebys(3, x) array(-4. , 0.672, 0.736, -0.736, -0.672, 4. ) >>> sc.eval_chebyu(3, x / 2) array(-4. , 0.672, 0.736, -0.736, -0.672, 4. )

val eval_chebyt : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebyt(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebyt(n, x, out=None)

Evaluate Chebyshev polynomial of the first kind at a point.

The Chebyshev polynomials of the first kind can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

T_n(x) = {

}

_2F_1(n, -n; 1/2; (1 - x)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.47 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- T : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebyt : roots and quadrature weights of Chebyshev polynomials of the first kind chebyu : Chebychev polynomial object eval_chebyu : evaluate Chebyshev polynomials of the second kind hyp2f1 : Gauss hypergeometric function numpy.polynomial.chebyshev.Chebyshev : Chebyshev series

Notes ----- This routine is numerically stable for `x` in ``-1, 1`` at least up to order ``10000``.

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_chebyu : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebyu(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebyu(n, x, out=None)

Evaluate Chebyshev polynomial of the second kind at a point.

The Chebyshev polynomials of the second kind can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

U_n(x) = (n + 1) {

}

_2F_1(-n, n + 2; 3/2; (1 - x)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.48 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- U : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebyu : roots and quadrature weights of Chebyshev polynomials of the second kind chebyu : Chebyshev polynomial object eval_chebyt : evaluate Chebyshev polynomials of the first kind hyp2f1 : Gauss hypergeometric function

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_gegenbauer : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_gegenbauer(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_gegenbauer(n, alpha, x, out=None)

Evaluate Gegenbauer polynomial at a point.

The Gegenbauer polynomials can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

C_n^(\alpha) = \frac(2\alpha)_n\Gamma(n + 1) {

}

_2F_1(-n, 2\alpha + n; \alpha + 1/2; (1 - z)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.46 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. alpha : array_like Parameter x : array_like Points at which to evaluate the Gegenbauer polynomial

Returns ------- C : ndarray Values of the Gegenbauer polynomial

See Also -------- roots_gegenbauer : roots and quadrature weights of Gegenbauer polynomials gegenbauer : Gegenbauer polynomial object hyp2f1 : Gauss hypergeometric function

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_genlaguerre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_genlaguerre(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_genlaguerre(n, alpha, x, out=None)

Evaluate generalized Laguerre polynomial at a point.

The generalized Laguerre polynomials can be defined via the confluent hypergeometric function :math:`{

}

_1F_1` as

.. math::

L_n^(\alpha)(x) = \binomn + \alphan {

}

_1F_1(-n, \alpha + 1, x).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.54 in AS_ for details. The Laguerre polynomials are the special case where :math:`\alpha = 0`.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer the result is determined via the relation to the confluent hypergeometric function. alpha : array_like Parameter; must have ``alpha > -1`` x : array_like Points at which to evaluate the generalized Laguerre polynomial

Returns ------- L : ndarray Values of the generalized Laguerre polynomial

See Also -------- roots_genlaguerre : roots and quadrature weights of generalized Laguerre polynomials genlaguerre : generalized Laguerre polynomial object hyp1f1 : confluent hypergeometric function eval_laguerre : evaluate Laguerre polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_hermite : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_hermite(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_hermite(n, x, out=None)

Evaluate physicist's Hermite polynomial at a point.

Defined by

.. math::

H_n(x) = (-1)^n e^x^2 \fracd^ndx^n e^

x^2

}

;

:math:`H_n` is a polynomial of degree :math:`n`. See 22.11.7 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial x : array_like Points at which to evaluate the Hermite polynomial

Returns ------- H : ndarray Values of the Hermite polynomial

See Also -------- roots_hermite : roots and quadrature weights of physicist's Hermite polynomials hermite : physicist's Hermite polynomial object numpy.polynomial.hermite.Hermite : Physicist's Hermite series eval_hermitenorm : evaluate Probabilist's Hermite polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_hermitenorm : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_hermitenorm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_hermitenorm(n, x, out=None)

Evaluate probabilist's (normalized) Hermite polynomial at a point.

Defined by

.. math::

He_n(x) = (-1)^n e^x^2/2 \fracd^ndx^n e^

x^2/2

}

;

:math:`He_n` is a polynomial of degree :math:`n`. See 22.11.8 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial x : array_like Points at which to evaluate the Hermite polynomial

Returns ------- He : ndarray Values of the Hermite polynomial

See Also -------- roots_hermitenorm : roots and quadrature weights of probabilist's Hermite polynomials hermitenorm : probabilist's Hermite polynomial object numpy.polynomial.hermite_e.HermiteE : Probabilist's Hermite series eval_hermite : evaluate physicist's Hermite polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_jacobi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_jacobi(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_jacobi(n, alpha, beta, x, out=None)

Evaluate Jacobi polynomial at a point.

The Jacobi polynomials can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

P_n^(\alpha, \beta)(x) = \frac(\alpha + 1)_n\Gamma(n + 1) {

}

_2F_1(-n, 1 + \alpha + \beta + n; \alpha + 1; (1 - z)/2)

where :math:`(\cdot)_n` is the Pochhammer symbol; see `poch`. When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.42 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer the result is determined via the relation to the Gauss hypergeometric function. alpha : array_like Parameter beta : array_like Parameter x : array_like Points at which to evaluate the polynomial

Returns ------- P : ndarray Values of the Jacobi polynomial

See Also -------- roots_jacobi : roots and quadrature weights of Jacobi polynomials jacobi : Jacobi polynomial object hyp2f1 : Gauss hypergeometric function

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_laguerre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_laguerre(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_laguerre(n, x, out=None)

Evaluate Laguerre polynomial at a point.

The Laguerre polynomials can be defined via the confluent hypergeometric function :math:`{

}

_1F_1` as

.. math::

L_n(x) = {

}

_1F_1(-n, 1, x).

See 22.5.16 and 22.5.54 in AS_ for details. When :math:`n` is an integer the result is a polynomial of degree :math:`n`.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer the result is determined via the relation to the confluent hypergeometric function. x : array_like Points at which to evaluate the Laguerre polynomial

Returns ------- L : ndarray Values of the Laguerre polynomial

See Also -------- roots_laguerre : roots and quadrature weights of Laguerre polynomials laguerre : Laguerre polynomial object numpy.polynomial.laguerre.Laguerre : Laguerre series eval_genlaguerre : evaluate generalized Laguerre polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_legendre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_legendre(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_legendre(n, x, out=None)

Evaluate Legendre polynomial at a point.

The Legendre polynomials can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

P_n(x) = {

}

_2F_1(-n, n + 1; 1; (1 - x)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.49 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. x : array_like Points at which to evaluate the Legendre polynomial

Returns ------- P : ndarray Values of the Legendre polynomial

See Also -------- roots_legendre : roots and quadrature weights of Legendre polynomials legendre : Legendre polynomial object hyp2f1 : Gauss hypergeometric function numpy.polynomial.legendre.Legendre : Legendre series

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_chebyt : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_chebyt(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_chebyt(n, x, out=None)

Evaluate shifted Chebyshev polynomial of the first kind at a point.

These polynomials are defined as

.. math::

T_n^*(x) = T_n(2x - 1)

where :math:`T_n` is a Chebyshev polynomial of the first kind. See 22.5.14 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyt`. x : array_like Points at which to evaluate the shifted Chebyshev polynomial

Returns ------- T : ndarray Values of the shifted Chebyshev polynomial

See Also -------- roots_sh_chebyt : roots and quadrature weights of shifted Chebyshev polynomials of the first kind sh_chebyt : shifted Chebyshev polynomial object eval_chebyt : evaluate Chebyshev polynomials of the first kind numpy.polynomial.chebyshev.Chebyshev : Chebyshev series

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_chebyu : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_chebyu(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_chebyu(n, x, out=None)

Evaluate shifted Chebyshev polynomial of the second kind at a point.

These polynomials are defined as

.. math::

U_n^*(x) = U_n(2x - 1)

where :math:`U_n` is a Chebyshev polynomial of the first kind. See 22.5.15 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyu`. x : array_like Points at which to evaluate the shifted Chebyshev polynomial

Returns ------- U : ndarray Values of the shifted Chebyshev polynomial

See Also -------- roots_sh_chebyu : roots and quadrature weights of shifted Chebychev polynomials of the second kind sh_chebyu : shifted Chebyshev polynomial object eval_chebyu : evaluate Chebyshev polynomials of the second kind

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_jacobi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_jacobi(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_jacobi(n, p, q, x, out=None)

Evaluate shifted Jacobi polynomial at a point.

Defined by

.. math::

G_n^(p, q)(x) = \binom

n + p - 1

n^

1

}

P_n^(p - q, q - 1)(2x - 1),

where :math:`P_n^(\cdot, \cdot)` is the n-th Jacobi polynomial. See 22.5.2 in AS_ for details.

Parameters ---------- n : int Degree of the polynomial. If not an integer, the result is determined via the relation to `binom` and `eval_jacobi`. p : float Parameter q : float Parameter

Returns ------- G : ndarray Values of the shifted Jacobi polynomial.

See Also -------- roots_sh_jacobi : roots and quadrature weights of shifted Jacobi polynomials sh_jacobi : shifted Jacobi polynomial object eval_jacobi : evaluate Jacobi polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_legendre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_legendre(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_legendre(n, x, out=None)

Evaluate shifted Legendre polynomial at a point.

These polynomials are defined as

.. math::

P_n^*(x) = P_n(2x - 1)

where :math:`P_n` is a Legendre polynomial. See 2.2.11 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the value is determined via the relation to `eval_legendre`. x : array_like Points at which to evaluate the shifted Legendre polynomial

Returns ------- P : ndarray Values of the shifted Legendre polynomial

See Also -------- roots_sh_legendre : roots and quadrature weights of shifted Legendre polynomials sh_legendre : shifted Legendre polynomial object eval_legendre : evaluate Legendre polynomials numpy.polynomial.legendre.Legendre : Legendre series

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val exp : ?out: [ `Ndarray of [> `Ndarray ] Np.Obj.t | `Tuple_of_ndarray_and_None of Py.Object.t ] -> ?where:[> `Ndarray ] Np.Obj.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

Calculate the exponential of all elements in the input array.

Parameters ---------- x : array_like Input values. out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.

Returns ------- out : ndarray or scalar Output array, element-wise exponential of `x`. This is a scalar if `x` is a scalar.

See Also -------- expm1 : Calculate ``exp(x) - 1`` for all elements in the array. exp2 : Calculate ``2**x`` for all elements in the array.

Notes ----- The irrational number ``e`` is also known as Euler's number. It is approximately 2.718281, and is the base of the natural logarithm, ``ln`` (this means that, if :math:`x = \ln y = \log_e y`, then :math:`e^x = y`. For real input, ``exp(x)`` is always positive.

For complex arguments, ``x = a + ib``, we can write :math:`e^x = e^a e^b`. The first term, :math:`e^a`, is already known (it is the real argument, described above). The second term, :math:`e^b`, is :math:`\cos b + i \sin b`, a function with magnitude 1 and a periodic phase.

References ---------- .. 1 Wikipedia, 'Exponential function', https://en.wikipedia.org/wiki/Exponential_function .. 2 M. Abramovitz and I. A. Stegun, 'Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables,' Dover, 1964, p. 69, http://www.math.sfu.ca/~cbm/aands/page_69.htm

Examples -------- Plot the magnitude and phase of ``exp(x)`` in the complex plane:

>>> import matplotlib.pyplot as plt

>>> x = np.linspace(-2*np.pi, 2*np.pi, 100) >>> xx = x + 1j * x:, np.newaxis # a + ib over complex plane >>> out = np.exp(xx)

>>> plt.subplot(121) >>> plt.imshow(np.abs(out), ... extent=-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi, cmap='gray') >>> plt.title('Magnitude of exp(x)')

>>> plt.subplot(122) >>> plt.imshow(np.angle(out), ... extent=-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi, cmap='hsv') >>> plt.title('Phase (angle) of exp(x)') >>> plt.show()

val floor : ?out: [ `Ndarray of [> `Ndarray ] Np.Obj.t | `Tuple_of_ndarray_and_None of Py.Object.t ] -> ?where:[> `Ndarray ] Np.Obj.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

Return the floor of the input, element-wise.

The floor of the scalar `x` is the largest integer `i`, such that `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`.

Parameters ---------- x : array_like Input data. out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.

Returns ------- y : ndarray or scalar The floor of each element in `x`. This is a scalar if `x` is a scalar.

See Also -------- ceil, trunc, rint

Notes ----- Some spreadsheet programs calculate the 'floor-towards-zero', in other words ``floor(-2.5) == -2``. NumPy instead uses the definition of `floor` where `floor(-2.5) == -3`.

Examples -------- >>> a = np.array(-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0) >>> np.floor(a) array(-2., -2., -1., 0., 1., 1., 2.)

val gegenbauer : ?monic:bool -> n:int -> alpha:Py.Object.t -> unit -> Py.Object.t

Gegenbauer (ultraspherical) polynomial.

Defined to be the solution of

.. math:: (1 - x^2)\fracd^2dx^2C_n^(\alpha)

  • (2\alpha + 1)x\fracddxC_n^(\alpha)
  1. n(n + 2\alpha)C_n^(\alpha) = 0

for :math:`\alpha > -1/2`; :math:`C_n^(\alpha)` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- C : orthopoly1d Gegenbauer polynomial.

Notes ----- The polynomials :math:`C_n^(\alpha)` are orthogonal over :math:`-1,1` with weight function :math:`(1 - x^2)^(\alpha - 1/2)`.

val genlaguerre : ?monic:bool -> n:int -> alpha:float -> unit -> Py.Object.t

Generalized (associated) Laguerre polynomial.

Defined to be the solution of

.. math:: x\fracd^2dx^2L_n^(\alpha)

  1. (\alpha + 1 - x)\fracddxL_n^(\alpha)
  2. nL_n^(\alpha) = 0,

where :math:`\alpha > -1`; :math:`L_n^(\alpha)` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. alpha : float Parameter, must be greater than -1. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- L : orthopoly1d Generalized Laguerre polynomial.

Notes ----- For fixed :math:`\alpha`, the polynomials :math:`L_n^(\alpha)` are orthogonal over :math:`0, \infty)` with weight function :math:`e^{-x}x^\alpha`. The Laguerre polynomials are the special case where :math:`\alpha = 0`. See Also -------- laguerre : Laguerre polynomial.

val h_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Hermite (physicst's) quadrature.

Compute the sample points and weights for Gauss-Hermite quadrature. The sample points are the roots of the n-th degree Hermite polynomial, :math:`H_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-\infty, \infty` with weight function :math:`w(x) = e^

x^2

}

`. See 22.2.14 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

Notes ----- For small n up to 150 a modified version of the Golub-Welsch algorithm is used. Nodes are computed from the eigenvalue problem and improved by one step of a Newton iteration. The weights are computed from the well-known analytical formula.

For n larger than 150 an optimal asymptotic algorithm is applied which computes nodes and weights in a numerically stable manner. The algorithm has linear runtime making computation for very large n (several thousand or more) feasible.

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.hermite.hermgauss roots_hermitenorm

References ---------- .. townsend.trogdon.olver-2014 Townsend, A. and Trogdon, T. and Olver, S. (2014) *Fast computation of Gauss quadrature nodes and weights on the whole real line*. :arXiv:`1410.5286`. .. townsend.trogdon.olver-2015 Townsend, A. and Trogdon, T. and Olver, S. (2015) *Fast computation of Gauss quadrature nodes and weights on the whole real line*. IMA Journal of Numerical Analysis :doi:`10.1093/imanum/drv002`. .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val he_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Hermite (statistician's) quadrature.

Compute the sample points and weights for Gauss-Hermite quadrature. The sample points are the roots of the n-th degree Hermite polynomial, :math:`He_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-\infty, \infty` with weight function :math:`w(x) = e^

x^2/2

}

`. See 22.2.15 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

Notes ----- For small n up to 150 a modified version of the Golub-Welsch algorithm is used. Nodes are computed from the eigenvalue problem and improved by one step of a Newton iteration. The weights are computed from the well-known analytical formula.

For n larger than 150 an optimal asymptotic algorithm is used which computes nodes and weights in a numerical stable manner. The algorithm has linear runtime making computation for very large n (several thousand or more) feasible.

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.hermite_e.hermegauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val hermite : ?monic:bool -> n:int -> unit -> Py.Object.t

Physicist's Hermite polynomial.

Defined by

.. math::

H_n(x) = (-1)^ne^x^2\fracd^ndx^ne^

x^2

}

;

:math:`H_n` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- H : orthopoly1d Hermite polynomial.

Notes ----- The polynomials :math:`H_n` are orthogonal over :math:`(-\infty, \infty)` with weight function :math:`e^

x^2

}

`.

val hermitenorm : ?monic:bool -> n:int -> unit -> Py.Object.t

Normalized (probabilist's) Hermite polynomial.

Defined by

.. math::

He_n(x) = (-1)^ne^x^2/2\fracd^ndx^ne^

x^2/2

}

;

:math:`He_n` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- He : orthopoly1d Hermite polynomial.

Notes -----

The polynomials :math:`He_n` are orthogonal over :math:`(-\infty, \infty)` with weight function :math:`e^

x^2/2

}

`.

val hstack : [> `Ndarray ] Np.Obj.t list -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Stack arrays in sequence horizontally (column wise).

This is equivalent to concatenation along the second axis, except for 1-D arrays where it concatenates along the first axis. Rebuilds arrays divided by `hsplit`.

This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions `concatenate`, `stack` and `block` provide more general stacking and concatenation operations.

Parameters ---------- tup : sequence of ndarrays The arrays must have the same shape along all but the second axis, except 1-D arrays which can be any length.

Returns ------- stacked : ndarray The array formed by stacking the given arrays.

See Also -------- stack : Join a sequence of arrays along a new axis. vstack : Stack arrays in sequence vertically (row wise). dstack : Stack arrays in sequence depth wise (along third axis). concatenate : Join a sequence of arrays along an existing axis. hsplit : Split array along second axis. block : Assemble arrays from blocks.

Examples -------- >>> a = np.array((1,2,3)) >>> b = np.array((2,3,4)) >>> np.hstack((a,b)) array(1, 2, 3, 2, 3, 4) >>> a = np.array([1],[2],[3]) >>> b = np.array([2],[3],[4]) >>> np.hstack((a,b)) array([1, 2], [2, 3], [3, 4])

val j_roots : ?mu:bool -> n:int -> alpha:float -> beta:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Jacobi quadrature.

Compute the sample points and weights for Gauss-Jacobi quadrature. The sample points are the roots of the n-th degree Jacobi polynomial, :math:`P^\alpha, \beta_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = (1 - x)^\alpha (1 + x)^\beta`. See 22.2.1 in AS_ for details.

Parameters ---------- n : int quadrature order alpha : float alpha must be > -1 beta : float beta must be > -1 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val jacobi : ?monic:bool -> n:int -> alpha:float -> beta:float -> unit -> Py.Object.t

Jacobi polynomial.

Defined to be the solution of

.. math:: (1 - x^2)\fracd^2dx^2P_n^(\alpha, \beta)

  1. (\beta - \alpha - (\alpha + \beta + 2)x) \fracddxP_n^(\alpha, \beta)
  2. n(n + \alpha + \beta + 1)P_n^(\alpha, \beta) = 0

for :math:`\alpha, \beta > -1`; :math:`P_n^(\alpha, \beta)` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. alpha : float Parameter, must be greater than -1. beta : float Parameter, must be greater than -1. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- P : orthopoly1d Jacobi polynomial.

Notes ----- For fixed :math:`\alpha, \beta`, the polynomials :math:`P_n^(\alpha, \beta)` are orthogonal over :math:`-1, 1` with weight function :math:`(1 - x)^\alpha(1 + x)^\beta`.

val js_roots : ?mu:bool -> n:int -> p1:float -> q1:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Jacobi (shifted) quadrature.

Compute the sample points and weights for Gauss-Jacobi (shifted) quadrature. The sample points are the roots of the n-th degree shifted Jacobi polynomial, :math:`G^p,q_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = (1 - x)^p-q x^q-1`. See 22.2.2 in AS_ for details.

Parameters ---------- n : int quadrature order p1 : float (p1 - q1) must be > -1 q1 : float q1 must be > 0 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val l_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Laguerre quadrature.

Compute the sample points and weights for Gauss-Laguerre quadrature. The sample points are the roots of the n-th degree Laguerre polynomial, :math:`L_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, \infty` with weight function :math:`w(x) = e^

x

}

`. See 22.2.13 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.laguerre.laggauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val la_roots : ?mu:bool -> n:int -> alpha:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-generalized Laguerre quadrature.

Compute the sample points and weights for Gauss-generalized Laguerre quadrature. The sample points are the roots of the n-th degree generalized Laguerre polynomial, :math:`L^\alpha_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, \infty` with weight function :math:`w(x) = x^\alpha e^

x

}

`. See 22.3.9 in AS_ for details.

Parameters ---------- n : int quadrature order alpha : float alpha must be > -1 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val laguerre : ?monic:bool -> n:int -> unit -> Py.Object.t

Laguerre polynomial.

Defined to be the solution of

.. math:: x\fracd^2dx^2L_n + (1 - x)\fracddxL_n + nL_n = 0;

:math:`L_n` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- L : orthopoly1d Laguerre Polynomial.

Notes ----- The polynomials :math:`L_n` are orthogonal over :math:`0, \infty)` with weight function :math:`e^{-x}`.

val legendre : ?monic:bool -> n:int -> unit -> Py.Object.t

Legendre polynomial.

Defined to be the solution of

.. math:: \fracddx\left(1 - x^2)\frac{d}{dx}P_n(x)\right

  1. n(n + 1)P_n(x) = 0;

:math:`P_n(x)` is a polynomial of degree :math:`n`.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- P : orthopoly1d Legendre polynomial.

Notes ----- The polynomials :math:`P_n` are orthogonal over :math:`-1, 1` with weight function 1.

Examples -------- Generate the 3rd-order Legendre polynomial 1/2*(5x^3 + 0x^2 - 3x + 0):

>>> from scipy.special import legendre >>> legendre(3) poly1d( 2.5, 0. , -1.5, 0. )

val p_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Legendre quadrature.

Compute the sample points and weights for Gauss-Legendre quadrature. The sample points are the roots of the n-th degree Legendre polynomial :math:`P_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = 1.0`. See 2.2.10 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.legendre.leggauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val poch : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

poch(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

poch(z, m)

Pochhammer symbol.

The Pochhammer symbol (rising factorial) is defined as

.. math::

(z)_m = \frac\Gamma(z + m)\Gamma(z)

For positive integer `m` it reads

.. math::

(z)_m = z (z + 1) ... (z + m - 1)

See dlmf_ for more details.

Parameters ---------- z, m : array_like Real-valued arguments.

Returns ------- scalar or ndarray The value of the function.

References ---------- .. dlmf Nist, Digital Library of Mathematical Functions https://dlmf.nist.gov/5.2#iii

Examples -------- >>> import scipy.special as sc

It is 1 when m is 0.

>>> sc.poch(1, 2, 3, 4, 0) array(1., 1., 1., 1.)

For z equal to 1 it reduces to the factorial function.

>>> sc.poch(1, 5) 120.0 >>> 1 * 2 * 3 * 4 * 5 120

It can be expressed in terms of the Gamma function.

>>> z, m = 3.7, 2.1 >>> sc.poch(z, m) 20.529581933776953 >>> sc.gamma(z + m) / sc.gamma(z) 20.52958193377696

val ps_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Legendre (shifted) quadrature.

Compute the sample points and weights for Gauss-Legendre quadrature. The sample points are the roots of the n-th degree shifted Legendre polynomial :math:`P^*_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = 1.0`. See 2.2.11 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_chebyc : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (first kind) quadrature.

Compute the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the first kind, :math:`C_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-2, 2` with weight function :math:`w(x) = 1 / \sqrt

- (x/2)^2

`. See 22.2.6 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_chebys : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (second kind) quadrature.

Compute the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the second kind, :math:`S_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-2, 2` with weight function :math:`w(x) = \sqrt

- (x/2)^2

`. See 22.2.7 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_chebyt : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (first kind) quadrature.

Computes the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the first kind, :math:`T_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = 1/\sqrt

- x^2

`. See 22.2.4 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.chebyshev.chebgauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_chebyu : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (second kind) quadrature.

Computes the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the second kind, :math:`U_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = \sqrt

- x^2

`. See 22.2.5 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_gegenbauer : ?mu:bool -> n:int -> alpha:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Gegenbauer quadrature.

Compute the sample points and weights for Gauss-Gegenbauer quadrature. The sample points are the roots of the n-th degree Gegenbauer polynomial, :math:`C^\alpha_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = (1 - x^2)^\alpha - 1/2`. See 22.2.3 in AS_ for more details.

Parameters ---------- n : int quadrature order alpha : float alpha must be > -0.5 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_genlaguerre : ?mu:bool -> n:int -> alpha:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-generalized Laguerre quadrature.

Compute the sample points and weights for Gauss-generalized Laguerre quadrature. The sample points are the roots of the n-th degree generalized Laguerre polynomial, :math:`L^\alpha_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, \infty` with weight function :math:`w(x) = x^\alpha e^

x

}

`. See 22.3.9 in AS_ for details.

Parameters ---------- n : int quadrature order alpha : float alpha must be > -1 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_hermite : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Hermite (physicst's) quadrature.

Compute the sample points and weights for Gauss-Hermite quadrature. The sample points are the roots of the n-th degree Hermite polynomial, :math:`H_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-\infty, \infty` with weight function :math:`w(x) = e^

x^2

}

`. See 22.2.14 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

Notes ----- For small n up to 150 a modified version of the Golub-Welsch algorithm is used. Nodes are computed from the eigenvalue problem and improved by one step of a Newton iteration. The weights are computed from the well-known analytical formula.

For n larger than 150 an optimal asymptotic algorithm is applied which computes nodes and weights in a numerically stable manner. The algorithm has linear runtime making computation for very large n (several thousand or more) feasible.

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.hermite.hermgauss roots_hermitenorm

References ---------- .. townsend.trogdon.olver-2014 Townsend, A. and Trogdon, T. and Olver, S. (2014) *Fast computation of Gauss quadrature nodes and weights on the whole real line*. :arXiv:`1410.5286`. .. townsend.trogdon.olver-2015 Townsend, A. and Trogdon, T. and Olver, S. (2015) *Fast computation of Gauss quadrature nodes and weights on the whole real line*. IMA Journal of Numerical Analysis :doi:`10.1093/imanum/drv002`. .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_hermitenorm : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Hermite (statistician's) quadrature.

Compute the sample points and weights for Gauss-Hermite quadrature. The sample points are the roots of the n-th degree Hermite polynomial, :math:`He_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-\infty, \infty` with weight function :math:`w(x) = e^

x^2/2

}

`. See 22.2.15 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

Notes ----- For small n up to 150 a modified version of the Golub-Welsch algorithm is used. Nodes are computed from the eigenvalue problem and improved by one step of a Newton iteration. The weights are computed from the well-known analytical formula.

For n larger than 150 an optimal asymptotic algorithm is used which computes nodes and weights in a numerical stable manner. The algorithm has linear runtime making computation for very large n (several thousand or more) feasible.

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.hermite_e.hermegauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_jacobi : ?mu:bool -> n:int -> alpha:float -> beta:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Jacobi quadrature.

Compute the sample points and weights for Gauss-Jacobi quadrature. The sample points are the roots of the n-th degree Jacobi polynomial, :math:`P^\alpha, \beta_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = (1 - x)^\alpha (1 + x)^\beta`. See 22.2.1 in AS_ for details.

Parameters ---------- n : int quadrature order alpha : float alpha must be > -1 beta : float beta must be > -1 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_laguerre : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Laguerre quadrature.

Compute the sample points and weights for Gauss-Laguerre quadrature. The sample points are the roots of the n-th degree Laguerre polynomial, :math:`L_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, \infty` with weight function :math:`w(x) = e^

x

}

`. See 22.2.13 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.laguerre.laggauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_legendre : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Legendre quadrature.

Compute the sample points and weights for Gauss-Legendre quadrature. The sample points are the roots of the n-th degree Legendre polynomial :math:`P_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = 1.0`. See 2.2.10 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.legendre.leggauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_sh_chebyt : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (first kind, shifted) quadrature.

Compute the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree shifted Chebyshev polynomial of the first kind, :math:`T_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = 1/\sqrtx - x^2`. See 22.2.8 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_sh_chebyu : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (second kind, shifted) quadrature.

Computes the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree shifted Chebyshev polynomial of the second kind, :math:`U_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = \sqrtx - x^2`. See 22.2.9 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_sh_jacobi : ?mu:bool -> n:int -> p1:float -> q1:float -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Jacobi (shifted) quadrature.

Compute the sample points and weights for Gauss-Jacobi (shifted) quadrature. The sample points are the roots of the n-th degree shifted Jacobi polynomial, :math:`G^p,q_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = (1 - x)^p-q x^q-1`. See 22.2.2 in AS_ for details.

Parameters ---------- n : int quadrature order p1 : float (p1 - q1) must be > -1 q1 : float q1 must be > 0 mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val roots_sh_legendre : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Legendre (shifted) quadrature.

Compute the sample points and weights for Gauss-Legendre quadrature. The sample points are the roots of the n-th degree shifted Legendre polynomial :math:`P^*_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = 1.0`. See 2.2.11 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val s_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (second kind) quadrature.

Compute the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the second kind, :math:`S_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-2, 2` with weight function :math:`w(x) = \sqrt

- (x/2)^2

`. See 22.2.7 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val sh_chebyt : ?monic:bool -> n:int -> unit -> Py.Object.t

Shifted Chebyshev polynomial of the first kind.

Defined as :math:`T^*_n(x) = T_n(2x - 1)` for :math:`T_n` the nth Chebyshev polynomial of the first kind.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- T : orthopoly1d Shifted Chebyshev polynomial of the first kind.

Notes ----- The polynomials :math:`T^*_n` are orthogonal over :math:`0, 1` with weight function :math:`(x - x^2)^

1/2

}

`.

val sh_chebyu : ?monic:bool -> n:int -> unit -> Py.Object.t

Shifted Chebyshev polynomial of the second kind.

Defined as :math:`U^*_n(x) = U_n(2x - 1)` for :math:`U_n` the nth Chebyshev polynomial of the second kind.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- U : orthopoly1d Shifted Chebyshev polynomial of the second kind.

Notes ----- The polynomials :math:`U^*_n` are orthogonal over :math:`0, 1` with weight function :math:`(x - x^2)^

/2

`.

val sh_jacobi : ?monic:bool -> n:int -> p:float -> q:float -> unit -> Py.Object.t

Shifted Jacobi polynomial.

Defined by

.. math::

G_n^(p, q)(x) = \binom

n + p - 1

n^

1

}

P_n^(p - q, q - 1)(2x - 1),

where :math:`P_n^(\cdot, \cdot)` is the nth Jacobi polynomial.

Parameters ---------- n : int Degree of the polynomial. p : float Parameter, must have :math:`p > q - 1`. q : float Parameter, must be greater than 0. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- G : orthopoly1d Shifted Jacobi polynomial.

Notes ----- For fixed :math:`p, q`, the polynomials :math:`G_n^(p, q)` are orthogonal over :math:`0, 1` with weight function :math:`(1 - x)^p - qx^q - 1`.

val sh_legendre : ?monic:bool -> n:int -> unit -> Py.Object.t

Shifted Legendre polynomial.

Defined as :math:`P^*_n(x) = P_n(2x - 1)` for :math:`P_n` the nth Legendre polynomial.

Parameters ---------- n : int Degree of the polynomial. monic : bool, optional If `True`, scale the leading coefficient to be 1. Default is `False`.

Returns ------- P : orthopoly1d Shifted Legendre polynomial.

Notes ----- The polynomials :math:`P^*_n` are orthogonal over :math:`0, 1` with weight function 1.

val sin : ?out: [ `Ndarray of [> `Ndarray ] Np.Obj.t | `Tuple_of_ndarray_and_None of Py.Object.t ] -> ?where:[> `Ndarray ] Np.Obj.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

Trigonometric sine, element-wise.

Parameters ---------- x : array_like Angle, in radians (:math:`2 \pi` rad equals 360 degrees). out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.

Returns ------- y : array_like The sine of each element of x. This is a scalar if `x` is a scalar.

See Also -------- arcsin, sinh, cos

Notes ----- The sine is one of the fundamental functions of trigonometry (the mathematical study of triangles). Consider a circle of radius 1 centered on the origin. A ray comes in from the :math:`+x` axis, makes an angle at the origin (measured counter-clockwise from that axis), and departs from the origin. The :math:`y` coordinate of the outgoing ray's intersection with the unit circle is the sine of that angle. It ranges from -1 for :math:`x=3\pi / 2` to +1 for :math:`\pi / 2.` The function has zeroes where the angle is a multiple of :math:`\pi`. Sines of angles between :math:`\pi` and :math:`2\pi` are negative. The numerous properties of the sine and related functions are included in any standard trigonometry text.

Examples -------- Print sine of one angle:

>>> np.sin(np.pi/2.) 1.0

Print sines of an array of angles given in degrees:

>>> np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180. ) array( 0. , 0.5 , 0.70710678, 0.8660254 , 1. )

Plot the sine function:

>>> import matplotlib.pylab as plt >>> x = np.linspace(-np.pi, np.pi, 201) >>> plt.plot(x, np.sin(x)) >>> plt.xlabel('Angle rad') >>> plt.ylabel('sin(x)') >>> plt.axis('tight') >>> plt.show()

val sqrt : ?out: [ `Ndarray of [> `Ndarray ] Np.Obj.t | `Tuple_of_ndarray_and_None of Py.Object.t ] -> ?where:[> `Ndarray ] Np.Obj.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

Return the non-negative square-root of an array, element-wise.

Parameters ---------- x : array_like The values whose square-roots are required. out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`.

Returns ------- y : ndarray An array of the same shape as `x`, containing the positive square-root of each element in `x`. If any element in `x` is complex, a complex array is returned (and the square-roots of negative reals are calculated). If all of the elements in `x` are real, so is `y`, with negative elements returning ``nan``. If `out` was provided, `y` is a reference to it. This is a scalar if `x` is a scalar.

See Also -------- lib.scimath.sqrt A version which returns complex numbers when given negative reals.

Notes ----- *sqrt* has--consistent with common convention--as its branch cut the real 'interval' `-inf`, 0), and is continuous from above on it. A branch cut is a curve in the complex plane across which a given complex function fails to be continuous. Examples -------- >>> np.sqrt([1,4,9]) array([ 1., 2., 3.]) >>> np.sqrt([4, -1, -3+4J]) array([ 2.+0.j, 0.+1.j, 1.+2.j]) >>> np.sqrt([4, -1, np.inf]) array([ 2., nan, inf])

val t_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (first kind) quadrature.

Computes the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the first kind, :math:`T_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = 1/\sqrt

- x^2

`. See 22.2.4 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad numpy.polynomial.chebyshev.chebgauss

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val ts_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (first kind, shifted) quadrature.

Compute the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree shifted Chebyshev polynomial of the first kind, :math:`T_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = 1/\sqrtx - x^2`. See 22.2.8 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val u_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (second kind) quadrature.

Computes the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree Chebyshev polynomial of the second kind, :math:`U_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`-1, 1` with weight function :math:`w(x) = \sqrt

- x^2

`. See 22.2.5 in AS_ for details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val us_roots : ?mu:bool -> n:int -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * float

Gauss-Chebyshev (second kind, shifted) quadrature.

Computes the sample points and weights for Gauss-Chebyshev quadrature. The sample points are the roots of the n-th degree shifted Chebyshev polynomial of the second kind, :math:`U_n(x)`. These sample points and weights correctly integrate polynomials of degree :math:`2n - 1` or less over the interval :math:`0, 1` with weight function :math:`w(x) = \sqrtx - x^2`. See 22.2.9 in AS_ for more details.

Parameters ---------- n : int quadrature order mu : bool, optional If True, return the sum of the weights, optional.

Returns ------- x : ndarray Sample points w : ndarray Weights mu : float Sum of the weights

See Also -------- scipy.integrate.quadrature scipy.integrate.fixed_quad

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

OCaml

Innovation. Community. Security.