doc_content
stringlengths 1
386k
| doc_id
stringlengths 5
188
|
---|---|
numpy.polynomial.hermite.hermdomain polynomial.hermite.hermdomain = array([-1, 1])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite.hermdomain |
numpy.polynomial.hermite.hermfit polynomial.hermite.hermfit(x, y, deg, rcond=None, full=False, w=None)[source]
Least squares fit of Hermite series to data. Return the coefficients of a Hermite series of degree deg that is the least squares fit to the data values y given at points x. If y is 1-D the returned coefficients will also be 1-D. If y is 2-D multiple fits are done, one for each column of y, and the resulting coefficients are stored in the corresponding columns of a 2-D return. The fitted polynomial(s) are in the form \[p(x) = c_0 + c_1 * H_1(x) + ... + c_n * H_n(x),\] where n is deg. Parameters
xarray_like, shape (M,)
x-coordinates of the M sample points (x[i], y[i]).
yarray_like, shape (M,) or (M, K)
y-coordinates of the sample points. Several data sets of sample points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column.
degint or 1-D array_like
Degree(s) of the fitting polynomials. If deg is a single integer all terms up to and including the deg’th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead.
rcondfloat, optional
Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases.
fullbool, optional
Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned.
warray_like, shape (M,), optional
Weights. If not None, the weight w[i] applies to the unsquared residual y[i] - y_hat[i] at x[i]. Ideally the weights are chosen so that the errors of the products w[i]*y[i] all have the same variance. When using inverse-variance weighting, use w[i] = 1/sigma(y[i]). The default value is None. Returns
coefndarray, shape (M,) or (M, K)
Hermite coefficients ordered from low to high. If y was 2-D, the coefficients for the data in column k of y are in column k.
[residuals, rank, singular_values, rcond]list
These values are only returned if full == True residuals – sum of squared residuals of the least squares fit rank – the numerical rank of the scaled Vandermonde matrix singular_values – singular values of the scaled Vandermonde matrix rcond – value of rcond. For more details, see numpy.linalg.lstsq. Warns
RankWarning
The rank of the coefficient matrix in the least-squares fit is deficient. The warning is only raised if full == False. The warnings can be turned off by >>> import warnings
>>> warnings.simplefilter('ignore', np.RankWarning)
See also numpy.polynomial.chebyshev.chebfit
numpy.polynomial.legendre.legfit
numpy.polynomial.laguerre.lagfit
numpy.polynomial.polynomial.polyfit
numpy.polynomial.hermite_e.hermefit
hermval
Evaluates a Hermite series. hermvander
Vandermonde matrix of Hermite series. hermweight
Hermite weight function numpy.linalg.lstsq
Computes a least-squares fit from the matrix. scipy.interpolate.UnivariateSpline
Computes spline fits. Notes The solution is the coefficients of the Hermite series p that minimizes the sum of the weighted squared errors \[E = \sum_j w_j^2 * |y_j - p(x_j)|^2,\] where the \(w_j\) are the weights. This problem is solved by setting up the (typically) overdetermined matrix equation \[V(x) * c = w * y,\] where V is the weighted pseudo Vandermonde matrix of x, c are the coefficients to be solved for, w are the weights, y are the observed values. This equation is then solved using the singular value decomposition of V. If some of the singular values of V are so small that they are neglected, then a RankWarning will be issued. This means that the coefficient values may be poorly determined. Using a lower order fit will usually get rid of the warning. The rcond parameter can also be set to a value smaller than its default, but the resulting fit may be spurious and have large contributions from roundoff error. Fits using Hermite series are probably most useful when the data can be approximated by sqrt(w(x)) * p(x), where w(x) is the Hermite weight. In that case the weight sqrt(w(x[i])) should be used together with data values y[i]/sqrt(w(x[i])). The weight function is available as hermweight. References 1
Wikipedia, “Curve fitting”, https://en.wikipedia.org/wiki/Curve_fitting Examples >>> from numpy.polynomial.hermite import hermfit, hermval
>>> x = np.linspace(-10, 10)
>>> err = np.random.randn(len(x))/10
>>> y = hermval(x, [1, 2, 3]) + err
>>> hermfit(x, y, 2)
array([1.0218, 1.9986, 2.9999]) # may vary | numpy.reference.generated.numpy.polynomial.hermite.hermfit |
numpy.polynomial.hermite.hermfromroots polynomial.hermite.hermfromroots(roots)[source]
Generate a Hermite series with given roots. The function returns the coefficients of the polynomial \[p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),\] in Hermite form, where the r_n are the roots specified in roots. If a zero has multiplicity n, then it must appear in roots n times. For instance, if 2 is a root of multiplicity three and 3 is a root of multiplicity 2, then roots looks something like [2, 2, 2, 3, 3]. The roots can appear in any order. If the returned coefficients are c, then \[p(x) = c_0 + c_1 * H_1(x) + ... + c_n * H_n(x)\] The coefficient of the last term is not generally 1 for monic polynomials in Hermite form. Parameters
rootsarray_like
Sequence containing the roots. Returns
outndarray
1-D array of coefficients. If all roots are real then out is a real array, if some of the roots are complex, then out is complex even if all the coefficients in the result are real (see Examples below). See also numpy.polynomial.polynomial.polyfromroots
numpy.polynomial.legendre.legfromroots
numpy.polynomial.laguerre.lagfromroots
numpy.polynomial.chebyshev.chebfromroots
numpy.polynomial.hermite_e.hermefromroots
Examples >>> from numpy.polynomial.hermite import hermfromroots, hermval
>>> coef = hermfromroots((-1, 0, 1))
>>> hermval((-1, 0, 1), coef)
array([0., 0., 0.])
>>> coef = hermfromroots((-1j, 1j))
>>> hermval((-1j, 1j), coef)
array([0.+0.j, 0.+0.j]) | numpy.reference.generated.numpy.polynomial.hermite.hermfromroots |
numpy.polynomial.hermite.hermgauss polynomial.hermite.hermgauss(deg)[source]
Gauss-Hermite quadrature. Computes the sample points and weights for Gauss-Hermite quadrature. These sample points and weights will correctly integrate polynomials of degree \(2*deg - 1\) or less over the interval \([-\inf, \inf]\) with the weight function \(f(x) = \exp(-x^2)\). Parameters
degint
Number of sample points and weights. It must be >= 1. Returns
xndarray
1-D ndarray containing the sample points.
yndarray
1-D ndarray containing the weights. Notes New in version 1.7.0. The results have only been tested up to degree 100, higher degrees may be problematic. The weights are determined by using the fact that \[w_k = c / (H'_n(x_k) * H_{n-1}(x_k))\] where \(c\) is a constant independent of \(k\) and \(x_k\) is the k’th root of \(H_n\), and then scaling the results to get the right value when integrating 1. | numpy.reference.generated.numpy.polynomial.hermite.hermgauss |
numpy.polynomial.hermite.hermgrid2d polynomial.hermite.hermgrid2d(x, y, c)[source]
Evaluate a 2-D Hermite series on the Cartesian product of x and y. This function returns the values: \[p(a,b) = \sum_{i,j} c_{i,j} * H_i(a) * H_j(b)\] where the points (a, b) consist of all pairs formed by taking a from x and b from y. The resulting points form a grid with x in the first dimension and y in the second. The parameters x and y are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either x and y or their elements must support multiplication and addition both with themselves and with the elements of c. If c has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters
x, yarray_like, compatible objects
The two dimensional series is evaluated at the points in the Cartesian product of x and y. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn’t an ndarray, it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the two dimensional polynomial at points in the Cartesian product of x and y. See also
hermval, hermval2d, hermval3d, hermgrid3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermgrid2d |
numpy.polynomial.hermite.hermgrid3d polynomial.hermite.hermgrid3d(x, y, z, c)[source]
Evaluate a 3-D Hermite series on the Cartesian product of x, y, and z. This function returns the values: \[p(a,b,c) = \sum_{i,j,k} c_{i,j,k} * H_i(a) * H_j(b) * H_k(c)\] where the points (a, b, c) consist of all triples formed by taking a from x, b from y, and c from z. The resulting points form a grid with x in the first dimension, y in the second, and z in the third. The parameters x, y, and z are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either x, y, and z or their elements must support multiplication and addition both with themselves and with the elements of c. If c has fewer than three dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape + y.shape + z.shape. Parameters
x, y, zarray_like, compatible objects
The three dimensional series is evaluated at the points in the Cartesian product of x, y, and z. If x,`y`, or z is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn’t an ndarray, it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the two dimensional polynomial at points in the Cartesian product of x and y. See also
hermval, hermval2d, hermgrid2d, hermval3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermgrid3d |
numpy.polynomial.hermite.hermint polynomial.hermite.hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0)[source]
Integrate a Hermite series. Returns the Hermite series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added. The scaling factor is for use in a linear change of variable. (“Buyer beware”: note that, depending on what one is doing, one may want scl to be the reciprocal of what one might expect; for more information, see the Notes section below.) The argument c is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series H_0 + 2*H_1 + 3*H_2 while [[1,2],[1,2]] represents 1*H_0(x)*H_0(y) + 1*H_1(x)*H_0(y) + 2*H_0(x)*H_1(y) +
2*H_1(x)*H_1(y) if axis=0 is x and axis=1 is y. Parameters
carray_like
Array of Hermite series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index.
mint, optional
Order of integration, must be positive. (Default: 1)
k{[], list, scalar}, optional
Integration constant(s). The value of the first integral at lbnd is the first value in the list, the value of the second integral at lbnd is the second value, etc. If k == [] (the default), all constants are set to zero. If m == 1, a single scalar can be given instead of a list.
lbndscalar, optional
The lower bound of the integral. (Default: 0)
sclscalar, optional
Following each integration the result is multiplied by scl before the integration constant is added. (Default: 1)
axisint, optional
Axis over which the integral is taken. (Default: 0). New in version 1.7.0. Returns
Sndarray
Hermite series coefficients of the integral. Raises
ValueError
If m < 0, len(k) > m, np.ndim(lbnd) != 0, or np.ndim(scl) != 0. See also hermder
Notes Note that the result of each integration is multiplied by scl. Why is this important to note? Say one is making a linear change of variable \(u = ax + b\) in an integral relative to x. Then \(dx = du/a\), so one will need to set scl equal to \(1/a\) - perhaps not what one would have first thought. Also note that, in general, the result of integrating a C-series needs to be “reprojected” onto the C-series basis set. Thus, typically, the result of this function is “unintuitive,” albeit correct; see Examples section below. Examples >>> from numpy.polynomial.hermite import hermint
>>> hermint([1,2,3]) # integrate once, value 0 at 0.
array([1. , 0.5, 0.5, 0.5])
>>> hermint([1,2,3], m=2) # integrate twice, value & deriv 0 at 0
array([-0.5 , 0.5 , 0.125 , 0.08333333, 0.0625 ]) # may vary
>>> hermint([1,2,3], k=1) # integrate once, value 1 at 0.
array([2. , 0.5, 0.5, 0.5])
>>> hermint([1,2,3], lbnd=-1) # integrate once, value 0 at -1
array([-2. , 0.5, 0.5, 0.5])
>>> hermint([1,2,3], m=2, k=[1,2], lbnd=-1)
array([ 1.66666667, -0.5 , 0.125 , 0.08333333, 0.0625 ]) # may vary | numpy.reference.generated.numpy.polynomial.hermite.hermint |
numpy.polynomial.hermite.Hermite.__call__ method polynomial.hermite.Hermite.__call__(arg)[source]
Call self as a function. | numpy.reference.generated.numpy.polynomial.hermite.hermite.__call__ |
numpy.polynomial.hermite.Hermite.basis method classmethod polynomial.hermite.Hermite.basis(deg, domain=None, window=None)[source]
Series basis polynomial of degree deg. Returns the series representing the basis polynomial of degree deg. New in version 1.7.0. Parameters
degint
Degree of the basis polynomial for the series. Must be >= 0.
domain{None, array_like}, optional
If given, the array must be of the form [beg, end], where beg and end are the endpoints of the domain. If None is given then the class domain is used. The default is None.
window{None, array_like}, optional
If given, the resulting array must be if the form [beg, end], where beg and end are the endpoints of the window. If None is given then the class window is used. The default is None. Returns
new_seriesseries
A series with the coefficient of the deg term set to one and all others zero. | numpy.reference.generated.numpy.polynomial.hermite.hermite.basis |
numpy.polynomial.hermite.Hermite.cast method classmethod polynomial.hermite.Hermite.cast(series, domain=None, window=None)[source]
Convert series to series of this class. The series is expected to be an instance of some polynomial series of one of the types supported by by the numpy.polynomial module, but could be some other class that supports the convert method. New in version 1.7.0. Parameters
seriesseries
The series instance to be converted.
domain{None, array_like}, optional
If given, the array must be of the form [beg, end], where beg and end are the endpoints of the domain. If None is given then the class domain is used. The default is None.
window{None, array_like}, optional
If given, the resulting array must be if the form [beg, end], where beg and end are the endpoints of the window. If None is given then the class window is used. The default is None. Returns
new_seriesseries
A series of the same kind as the calling class and equal to series when evaluated. See also convert
similar instance method | numpy.reference.generated.numpy.polynomial.hermite.hermite.cast |
numpy.polynomial.hermite.Hermite.convert method polynomial.hermite.Hermite.convert(domain=None, kind=None, window=None)[source]
Convert series to a different kind and/or domain and/or window. Parameters
domainarray_like, optional
The domain of the converted series. If the value is None, the default domain of kind is used.
kindclass, optional
The polynomial series type class to which the current instance should be converted. If kind is None, then the class of the current instance is used.
windowarray_like, optional
The window of the converted series. If the value is None, the default window of kind is used. Returns
new_seriesseries
The returned class can be of different type than the current instance and/or have a different domain and/or different window. Notes Conversion between domains and class types can result in numerically ill defined series. | numpy.reference.generated.numpy.polynomial.hermite.hermite.convert |
numpy.polynomial.hermite.Hermite.copy method polynomial.hermite.Hermite.copy()[source]
Return a copy. Returns
new_seriesseries
Copy of self. | numpy.reference.generated.numpy.polynomial.hermite.hermite.copy |
numpy.polynomial.hermite.Hermite.cutdeg method polynomial.hermite.Hermite.cutdeg(deg)[source]
Truncate series to the given degree. Reduce the degree of the series to deg by discarding the high order terms. If deg is greater than the current degree a copy of the current series is returned. This can be useful in least squares where the coefficients of the high degree terms may be very small. New in version 1.5.0. Parameters
degnon-negative int
The series is reduced to degree deg by discarding the high order terms. The value of deg must be a non-negative integer. Returns
new_seriesseries
New instance of series with reduced degree. | numpy.reference.generated.numpy.polynomial.hermite.hermite.cutdeg |
numpy.polynomial.hermite.Hermite.degree method polynomial.hermite.Hermite.degree()[source]
The degree of the series. New in version 1.5.0. Returns
degreeint
Degree of the series, one less than the number of coefficients. | numpy.reference.generated.numpy.polynomial.hermite.hermite.degree |
numpy.polynomial.hermite.Hermite.deriv method polynomial.hermite.Hermite.deriv(m=1)[source]
Differentiate. Return a series instance of that is the derivative of the current series. Parameters
mnon-negative int
Find the derivative of order m. Returns
new_seriesseries
A new series representing the derivative. The domain is the same as the domain of the differentiated series. | numpy.reference.generated.numpy.polynomial.hermite.hermite.deriv |
numpy.polynomial.hermite.Hermite.domain attribute polynomial.hermite.Hermite.domain = array([-1, 1]) | numpy.reference.generated.numpy.polynomial.hermite.hermite.domain |
numpy.polynomial.hermite.Hermite.fit method classmethod polynomial.hermite.Hermite.fit(x, y, deg, domain=None, rcond=None, full=False, w=None, window=None)[source]
Least squares fit to data. Return a series instance that is the least squares fit to the data y sampled at x. The domain of the returned instance can be specified and this will often result in a superior fit with less chance of ill conditioning. Parameters
xarray_like, shape (M,)
x-coordinates of the M sample points (x[i], y[i]).
yarray_like, shape (M,)
y-coordinates of the M sample points (x[i], y[i]).
degint or 1-D array_like
Degree(s) of the fitting polynomials. If deg is a single integer all terms up to and including the deg’th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead.
domain{None, [beg, end], []}, optional
Domain to use for the returned series. If None, then a minimal domain that covers the points x is chosen. If [] the class domain is used. The default value was the class domain in NumPy 1.4 and None in later versions. The [] option was added in numpy 1.5.0.
rcondfloat, optional
Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases.
fullbool, optional
Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned.
warray_like, shape (M,), optional
Weights. If not None, the weight w[i] applies to the unsquared residual y[i] - y_hat[i] at x[i]. Ideally the weights are chosen so that the errors of the products w[i]*y[i] all have the same variance. When using inverse-variance weighting, use w[i] = 1/sigma(y[i]). The default value is None. New in version 1.5.0.
window{[beg, end]}, optional
Window to use for the returned series. The default value is the default class domain New in version 1.6.0. Returns
new_seriesseries
A series that represents the least squares fit to the data and has the domain and window specified in the call. If the coefficients for the unscaled and unshifted basis polynomials are of interest, do new_series.convert().coef.
[resid, rank, sv, rcond]list
These values are only returned if full == True resid – sum of squared residuals of the least squares fit rank – the numerical rank of the scaled Vandermonde matrix sv – singular values of the scaled Vandermonde matrix rcond – value of rcond. For more details, see linalg.lstsq. | numpy.reference.generated.numpy.polynomial.hermite.hermite.fit |
numpy.polynomial.hermite.Hermite.fromroots method classmethod polynomial.hermite.Hermite.fromroots(roots, domain=[], window=None)[source]
Return series instance that has the specified roots. Returns a series representing the product (x - r[0])*(x - r[1])*...*(x - r[n-1]), where r is a list of roots. Parameters
rootsarray_like
List of roots.
domain{[], None, array_like}, optional
Domain for the resulting series. If None the domain is the interval from the smallest root to the largest. If [] the domain is the class domain. The default is [].
window{None, array_like}, optional
Window for the returned series. If None the class window is used. The default is None. Returns
new_seriesseries
Series with the specified roots. | numpy.reference.generated.numpy.polynomial.hermite.hermite.fromroots |
numpy.polynomial.hermite.Hermite.has_samecoef method polynomial.hermite.Hermite.has_samecoef(other)[source]
Check if coefficients match. New in version 1.6.0. Parameters
otherclass instance
The other class must have the coef attribute. Returns
boolboolean
True if the coefficients are the same, False otherwise. | numpy.reference.generated.numpy.polynomial.hermite.hermite.has_samecoef |
numpy.polynomial.hermite.Hermite.has_samedomain method polynomial.hermite.Hermite.has_samedomain(other)[source]
Check if domains match. New in version 1.6.0. Parameters
otherclass instance
The other class must have the domain attribute. Returns
boolboolean
True if the domains are the same, False otherwise. | numpy.reference.generated.numpy.polynomial.hermite.hermite.has_samedomain |
numpy.polynomial.hermite.Hermite.has_sametype method polynomial.hermite.Hermite.has_sametype(other)[source]
Check if types match. New in version 1.7.0. Parameters
otherobject
Class instance. Returns
boolboolean
True if other is same class as self | numpy.reference.generated.numpy.polynomial.hermite.hermite.has_sametype |
numpy.polynomial.hermite.Hermite.has_samewindow method polynomial.hermite.Hermite.has_samewindow(other)[source]
Check if windows match. New in version 1.6.0. Parameters
otherclass instance
The other class must have the window attribute. Returns
boolboolean
True if the windows are the same, False otherwise. | numpy.reference.generated.numpy.polynomial.hermite.hermite.has_samewindow |
numpy.polynomial.hermite.Hermite.identity method classmethod polynomial.hermite.Hermite.identity(domain=None, window=None)[source]
Identity function. If p is the returned series, then p(x) == x for all values of x. Parameters
domain{None, array_like}, optional
If given, the array must be of the form [beg, end], where beg and end are the endpoints of the domain. If None is given then the class domain is used. The default is None.
window{None, array_like}, optional
If given, the resulting array must be if the form [beg, end], where beg and end are the endpoints of the window. If None is given then the class window is used. The default is None. Returns
new_seriesseries
Series of representing the identity. | numpy.reference.generated.numpy.polynomial.hermite.hermite.identity |
numpy.polynomial.hermite.Hermite.integ method polynomial.hermite.Hermite.integ(m=1, k=[], lbnd=None)[source]
Integrate. Return a series instance that is the definite integral of the current series. Parameters
mnon-negative int
The number of integrations to perform.
karray_like
Integration constants. The first constant is applied to the first integration, the second to the second, and so on. The list of values must less than or equal to m in length and any missing values are set to zero.
lbndScalar
The lower bound of the definite integral. Returns
new_seriesseries
A new series representing the integral. The domain is the same as the domain of the integrated series. | numpy.reference.generated.numpy.polynomial.hermite.hermite.integ |
numpy.polynomial.hermite.Hermite.linspace method polynomial.hermite.Hermite.linspace(n=100, domain=None)[source]
Return x, y values at equally spaced points in domain. Returns the x, y values at n linearly spaced points across the domain. Here y is the value of the polynomial at the points x. By default the domain is the same as that of the series instance. This method is intended mostly as a plotting aid. New in version 1.5.0. Parameters
nint, optional
Number of point pairs to return. The default value is 100.
domain{None, array_like}, optional
If not None, the specified domain is used instead of that of the calling instance. It should be of the form [beg,end]. The default is None which case the class domain is used. Returns
x, yndarray
x is equal to linspace(self.domain[0], self.domain[1], n) and y is the series evaluated at element of x. | numpy.reference.generated.numpy.polynomial.hermite.hermite.linspace |
numpy.polynomial.hermite.Hermite.mapparms method polynomial.hermite.Hermite.mapparms()[source]
Return the mapping parameters. The returned values define a linear map off + scl*x that is applied to the input arguments before the series is evaluated. The map depends on the domain and window; if the current domain is equal to the window the resulting map is the identity. If the coefficients of the series instance are to be used by themselves outside this class, then the linear function must be substituted for the x in the standard representation of the base polynomials. Returns
off, sclfloat or complex
The mapping function is defined by off + scl*x. Notes If the current domain is the interval [l1, r1] and the window is [l2, r2], then the linear mapping function L is defined by the equations: L(l1) = l2
L(r1) = r2 | numpy.reference.generated.numpy.polynomial.hermite.hermite.mapparms |
numpy.polynomial.hermite.Hermite.roots method polynomial.hermite.Hermite.roots()[source]
Return the roots of the series polynomial. Compute the roots for the series. Note that the accuracy of the roots decrease the further outside the domain they lie. Returns
rootsndarray
Array containing the roots of the series. | numpy.reference.generated.numpy.polynomial.hermite.hermite.roots |
numpy.polynomial.hermite.Hermite.trim method polynomial.hermite.Hermite.trim(tol=0)[source]
Remove trailing coefficients Remove trailing coefficients until a coefficient is reached whose absolute value greater than tol or the beginning of the series is reached. If all the coefficients would be removed the series is set to [0]. A new series instance is returned with the new coefficients. The current instance remains unchanged. Parameters
tolnon-negative number.
All trailing coefficients less than tol will be removed. Returns
new_seriesseries
New instance of series with trimmed coefficients. | numpy.reference.generated.numpy.polynomial.hermite.hermite.trim |
numpy.polynomial.hermite.Hermite.truncate method polynomial.hermite.Hermite.truncate(size)[source]
Truncate series to length size. Reduce the series to length size by discarding the high degree terms. The value of size must be a positive integer. This can be useful in least squares where the coefficients of the high degree terms may be very small. Parameters
sizepositive int
The series is reduced to length size by discarding the high degree terms. The value of size must be a positive integer. Returns
new_seriesseries
New instance of series with truncated coefficients. | numpy.reference.generated.numpy.polynomial.hermite.hermite.truncate |
numpy.polynomial.hermite.hermline polynomial.hermite.hermline(off, scl)[source]
Hermite series whose graph is a straight line. Parameters
off, sclscalars
The specified line is given by off + scl*x. Returns
yndarray
This module’s representation of the Hermite series for off + scl*x. See also numpy.polynomial.polynomial.polyline
numpy.polynomial.chebyshev.chebline
numpy.polynomial.legendre.legline
numpy.polynomial.laguerre.lagline
numpy.polynomial.hermite_e.hermeline
Examples >>> from numpy.polynomial.hermite import hermline, hermval
>>> hermval(0,hermline(3, 2))
3.0
>>> hermval(1,hermline(3, 2))
5.0 | numpy.reference.generated.numpy.polynomial.hermite.hermline |
numpy.polynomial.hermite.hermmul polynomial.hermite.hermmul(c1, c2)[source]
Multiply one Hermite series by another. Returns the product of two Hermite series c1 * c2. The arguments are sequences of coefficients, from lowest order “term” to highest, e.g., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. Parameters
c1, c2array_like
1-D arrays of Hermite series coefficients ordered from low to high. Returns
outndarray
Of Hermite series coefficients representing their product. See also
hermadd, hermsub, hermmulx, hermdiv, hermpow
Notes In general, the (polynomial) product of two C-series results in terms that are not in the Hermite polynomial basis set. Thus, to express the product as a Hermite series, it is necessary to “reproject” the product onto said basis set, which may produce “unintuitive” (but correct) results; see Examples section below. Examples >>> from numpy.polynomial.hermite import hermmul
>>> hermmul([1, 2, 3], [0, 1, 2])
array([52., 29., 52., 7., 6.]) | numpy.reference.generated.numpy.polynomial.hermite.hermmul |
numpy.polynomial.hermite.hermmulx polynomial.hermite.hermmulx(c)[source]
Multiply a Hermite series by x. Multiply the Hermite series c by x, where x is the independent variable. Parameters
carray_like
1-D array of Hermite series coefficients ordered from low to high. Returns
outndarray
Array representing the result of the multiplication. See also
hermadd, hermsub, hermmul, hermdiv, hermpow
Notes The multiplication uses the recursion relationship for Hermite polynomials in the form \[xP_i(x) = (P_{i + 1}(x)/2 + i*P_{i - 1}(x))\] Examples >>> from numpy.polynomial.hermite import hermmulx
>>> hermmulx([1, 2, 3])
array([2. , 6.5, 1. , 1.5]) | numpy.reference.generated.numpy.polynomial.hermite.hermmulx |
numpy.polynomial.hermite.hermone polynomial.hermite.hermone = array([1])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite.hermone |
numpy.polynomial.hermite.hermpow polynomial.hermite.hermpow(c, pow, maxpower=16)[source]
Raise a Hermite series to a power. Returns the Hermite series c raised to the power pow. The argument c is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series P_0 + 2*P_1 + 3*P_2. Parameters
carray_like
1-D array of Hermite series coefficients ordered from low to high.
powinteger
Power to which the series will be raised
maxpowerinteger, optional
Maximum power allowed. This is mainly to limit growth of the series to unmanageable size. Default is 16 Returns
coefndarray
Hermite series of power. See also
hermadd, hermsub, hermmulx, hermmul, hermdiv
Examples >>> from numpy.polynomial.hermite import hermpow
>>> hermpow([1, 2, 3], 2)
array([81., 52., 82., 12., 9.]) | numpy.reference.generated.numpy.polynomial.hermite.hermpow |
numpy.polynomial.hermite.hermroots polynomial.hermite.hermroots(c)[source]
Compute the roots of a Hermite series. Return the roots (a.k.a. “zeros”) of the polynomial \[p(x) = \sum_i c[i] * H_i(x).\] Parameters
c1-D array_like
1-D array of coefficients. Returns
outndarray
Array of the roots of the series. If all the roots are real, then out is also real, otherwise it is complex. See also numpy.polynomial.polynomial.polyroots
numpy.polynomial.legendre.legroots
numpy.polynomial.laguerre.lagroots
numpy.polynomial.chebyshev.chebroots
numpy.polynomial.hermite_e.hermeroots
Notes The root estimates are obtained as the eigenvalues of the companion matrix, Roots far from the origin of the complex plane may have large errors due to the numerical instability of the series for such values. Roots with multiplicity greater than 1 will also show larger errors as the value of the series near such points is relatively insensitive to errors in the roots. Isolated roots near the origin can be improved by a few iterations of Newton’s method. The Hermite series basis polynomials aren’t powers of x so the results of this function may seem unintuitive. Examples >>> from numpy.polynomial.hermite import hermroots, hermfromroots
>>> coef = hermfromroots([-1, 0, 1])
>>> coef
array([0. , 0.25 , 0. , 0.125])
>>> hermroots(coef)
array([-1.00000000e+00, -1.38777878e-17, 1.00000000e+00]) | numpy.reference.generated.numpy.polynomial.hermite.hermroots |
numpy.polynomial.hermite.hermsub polynomial.hermite.hermsub(c1, c2)[source]
Subtract one Hermite series from another. Returns the difference of two Hermite series c1 - c2. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. Parameters
c1, c2array_like
1-D arrays of Hermite series coefficients ordered from low to high. Returns
outndarray
Of Hermite series coefficients representing their difference. See also
hermadd, hermmulx, hermmul, hermdiv, hermpow
Notes Unlike multiplication, division, etc., the difference of two Hermite series is a Hermite series (without having to “reproject” the result onto the basis set) so subtraction, just like that of “standard” polynomials, is simply “component-wise.” Examples >>> from numpy.polynomial.hermite import hermsub
>>> hermsub([1, 2, 3, 4], [1, 2, 3])
array([0., 0., 0., 4.]) | numpy.reference.generated.numpy.polynomial.hermite.hermsub |
numpy.polynomial.hermite.hermtrim polynomial.hermite.hermtrim(c, tol=0)[source]
Remove “small” “trailing” coefficients from a polynomial. “Small” means “small in absolute value” and is controlled by the parameter tol; “trailing” means highest order coefficient(s), e.g., in [0, 1, 1, 0, 0] (which represents 0 + x + x**2 + 0*x**3 + 0*x**4) both the 3-rd and 4-th order coefficients would be “trimmed.” Parameters
carray_like
1-d array of coefficients, ordered from lowest order to highest.
tolnumber, optional
Trailing (i.e., highest order) elements with absolute value less than or equal to tol (default value is zero) are removed. Returns
trimmedndarray
1-d array with trailing zeros removed. If the resulting series would be empty, a series containing a single zero is returned. Raises
ValueError
If tol < 0 See also trimseq
Examples >>> from numpy.polynomial import polyutils as pu
>>> pu.trimcoef((0,0,3,0,5,0,0))
array([0., 0., 3., 0., 5.])
>>> pu.trimcoef((0,0,1e-3,0,1e-5,0,0),1e-3) # item == tol is trimmed
array([0.])
>>> i = complex(0,1) # works for complex
>>> pu.trimcoef((3e-4,1e-3*(1-i),5e-4,2e-5*(1+i)), 1e-3)
array([0.0003+0.j , 0.001 -0.001j]) | numpy.reference.generated.numpy.polynomial.hermite.hermtrim |
numpy.polynomial.hermite.hermval polynomial.hermite.hermval(x, c, tensor=True)[source]
Evaluate an Hermite series at points x. If c is of length n + 1, this function returns the value: \[p(x) = c_0 * H_0(x) + c_1 * H_1(x) + ... + c_n * H_n(x)\] The parameter x is converted to an array only if it is a tuple or a list, otherwise it is treated as a scalar. In either case, either x or its elements must support multiplication and addition both with themselves and with the elements of c. If c is a 1-D array, then p(x) will have the same shape as x. If c is multidimensional, then the shape of the result depends on the value of tensor. If tensor is true the shape will be c.shape[1:] + x.shape. If tensor is false the shape will be c.shape[1:]. Note that scalars have shape (,). Trailing zeros in the coefficients will be used in the evaluation, so they should be avoided if efficiency is a concern. Parameters
xarray_like, compatible object
If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, x or its elements must support addition and multiplication with with themselves and with the elements of c.
carray_like
Array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the coefficients may be thought of as stored in the columns of c.
tensorboolean, optional
If True, the shape of the coefficient array is extended with ones on the right, one for each dimension of x. Scalars have dimension 0 for this action. The result is that every column of coefficients in c is evaluated for every element of x. If False, x is broadcast over the columns of c for the evaluation. This keyword is useful when c is multidimensional. The default value is True. New in version 1.7.0. Returns
valuesndarray, algebra_like
The shape of the return value is described above. See also
hermval2d, hermgrid2d, hermval3d, hermgrid3d
Notes The evaluation uses Clenshaw recursion, aka synthetic division. Examples >>> from numpy.polynomial.hermite import hermval
>>> coef = [1,2,3]
>>> hermval(1, coef)
11.0
>>> hermval([[1,2],[3,4]], coef)
array([[ 11., 51.],
[115., 203.]]) | numpy.reference.generated.numpy.polynomial.hermite.hermval |
numpy.polynomial.hermite.hermval2d polynomial.hermite.hermval2d(x, y, c)[source]
Evaluate a 2-D Hermite series at points (x, y). This function returns the values: \[p(x,y) = \sum_{i,j} c_{i,j} * H_i(x) * H_j(y)\] The parameters x and y are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either x and y or their elements must support multiplication and addition both with themselves and with the elements of c. If c is a 1-D array a one is implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters
x, yarray_like, compatible objects
The two dimensional series is evaluated at the points (x, y), where x and y must have the same shape. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn’t an ndarray it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficient of the term of multi-degree i,j is contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the two dimensional polynomial at points formed with pairs of corresponding values from x and y. See also
hermval, hermgrid2d, hermval3d, hermgrid3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermval2d |
numpy.polynomial.hermite.hermval3d polynomial.hermite.hermval3d(x, y, z, c)[source]
Evaluate a 3-D Hermite series at points (x, y, z). This function returns the values: \[p(x,y,z) = \sum_{i,j,k} c_{i,j,k} * H_i(x) * H_j(y) * H_k(z)\] The parameters x, y, and z are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either x, y, and z or their elements must support multiplication and addition both with themselves and with the elements of c. If c has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. Parameters
x, y, zarray_like, compatible object
The three dimensional series is evaluated at the points (x, y, z), where x, y, and z must have the same shape. If any of x, y, or z is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn’t an ndarray it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficient of the term of multi-degree i,j,k is contained in c[i,j,k]. If c has dimension greater than 3 the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the multidimensional polynomial on points formed with triples of corresponding values from x, y, and z. See also
hermval, hermval2d, hermgrid2d, hermgrid3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermval3d |
numpy.polynomial.hermite.hermvander polynomial.hermite.hermvander(x, deg)[source]
Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree deg and sample points x. The pseudo-Vandermonde matrix is defined by \[V[..., i] = H_i(x),\] where 0 <= i <= deg. The leading indices of V index the elements of x and the last index is the degree of the Hermite polynomial. If c is a 1-D array of coefficients of length n + 1 and V is the array V = hermvander(x, n), then np.dot(V, c) and hermval(x, c) are the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of Hermite series of the same degree and sample points. Parameters
xarray_like
Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If x is scalar it is converted to a 1-D array.
degint
Degree of the resulting matrix. Returns
vanderndarray
The pseudo-Vandermonde matrix. The shape of the returned matrix is x.shape + (deg + 1,), where The last index is the degree of the corresponding Hermite polynomial. The dtype will be the same as the converted x. Examples >>> from numpy.polynomial.hermite import hermvander
>>> x = np.array([-1, 0, 1])
>>> hermvander(x, 3)
array([[ 1., -2., 2., 4.],
[ 1., 0., -2., -0.],
[ 1., 2., 2., -4.]]) | numpy.reference.generated.numpy.polynomial.hermite.hermvander |
numpy.polynomial.hermite.hermvander2d polynomial.hermite.hermvander2d(x, y, deg)[source]
Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees deg and sample points (x, y). The pseudo-Vandermonde matrix is defined by \[V[..., (deg[1] + 1)*i + j] = H_i(x) * H_j(y),\] where 0 <= i <= deg[0] and 0 <= j <= deg[1]. The leading indices of V index the points (x, y) and the last index encodes the degrees of the Hermite polynomials. If V = hermvander2d(x, y, [xdeg, ydeg]), then the columns of V correspond to the elements of a 2-D coefficient array c of shape (xdeg + 1, ydeg + 1) in the order \[c_{00}, c_{01}, c_{02} ... , c_{10}, c_{11}, c_{12} ...\] and np.dot(V, c.flat) and hermval2d(x, y, c) will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 2-D Hermite series of the same degrees and sample points. Parameters
x, yarray_like
Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays.
deglist of ints
List of maximum degrees of the form [x_deg, y_deg]. Returns
vander2dndarray
The shape of the returned matrix is x.shape + (order,), where \(order = (deg[0]+1)*(deg[1]+1)\). The dtype will be the same as the converted x and y. See also
hermvander, hermvander3d, hermval2d, hermval3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermvander2d |
numpy.polynomial.hermite.hermvander3d polynomial.hermite.hermvander3d(x, y, z, deg)[source]
Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees deg and sample points (x, y, z). If l, m, n are the given degrees in x, y, z, then The pseudo-Vandermonde matrix is defined by \[V[..., (m+1)(n+1)i + (n+1)j + k] = H_i(x)*H_j(y)*H_k(z),\] where 0 <= i <= l, 0 <= j <= m, and 0 <= j <= n. The leading indices of V index the points (x, y, z) and the last index encodes the degrees of the Hermite polynomials. If V = hermvander3d(x, y, z, [xdeg, ydeg, zdeg]), then the columns of V correspond to the elements of a 3-D coefficient array c of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order \[c_{000}, c_{001}, c_{002},... , c_{010}, c_{011}, c_{012},...\] and np.dot(V, c.flat) and hermval3d(x, y, z, c) will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D Hermite series of the same degrees and sample points. Parameters
x, y, zarray_like
Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays.
deglist of ints
List of maximum degrees of the form [x_deg, y_deg, z_deg]. Returns
vander3dndarray
The shape of the returned matrix is x.shape + (order,), where \(order = (deg[0]+1)*(deg[1]+1)*(deg[2]+1)\). The dtype will be the same as the converted x, y, and z. See also
hermvander, hermvander3d, hermval2d, hermval3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermvander3d |
numpy.polynomial.hermite.hermweight polynomial.hermite.hermweight(x)[source]
Weight function of the Hermite polynomials. The weight function is \(\exp(-x^2)\) and the interval of integration is \([-\inf, \inf]\). the Hermite polynomials are orthogonal, but not normalized, with respect to this weight function. Parameters
xarray_like
Values at which the weight function will be computed. Returns
wndarray
The weight function at x. Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite.hermweight |
numpy.polynomial.hermite.hermx polynomial.hermite.hermx = array([0. , 0.5])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite.hermx |
numpy.polynomial.hermite.hermzero polynomial.hermite.hermzero = array([0])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite.hermzero |
numpy.polynomial.hermite.poly2herm polynomial.hermite.poly2herm(pol)[source]
Convert a polynomial to a Hermite series. Convert an array representing the coefficients of a polynomial (relative to the “standard” basis) ordered from lowest degree to highest, to an array of the coefficients of the equivalent Hermite series, ordered from lowest to highest degree. Parameters
polarray_like
1-D array containing the polynomial coefficients Returns
cndarray
1-D array containing the coefficients of the equivalent Hermite series. See also herm2poly
Notes The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples >>> from numpy.polynomial.hermite import poly2herm
>>> poly2herm(np.arange(4))
array([1. , 2.75 , 0.5 , 0.375]) | numpy.reference.generated.numpy.polynomial.hermite.poly2herm |
numpy.polynomial.hermite_e.herme2poly polynomial.hermite_e.herme2poly(c)[source]
Convert a Hermite series to a polynomial. Convert an array representing the coefficients of a Hermite series, ordered from lowest degree to highest, to an array of the coefficients of the equivalent polynomial (relative to the “standard” basis) ordered from lowest to highest degree. Parameters
carray_like
1-D array containing the Hermite series coefficients, ordered from lowest order term to highest. Returns
polndarray
1-D array containing the coefficients of the equivalent polynomial (relative to the “standard” basis) ordered from lowest order term to highest. See also poly2herme
Notes The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples >>> from numpy.polynomial.hermite_e import herme2poly
>>> herme2poly([ 2., 10., 2., 3.])
array([0., 1., 2., 3.]) | numpy.reference.generated.numpy.polynomial.hermite_e.herme2poly |
numpy.polynomial.hermite_e.hermeadd polynomial.hermite_e.hermeadd(c1, c2)[source]
Add one Hermite series to another. Returns the sum of two Hermite series c1 + c2. The arguments are sequences of coefficients ordered from lowest order term to highest, i.e., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. Parameters
c1, c2array_like
1-D arrays of Hermite series coefficients ordered from low to high. Returns
outndarray
Array representing the Hermite series of their sum. See also
hermesub, hermemulx, hermemul, hermediv, hermepow
Notes Unlike multiplication, division, etc., the sum of two Hermite series is a Hermite series (without having to “reproject” the result onto the basis set) so addition, just like that of “standard” polynomials, is simply “component-wise.” Examples >>> from numpy.polynomial.hermite_e import hermeadd
>>> hermeadd([1, 2, 3], [1, 2, 3, 4])
array([2., 4., 6., 4.]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermeadd |
numpy.polynomial.hermite_e.hermecompanion polynomial.hermite_e.hermecompanion(c)[source]
Return the scaled companion matrix of c. The basis polynomials are scaled so that the companion matrix is symmetric when c is an HermiteE basis polynomial. This provides better eigenvalue estimates than the unscaled case and for basis polynomials the eigenvalues are guaranteed to be real if numpy.linalg.eigvalsh is used to obtain them. Parameters
carray_like
1-D array of HermiteE series coefficients ordered from low to high degree. Returns
matndarray
Scaled companion matrix of dimensions (deg, deg). Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermecompanion |
numpy.polynomial.hermite_e.hermeder polynomial.hermite_e.hermeder(c, m=1, scl=1, axis=0)[source]
Differentiate a Hermite_e series. Returns the series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl (the scaling factor is for use in a linear change of variable). The argument c is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series 1*He_0 + 2*He_1 + 3*He_2 while [[1,2],[1,2]] represents 1*He_0(x)*He_0(y) + 1*He_1(x)*He_0(y)
+ 2*He_0(x)*He_1(y) + 2*He_1(x)*He_1(y) if axis=0 is x and axis=1 is y. Parameters
carray_like
Array of Hermite_e series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index.
mint, optional
Number of derivatives taken, must be non-negative. (Default: 1)
sclscalar, optional
Each differentiation is multiplied by scl. The end result is multiplication by scl**m. This is for use in a linear change of variable. (Default: 1)
axisint, optional
Axis over which the derivative is taken. (Default: 0). New in version 1.7.0. Returns
derndarray
Hermite series of the derivative. See also hermeint
Notes In general, the result of differentiating a Hermite series does not resemble the same operation on a power series. Thus the result of this function may be “unintuitive,” albeit correct; see Examples section below. Examples >>> from numpy.polynomial.hermite_e import hermeder
>>> hermeder([ 1., 1., 1., 1.])
array([1., 2., 3.])
>>> hermeder([-0.25, 1., 1./2., 1./3., 1./4 ], m=2)
array([1., 2., 3.]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermeder |
numpy.polynomial.hermite_e.hermediv polynomial.hermite_e.hermediv(c1, c2)[source]
Divide one Hermite series by another. Returns the quotient-with-remainder of two Hermite series c1 / c2. The arguments are sequences of coefficients from lowest order “term” to highest, e.g., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. Parameters
c1, c2array_like
1-D arrays of Hermite series coefficients ordered from low to high. Returns
[quo, rem]ndarrays
Of Hermite series coefficients representing the quotient and remainder. See also
hermeadd, hermesub, hermemulx, hermemul, hermepow
Notes In general, the (polynomial) division of one Hermite series by another results in quotient and remainder terms that are not in the Hermite polynomial basis set. Thus, to express these results as a Hermite series, it is necessary to “reproject” the results onto the Hermite basis set, which may produce “unintuitive” (but correct) results; see Examples section below. Examples >>> from numpy.polynomial.hermite_e import hermediv
>>> hermediv([ 14., 15., 28., 7., 6.], [0, 1, 2])
(array([1., 2., 3.]), array([0.]))
>>> hermediv([ 15., 17., 28., 7., 6.], [0, 1, 2])
(array([1., 2., 3.]), array([1., 2.])) | numpy.reference.generated.numpy.polynomial.hermite_e.hermediv |
numpy.polynomial.hermite_e.hermedomain polynomial.hermite_e.hermedomain = array([-1, 1])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite_e.hermedomain |
numpy.polynomial.hermite_e.hermefit polynomial.hermite_e.hermefit(x, y, deg, rcond=None, full=False, w=None)[source]
Least squares fit of Hermite series to data. Return the coefficients of a HermiteE series of degree deg that is the least squares fit to the data values y given at points x. If y is 1-D the returned coefficients will also be 1-D. If y is 2-D multiple fits are done, one for each column of y, and the resulting coefficients are stored in the corresponding columns of a 2-D return. The fitted polynomial(s) are in the form \[p(x) = c_0 + c_1 * He_1(x) + ... + c_n * He_n(x),\] where n is deg. Parameters
xarray_like, shape (M,)
x-coordinates of the M sample points (x[i], y[i]).
yarray_like, shape (M,) or (M, K)
y-coordinates of the sample points. Several data sets of sample points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column.
degint or 1-D array_like
Degree(s) of the fitting polynomials. If deg is a single integer all terms up to and including the deg’th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead.
rcondfloat, optional
Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases.
fullbool, optional
Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned.
warray_like, shape (M,), optional
Weights. If not None, the weight w[i] applies to the unsquared residual y[i] - y_hat[i] at x[i]. Ideally the weights are chosen so that the errors of the products w[i]*y[i] all have the same variance. When using inverse-variance weighting, use w[i] = 1/sigma(y[i]). The default value is None. Returns
coefndarray, shape (M,) or (M, K)
Hermite coefficients ordered from low to high. If y was 2-D, the coefficients for the data in column k of y are in column k.
[residuals, rank, singular_values, rcond]list
These values are only returned if full == True residuals – sum of squared residuals of the least squares fit rank – the numerical rank of the scaled Vandermonde matrix singular_values – singular values of the scaled Vandermonde matrix rcond – value of rcond. For more details, see numpy.linalg.lstsq. Warns
RankWarning
The rank of the coefficient matrix in the least-squares fit is deficient. The warning is only raised if full = False. The warnings can be turned off by >>> import warnings
>>> warnings.simplefilter('ignore', np.RankWarning)
See also numpy.polynomial.chebyshev.chebfit
numpy.polynomial.legendre.legfit
numpy.polynomial.polynomial.polyfit
numpy.polynomial.hermite.hermfit
numpy.polynomial.laguerre.lagfit
hermeval
Evaluates a Hermite series. hermevander
pseudo Vandermonde matrix of Hermite series. hermeweight
HermiteE weight function. numpy.linalg.lstsq
Computes a least-squares fit from the matrix. scipy.interpolate.UnivariateSpline
Computes spline fits. Notes The solution is the coefficients of the HermiteE series p that minimizes the sum of the weighted squared errors \[E = \sum_j w_j^2 * |y_j - p(x_j)|^2,\] where the \(w_j\) are the weights. This problem is solved by setting up the (typically) overdetermined matrix equation \[V(x) * c = w * y,\] where V is the pseudo Vandermonde matrix of x, the elements of c are the coefficients to be solved for, and the elements of y are the observed values. This equation is then solved using the singular value decomposition of V. If some of the singular values of V are so small that they are neglected, then a RankWarning will be issued. This means that the coefficient values may be poorly determined. Using a lower order fit will usually get rid of the warning. The rcond parameter can also be set to a value smaller than its default, but the resulting fit may be spurious and have large contributions from roundoff error. Fits using HermiteE series are probably most useful when the data can be approximated by sqrt(w(x)) * p(x), where w(x) is the HermiteE weight. In that case the weight sqrt(w(x[i])) should be used together with data values y[i]/sqrt(w(x[i])). The weight function is available as hermeweight. References 1
Wikipedia, “Curve fitting”, https://en.wikipedia.org/wiki/Curve_fitting Examples >>> from numpy.polynomial.hermite_e import hermefit, hermeval
>>> x = np.linspace(-10, 10)
>>> np.random.seed(123)
>>> err = np.random.randn(len(x))/10
>>> y = hermeval(x, [1, 2, 3]) + err
>>> hermefit(x, y, 2)
array([ 1.01690445, 1.99951418, 2.99948696]) # may vary | numpy.reference.generated.numpy.polynomial.hermite_e.hermefit |
numpy.polynomial.hermite_e.hermefromroots polynomial.hermite_e.hermefromroots(roots)[source]
Generate a HermiteE series with given roots. The function returns the coefficients of the polynomial \[p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),\] in HermiteE form, where the r_n are the roots specified in roots. If a zero has multiplicity n, then it must appear in roots n times. For instance, if 2 is a root of multiplicity three and 3 is a root of multiplicity 2, then roots looks something like [2, 2, 2, 3, 3]. The roots can appear in any order. If the returned coefficients are c, then \[p(x) = c_0 + c_1 * He_1(x) + ... + c_n * He_n(x)\] The coefficient of the last term is not generally 1 for monic polynomials in HermiteE form. Parameters
rootsarray_like
Sequence containing the roots. Returns
outndarray
1-D array of coefficients. If all roots are real then out is a real array, if some of the roots are complex, then out is complex even if all the coefficients in the result are real (see Examples below). See also numpy.polynomial.polynomial.polyfromroots
numpy.polynomial.legendre.legfromroots
numpy.polynomial.laguerre.lagfromroots
numpy.polynomial.hermite.hermfromroots
numpy.polynomial.chebyshev.chebfromroots
Examples >>> from numpy.polynomial.hermite_e import hermefromroots, hermeval
>>> coef = hermefromroots((-1, 0, 1))
>>> hermeval((-1, 0, 1), coef)
array([0., 0., 0.])
>>> coef = hermefromroots((-1j, 1j))
>>> hermeval((-1j, 1j), coef)
array([0.+0.j, 0.+0.j]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermefromroots |
numpy.polynomial.hermite_e.hermegauss polynomial.hermite_e.hermegauss(deg)[source]
Gauss-HermiteE quadrature. Computes the sample points and weights for Gauss-HermiteE quadrature. These sample points and weights will correctly integrate polynomials of degree \(2*deg - 1\) or less over the interval \([-\inf, \inf]\) with the weight function \(f(x) = \exp(-x^2/2)\). Parameters
degint
Number of sample points and weights. It must be >= 1. Returns
xndarray
1-D ndarray containing the sample points.
yndarray
1-D ndarray containing the weights. Notes New in version 1.7.0. The results have only been tested up to degree 100, higher degrees may be problematic. The weights are determined by using the fact that \[w_k = c / (He'_n(x_k) * He_{n-1}(x_k))\] where \(c\) is a constant independent of \(k\) and \(x_k\) is the k’th root of \(He_n\), and then scaling the results to get the right value when integrating 1. | numpy.reference.generated.numpy.polynomial.hermite_e.hermegauss |
numpy.polynomial.hermite_e.hermegrid2d polynomial.hermite_e.hermegrid2d(x, y, c)[source]
Evaluate a 2-D HermiteE series on the Cartesian product of x and y. This function returns the values: \[p(a,b) = \sum_{i,j} c_{i,j} * H_i(a) * H_j(b)\] where the points (a, b) consist of all pairs formed by taking a from x and b from y. The resulting points form a grid with x in the first dimension and y in the second. The parameters x and y are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either x and y or their elements must support multiplication and addition both with themselves and with the elements of c. If c has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters
x, yarray_like, compatible objects
The two dimensional series is evaluated at the points in the Cartesian product of x and y. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn’t an ndarray, it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the two dimensional polynomial at points in the Cartesian product of x and y. See also
hermeval, hermeval2d, hermeval3d, hermegrid3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermegrid2d |
numpy.polynomial.hermite_e.hermegrid3d polynomial.hermite_e.hermegrid3d(x, y, z, c)[source]
Evaluate a 3-D HermiteE series on the Cartesian product of x, y, and z. This function returns the values: \[p(a,b,c) = \sum_{i,j,k} c_{i,j,k} * He_i(a) * He_j(b) * He_k(c)\] where the points (a, b, c) consist of all triples formed by taking a from x, b from y, and c from z. The resulting points form a grid with x in the first dimension, y in the second, and z in the third. The parameters x, y, and z are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either x, y, and z or their elements must support multiplication and addition both with themselves and with the elements of c. If c has fewer than three dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape + y.shape + z.shape. Parameters
x, y, zarray_like, compatible objects
The three dimensional series is evaluated at the points in the Cartesian product of x, y, and z. If x,`y`, or z is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn’t an ndarray, it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the two dimensional polynomial at points in the Cartesian product of x and y. See also
hermeval, hermeval2d, hermegrid2d, hermeval3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermegrid3d |
numpy.polynomial.hermite_e.hermeint polynomial.hermite_e.hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0)[source]
Integrate a Hermite_e series. Returns the Hermite_e series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added. The scaling factor is for use in a linear change of variable. (“Buyer beware”: note that, depending on what one is doing, one may want scl to be the reciprocal of what one might expect; for more information, see the Notes section below.) The argument c is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series H_0 + 2*H_1 + 3*H_2 while [[1,2],[1,2]] represents 1*H_0(x)*H_0(y) + 1*H_1(x)*H_0(y) + 2*H_0(x)*H_1(y) +
2*H_1(x)*H_1(y) if axis=0 is x and axis=1 is y. Parameters
carray_like
Array of Hermite_e series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index.
mint, optional
Order of integration, must be positive. (Default: 1)
k{[], list, scalar}, optional
Integration constant(s). The value of the first integral at lbnd is the first value in the list, the value of the second integral at lbnd is the second value, etc. If k == [] (the default), all constants are set to zero. If m == 1, a single scalar can be given instead of a list.
lbndscalar, optional
The lower bound of the integral. (Default: 0)
sclscalar, optional
Following each integration the result is multiplied by scl before the integration constant is added. (Default: 1)
axisint, optional
Axis over which the integral is taken. (Default: 0). New in version 1.7.0. Returns
Sndarray
Hermite_e series coefficients of the integral. Raises
ValueError
If m < 0, len(k) > m, np.ndim(lbnd) != 0, or np.ndim(scl) != 0. See also hermeder
Notes Note that the result of each integration is multiplied by scl. Why is this important to note? Say one is making a linear change of variable \(u = ax + b\) in an integral relative to x. Then \(dx = du/a\), so one will need to set scl equal to \(1/a\) - perhaps not what one would have first thought. Also note that, in general, the result of integrating a C-series needs to be “reprojected” onto the C-series basis set. Thus, typically, the result of this function is “unintuitive,” albeit correct; see Examples section below. Examples >>> from numpy.polynomial.hermite_e import hermeint
>>> hermeint([1, 2, 3]) # integrate once, value 0 at 0.
array([1., 1., 1., 1.])
>>> hermeint([1, 2, 3], m=2) # integrate twice, value & deriv 0 at 0
array([-0.25 , 1. , 0.5 , 0.33333333, 0.25 ]) # may vary
>>> hermeint([1, 2, 3], k=1) # integrate once, value 1 at 0.
array([2., 1., 1., 1.])
>>> hermeint([1, 2, 3], lbnd=-1) # integrate once, value 0 at -1
array([-1., 1., 1., 1.])
>>> hermeint([1, 2, 3], m=2, k=[1, 2], lbnd=-1)
array([ 1.83333333, 0. , 0.5 , 0.33333333, 0.25 ]) # may vary | numpy.reference.generated.numpy.polynomial.hermite_e.hermeint |
numpy.polynomial.hermite_e.hermeline polynomial.hermite_e.hermeline(off, scl)[source]
Hermite series whose graph is a straight line. Parameters
off, sclscalars
The specified line is given by off + scl*x. Returns
yndarray
This module’s representation of the Hermite series for off + scl*x. See also numpy.polynomial.polynomial.polyline
numpy.polynomial.chebyshev.chebline
numpy.polynomial.legendre.legline
numpy.polynomial.laguerre.lagline
numpy.polynomial.hermite.hermline
Examples >>> from numpy.polynomial.hermite_e import hermeline
>>> from numpy.polynomial.hermite_e import hermeline, hermeval
>>> hermeval(0,hermeline(3, 2))
3.0
>>> hermeval(1,hermeline(3, 2))
5.0 | numpy.reference.generated.numpy.polynomial.hermite_e.hermeline |
numpy.polynomial.hermite_e.hermemul polynomial.hermite_e.hermemul(c1, c2)[source]
Multiply one Hermite series by another. Returns the product of two Hermite series c1 * c2. The arguments are sequences of coefficients, from lowest order “term” to highest, e.g., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. Parameters
c1, c2array_like
1-D arrays of Hermite series coefficients ordered from low to high. Returns
outndarray
Of Hermite series coefficients representing their product. See also
hermeadd, hermesub, hermemulx, hermediv, hermepow
Notes In general, the (polynomial) product of two C-series results in terms that are not in the Hermite polynomial basis set. Thus, to express the product as a Hermite series, it is necessary to “reproject” the product onto said basis set, which may produce “unintuitive” (but correct) results; see Examples section below. Examples >>> from numpy.polynomial.hermite_e import hermemul
>>> hermemul([1, 2, 3], [0, 1, 2])
array([14., 15., 28., 7., 6.]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermemul |
numpy.polynomial.hermite_e.hermemulx polynomial.hermite_e.hermemulx(c)[source]
Multiply a Hermite series by x. Multiply the Hermite series c by x, where x is the independent variable. Parameters
carray_like
1-D array of Hermite series coefficients ordered from low to high. Returns
outndarray
Array representing the result of the multiplication. Notes The multiplication uses the recursion relationship for Hermite polynomials in the form \[xP_i(x) = (P_{i + 1}(x) + iP_{i - 1}(x)))\] Examples >>> from numpy.polynomial.hermite_e import hermemulx
>>> hermemulx([1, 2, 3])
array([2., 7., 2., 3.]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermemulx |
numpy.polynomial.hermite_e.hermeone polynomial.hermite_e.hermeone = array([1])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite_e.hermeone |
numpy.polynomial.hermite_e.hermepow polynomial.hermite_e.hermepow(c, pow, maxpower=16)[source]
Raise a Hermite series to a power. Returns the Hermite series c raised to the power pow. The argument c is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series P_0 + 2*P_1 + 3*P_2. Parameters
carray_like
1-D array of Hermite series coefficients ordered from low to high.
powinteger
Power to which the series will be raised
maxpowerinteger, optional
Maximum power allowed. This is mainly to limit growth of the series to unmanageable size. Default is 16 Returns
coefndarray
Hermite series of power. See also
hermeadd, hermesub, hermemulx, hermemul, hermediv
Examples >>> from numpy.polynomial.hermite_e import hermepow
>>> hermepow([1, 2, 3], 2)
array([23., 28., 46., 12., 9.]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermepow |
numpy.polynomial.hermite_e.hermeroots polynomial.hermite_e.hermeroots(c)[source]
Compute the roots of a HermiteE series. Return the roots (a.k.a. “zeros”) of the polynomial \[p(x) = \sum_i c[i] * He_i(x).\] Parameters
c1-D array_like
1-D array of coefficients. Returns
outndarray
Array of the roots of the series. If all the roots are real, then out is also real, otherwise it is complex. See also numpy.polynomial.polynomial.polyroots
numpy.polynomial.legendre.legroots
numpy.polynomial.laguerre.lagroots
numpy.polynomial.hermite.hermroots
numpy.polynomial.chebyshev.chebroots
Notes The root estimates are obtained as the eigenvalues of the companion matrix, Roots far from the origin of the complex plane may have large errors due to the numerical instability of the series for such values. Roots with multiplicity greater than 1 will also show larger errors as the value of the series near such points is relatively insensitive to errors in the roots. Isolated roots near the origin can be improved by a few iterations of Newton’s method. The HermiteE series basis polynomials aren’t powers of x so the results of this function may seem unintuitive. Examples >>> from numpy.polynomial.hermite_e import hermeroots, hermefromroots
>>> coef = hermefromroots([-1, 0, 1])
>>> coef
array([0., 2., 0., 1.])
>>> hermeroots(coef)
array([-1., 0., 1.]) # may vary | numpy.reference.generated.numpy.polynomial.hermite_e.hermeroots |
numpy.polynomial.hermite_e.hermesub polynomial.hermite_e.hermesub(c1, c2)[source]
Subtract one Hermite series from another. Returns the difference of two Hermite series c1 - c2. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. Parameters
c1, c2array_like
1-D arrays of Hermite series coefficients ordered from low to high. Returns
outndarray
Of Hermite series coefficients representing their difference. See also
hermeadd, hermemulx, hermemul, hermediv, hermepow
Notes Unlike multiplication, division, etc., the difference of two Hermite series is a Hermite series (without having to “reproject” the result onto the basis set) so subtraction, just like that of “standard” polynomials, is simply “component-wise.” Examples >>> from numpy.polynomial.hermite_e import hermesub
>>> hermesub([1, 2, 3, 4], [1, 2, 3])
array([0., 0., 0., 4.]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermesub |
numpy.polynomial.hermite_e.hermetrim polynomial.hermite_e.hermetrim(c, tol=0)[source]
Remove “small” “trailing” coefficients from a polynomial. “Small” means “small in absolute value” and is controlled by the parameter tol; “trailing” means highest order coefficient(s), e.g., in [0, 1, 1, 0, 0] (which represents 0 + x + x**2 + 0*x**3 + 0*x**4) both the 3-rd and 4-th order coefficients would be “trimmed.” Parameters
carray_like
1-d array of coefficients, ordered from lowest order to highest.
tolnumber, optional
Trailing (i.e., highest order) elements with absolute value less than or equal to tol (default value is zero) are removed. Returns
trimmedndarray
1-d array with trailing zeros removed. If the resulting series would be empty, a series containing a single zero is returned. Raises
ValueError
If tol < 0 See also trimseq
Examples >>> from numpy.polynomial import polyutils as pu
>>> pu.trimcoef((0,0,3,0,5,0,0))
array([0., 0., 3., 0., 5.])
>>> pu.trimcoef((0,0,1e-3,0,1e-5,0,0),1e-3) # item == tol is trimmed
array([0.])
>>> i = complex(0,1) # works for complex
>>> pu.trimcoef((3e-4,1e-3*(1-i),5e-4,2e-5*(1+i)), 1e-3)
array([0.0003+0.j , 0.001 -0.001j]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermetrim |
numpy.polynomial.hermite_e.hermeval polynomial.hermite_e.hermeval(x, c, tensor=True)[source]
Evaluate an HermiteE series at points x. If c is of length n + 1, this function returns the value: \[p(x) = c_0 * He_0(x) + c_1 * He_1(x) + ... + c_n * He_n(x)\] The parameter x is converted to an array only if it is a tuple or a list, otherwise it is treated as a scalar. In either case, either x or its elements must support multiplication and addition both with themselves and with the elements of c. If c is a 1-D array, then p(x) will have the same shape as x. If c is multidimensional, then the shape of the result depends on the value of tensor. If tensor is true the shape will be c.shape[1:] + x.shape. If tensor is false the shape will be c.shape[1:]. Note that scalars have shape (,). Trailing zeros in the coefficients will be used in the evaluation, so they should be avoided if efficiency is a concern. Parameters
xarray_like, compatible object
If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, x or its elements must support addition and multiplication with with themselves and with the elements of c.
carray_like
Array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the coefficients may be thought of as stored in the columns of c.
tensorboolean, optional
If True, the shape of the coefficient array is extended with ones on the right, one for each dimension of x. Scalars have dimension 0 for this action. The result is that every column of coefficients in c is evaluated for every element of x. If False, x is broadcast over the columns of c for the evaluation. This keyword is useful when c is multidimensional. The default value is True. New in version 1.7.0. Returns
valuesndarray, algebra_like
The shape of the return value is described above. See also
hermeval2d, hermegrid2d, hermeval3d, hermegrid3d
Notes The evaluation uses Clenshaw recursion, aka synthetic division. Examples >>> from numpy.polynomial.hermite_e import hermeval
>>> coef = [1,2,3]
>>> hermeval(1, coef)
3.0
>>> hermeval([[1,2],[3,4]], coef)
array([[ 3., 14.],
[31., 54.]]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermeval |
numpy.polynomial.hermite_e.hermeval2d polynomial.hermite_e.hermeval2d(x, y, c)[source]
Evaluate a 2-D HermiteE series at points (x, y). This function returns the values: \[p(x,y) = \sum_{i,j} c_{i,j} * He_i(x) * He_j(y)\] The parameters x and y are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either x and y or their elements must support multiplication and addition both with themselves and with the elements of c. If c is a 1-D array a one is implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters
x, yarray_like, compatible objects
The two dimensional series is evaluated at the points (x, y), where x and y must have the same shape. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn’t an ndarray it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficient of the term of multi-degree i,j is contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the two dimensional polynomial at points formed with pairs of corresponding values from x and y. See also
hermeval, hermegrid2d, hermeval3d, hermegrid3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermeval2d |
numpy.polynomial.hermite_e.hermeval3d polynomial.hermite_e.hermeval3d(x, y, z, c)[source]
Evaluate a 3-D Hermite_e series at points (x, y, z). This function returns the values: \[p(x,y,z) = \sum_{i,j,k} c_{i,j,k} * He_i(x) * He_j(y) * He_k(z)\] The parameters x, y, and z are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either x, y, and z or their elements must support multiplication and addition both with themselves and with the elements of c. If c has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. Parameters
x, y, zarray_like, compatible object
The three dimensional series is evaluated at the points (x, y, z), where x, y, and z must have the same shape. If any of x, y, or z is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn’t an ndarray it is treated as a scalar.
carray_like
Array of coefficients ordered so that the coefficient of the term of multi-degree i,j,k is contained in c[i,j,k]. If c has dimension greater than 3 the remaining indices enumerate multiple sets of coefficients. Returns
valuesndarray, compatible object
The values of the multidimensional polynomial on points formed with triples of corresponding values from x, y, and z. See also
hermeval, hermeval2d, hermegrid2d, hermegrid3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermeval3d |
numpy.polynomial.hermite_e.hermevander polynomial.hermite_e.hermevander(x, deg)[source]
Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree deg and sample points x. The pseudo-Vandermonde matrix is defined by \[V[..., i] = He_i(x),\] where 0 <= i <= deg. The leading indices of V index the elements of x and the last index is the degree of the HermiteE polynomial. If c is a 1-D array of coefficients of length n + 1 and V is the array V = hermevander(x, n), then np.dot(V, c) and hermeval(x, c) are the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of HermiteE series of the same degree and sample points. Parameters
xarray_like
Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If x is scalar it is converted to a 1-D array.
degint
Degree of the resulting matrix. Returns
vanderndarray
The pseudo-Vandermonde matrix. The shape of the returned matrix is x.shape + (deg + 1,), where The last index is the degree of the corresponding HermiteE polynomial. The dtype will be the same as the converted x. Examples >>> from numpy.polynomial.hermite_e import hermevander
>>> x = np.array([-1, 0, 1])
>>> hermevander(x, 3)
array([[ 1., -1., 0., 2.],
[ 1., 0., -1., -0.],
[ 1., 1., 0., -2.]]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermevander |
numpy.polynomial.hermite_e.hermevander2d polynomial.hermite_e.hermevander2d(x, y, deg)[source]
Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees deg and sample points (x, y). The pseudo-Vandermonde matrix is defined by \[V[..., (deg[1] + 1)*i + j] = He_i(x) * He_j(y),\] where 0 <= i <= deg[0] and 0 <= j <= deg[1]. The leading indices of V index the points (x, y) and the last index encodes the degrees of the HermiteE polynomials. If V = hermevander2d(x, y, [xdeg, ydeg]), then the columns of V correspond to the elements of a 2-D coefficient array c of shape (xdeg + 1, ydeg + 1) in the order \[c_{00}, c_{01}, c_{02} ... , c_{10}, c_{11}, c_{12} ...\] and np.dot(V, c.flat) and hermeval2d(x, y, c) will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 2-D HermiteE series of the same degrees and sample points. Parameters
x, yarray_like
Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays.
deglist of ints
List of maximum degrees of the form [x_deg, y_deg]. Returns
vander2dndarray
The shape of the returned matrix is x.shape + (order,), where \(order = (deg[0]+1)*(deg[1]+1)\). The dtype will be the same as the converted x and y. See also
hermevander, hermevander3d, hermeval2d, hermeval3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermevander2d |
numpy.polynomial.hermite_e.hermevander3d polynomial.hermite_e.hermevander3d(x, y, z, deg)[source]
Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees deg and sample points (x, y, z). If l, m, n are the given degrees in x, y, z, then Hehe pseudo-Vandermonde matrix is defined by \[V[..., (m+1)(n+1)i + (n+1)j + k] = He_i(x)*He_j(y)*He_k(z),\] where 0 <= i <= l, 0 <= j <= m, and 0 <= j <= n. The leading indices of V index the points (x, y, z) and the last index encodes the degrees of the HermiteE polynomials. If V = hermevander3d(x, y, z, [xdeg, ydeg, zdeg]), then the columns of V correspond to the elements of a 3-D coefficient array c of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order \[c_{000}, c_{001}, c_{002},... , c_{010}, c_{011}, c_{012},...\] and np.dot(V, c.flat) and hermeval3d(x, y, z, c) will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D HermiteE series of the same degrees and sample points. Parameters
x, y, zarray_like
Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays.
deglist of ints
List of maximum degrees of the form [x_deg, y_deg, z_deg]. Returns
vander3dndarray
The shape of the returned matrix is x.shape + (order,), where \(order = (deg[0]+1)*(deg[1]+1)*(deg[2]+1)\). The dtype will be the same as the converted x, y, and z. See also
hermevander, hermevander3d, hermeval2d, hermeval3d
Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermevander3d |
numpy.polynomial.hermite_e.hermeweight polynomial.hermite_e.hermeweight(x)[source]
Weight function of the Hermite_e polynomials. The weight function is \(\exp(-x^2/2)\) and the interval of integration is \([-\inf, \inf]\). the HermiteE polynomials are orthogonal, but not normalized, with respect to this weight function. Parameters
xarray_like
Values at which the weight function will be computed. Returns
wndarray
The weight function at x. Notes New in version 1.7.0. | numpy.reference.generated.numpy.polynomial.hermite_e.hermeweight |
numpy.polynomial.hermite_e.hermex polynomial.hermite_e.hermex = array([0, 1])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite_e.hermex |
numpy.polynomial.hermite_e.hermezero polynomial.hermite_e.hermezero = array([0])
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.) Arrays should be constructed using array, zeros or empty (refer to the See Also section below). The parameters given here refer to a low-level method (ndarray(…)) for instantiating an array. For more information, refer to the numpy module and examine the methods and attributes of an array. Parameters
(for the __new__ method; see Notes below)
shapetuple of ints
Shape of created array.
dtypedata-type, optional
Any object that can be interpreted as a numpy data type.
bufferobject exposing buffer interface, optional
Used to fill the array with data.
offsetint, optional
Offset of array data in buffer.
stridestuple of ints, optional
Strides of data in memory.
order{‘C’, ‘F’}, optional
Row-major (C-style) or column-major (Fortran-style) order. See also array
Construct an array. zeros
Create an array, each element of which is zero. empty
Create an array, but leave its allocated memory unchanged (i.e., it contains “garbage”). dtype
Create a data-type. numpy.typing.NDArray
An ndarray alias generic w.r.t. its dtype.type. Notes There are two modes of creating an array using __new__: If buffer is None, then only shape, dtype, and order are used. If buffer is an object exposing the buffer interface, then all keywords are interpreted. No __init__ method is needed because the array is fully initialized after the __new__ method. Examples These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways of constructing an ndarray. First mode, buffer is None: >>> np.ndarray(shape=(2,2), dtype=float, order='F')
array([[0.0e+000, 0.0e+000], # random
[ nan, 2.5e-323]])
Second mode: >>> np.ndarray((2,), buffer=np.array([1,2,3]),
... offset=np.int_().itemsize,
... dtype=int) # offset = 1*itemsize, i.e. skip first element
array([2, 3])
Attributes
Tndarray
Transpose of the array.
databuffer
The array’s elements, in memory.
dtypedtype object
Describes the format of the elements in the array.
flagsdict
Dictionary containing information related to memory use, e.g., ‘C_CONTIGUOUS’, ‘OWNDATA’, ‘WRITEABLE’, etc.
flatnumpy.flatiter object
Flattened version of the array as an iterator. The iterator allows assignments, e.g., x.flat = 3 (See ndarray.flat for assignment examples; TODO).
imagndarray
Imaginary part of the array.
realndarray
Real part of the array.
sizeint
Number of elements in the array.
itemsizeint
The memory use of each array element in bytes.
nbytesint
The total number of bytes required to store the array data, i.e., itemsize * size.
ndimint
The array’s number of dimensions.
shapetuple of ints
Shape of the array.
stridestuple of ints
The step-size required to move from one element to the next in memory. For example, a contiguous (3, 4) array of type int16 in C-order has strides (8, 2). This implies that to move from element to element in memory requires jumps of 2 bytes. To move from row-to-row, one needs to jump 8 bytes at a time (2 * 4).
ctypesctypes object
Class containing properties of the array needed for interaction with ctypes.
basendarray
If the array is a view into another array, that array is its base (unless that array is also a view). The base array is where the array data is actually stored. | numpy.reference.generated.numpy.polynomial.hermite_e.hermezero |
numpy.polynomial.hermite_e.HermiteE.__call__ method polynomial.hermite_e.HermiteE.__call__(arg)[source]
Call self as a function. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.__call__ |
numpy.polynomial.hermite_e.HermiteE.basis method classmethod polynomial.hermite_e.HermiteE.basis(deg, domain=None, window=None)[source]
Series basis polynomial of degree deg. Returns the series representing the basis polynomial of degree deg. New in version 1.7.0. Parameters
degint
Degree of the basis polynomial for the series. Must be >= 0.
domain{None, array_like}, optional
If given, the array must be of the form [beg, end], where beg and end are the endpoints of the domain. If None is given then the class domain is used. The default is None.
window{None, array_like}, optional
If given, the resulting array must be if the form [beg, end], where beg and end are the endpoints of the window. If None is given then the class window is used. The default is None. Returns
new_seriesseries
A series with the coefficient of the deg term set to one and all others zero. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.basis |
numpy.polynomial.hermite_e.HermiteE.cast method classmethod polynomial.hermite_e.HermiteE.cast(series, domain=None, window=None)[source]
Convert series to series of this class. The series is expected to be an instance of some polynomial series of one of the types supported by by the numpy.polynomial module, but could be some other class that supports the convert method. New in version 1.7.0. Parameters
seriesseries
The series instance to be converted.
domain{None, array_like}, optional
If given, the array must be of the form [beg, end], where beg and end are the endpoints of the domain. If None is given then the class domain is used. The default is None.
window{None, array_like}, optional
If given, the resulting array must be if the form [beg, end], where beg and end are the endpoints of the window. If None is given then the class window is used. The default is None. Returns
new_seriesseries
A series of the same kind as the calling class and equal to series when evaluated. See also convert
similar instance method | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.cast |
numpy.polynomial.hermite_e.HermiteE.convert method polynomial.hermite_e.HermiteE.convert(domain=None, kind=None, window=None)[source]
Convert series to a different kind and/or domain and/or window. Parameters
domainarray_like, optional
The domain of the converted series. If the value is None, the default domain of kind is used.
kindclass, optional
The polynomial series type class to which the current instance should be converted. If kind is None, then the class of the current instance is used.
windowarray_like, optional
The window of the converted series. If the value is None, the default window of kind is used. Returns
new_seriesseries
The returned class can be of different type than the current instance and/or have a different domain and/or different window. Notes Conversion between domains and class types can result in numerically ill defined series. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.convert |
numpy.polynomial.hermite_e.HermiteE.copy method polynomial.hermite_e.HermiteE.copy()[source]
Return a copy. Returns
new_seriesseries
Copy of self. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.copy |
numpy.polynomial.hermite_e.HermiteE.cutdeg method polynomial.hermite_e.HermiteE.cutdeg(deg)[source]
Truncate series to the given degree. Reduce the degree of the series to deg by discarding the high order terms. If deg is greater than the current degree a copy of the current series is returned. This can be useful in least squares where the coefficients of the high degree terms may be very small. New in version 1.5.0. Parameters
degnon-negative int
The series is reduced to degree deg by discarding the high order terms. The value of deg must be a non-negative integer. Returns
new_seriesseries
New instance of series with reduced degree. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.cutdeg |
numpy.polynomial.hermite_e.HermiteE.degree method polynomial.hermite_e.HermiteE.degree()[source]
The degree of the series. New in version 1.5.0. Returns
degreeint
Degree of the series, one less than the number of coefficients. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.degree |
numpy.polynomial.hermite_e.HermiteE.deriv method polynomial.hermite_e.HermiteE.deriv(m=1)[source]
Differentiate. Return a series instance of that is the derivative of the current series. Parameters
mnon-negative int
Find the derivative of order m. Returns
new_seriesseries
A new series representing the derivative. The domain is the same as the domain of the differentiated series. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.deriv |
numpy.polynomial.hermite_e.HermiteE.domain attribute polynomial.hermite_e.HermiteE.domain = array([-1, 1]) | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.domain |
numpy.polynomial.hermite_e.HermiteE.fit method classmethod polynomial.hermite_e.HermiteE.fit(x, y, deg, domain=None, rcond=None, full=False, w=None, window=None)[source]
Least squares fit to data. Return a series instance that is the least squares fit to the data y sampled at x. The domain of the returned instance can be specified and this will often result in a superior fit with less chance of ill conditioning. Parameters
xarray_like, shape (M,)
x-coordinates of the M sample points (x[i], y[i]).
yarray_like, shape (M,)
y-coordinates of the M sample points (x[i], y[i]).
degint or 1-D array_like
Degree(s) of the fitting polynomials. If deg is a single integer all terms up to and including the deg’th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead.
domain{None, [beg, end], []}, optional
Domain to use for the returned series. If None, then a minimal domain that covers the points x is chosen. If [] the class domain is used. The default value was the class domain in NumPy 1.4 and None in later versions. The [] option was added in numpy 1.5.0.
rcondfloat, optional
Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases.
fullbool, optional
Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned.
warray_like, shape (M,), optional
Weights. If not None, the weight w[i] applies to the unsquared residual y[i] - y_hat[i] at x[i]. Ideally the weights are chosen so that the errors of the products w[i]*y[i] all have the same variance. When using inverse-variance weighting, use w[i] = 1/sigma(y[i]). The default value is None. New in version 1.5.0.
window{[beg, end]}, optional
Window to use for the returned series. The default value is the default class domain New in version 1.6.0. Returns
new_seriesseries
A series that represents the least squares fit to the data and has the domain and window specified in the call. If the coefficients for the unscaled and unshifted basis polynomials are of interest, do new_series.convert().coef.
[resid, rank, sv, rcond]list
These values are only returned if full == True resid – sum of squared residuals of the least squares fit rank – the numerical rank of the scaled Vandermonde matrix sv – singular values of the scaled Vandermonde matrix rcond – value of rcond. For more details, see linalg.lstsq. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.fit |
numpy.polynomial.hermite_e.HermiteE.fromroots method classmethod polynomial.hermite_e.HermiteE.fromroots(roots, domain=[], window=None)[source]
Return series instance that has the specified roots. Returns a series representing the product (x - r[0])*(x - r[1])*...*(x - r[n-1]), where r is a list of roots. Parameters
rootsarray_like
List of roots.
domain{[], None, array_like}, optional
Domain for the resulting series. If None the domain is the interval from the smallest root to the largest. If [] the domain is the class domain. The default is [].
window{None, array_like}, optional
Window for the returned series. If None the class window is used. The default is None. Returns
new_seriesseries
Series with the specified roots. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.fromroots |
numpy.polynomial.hermite_e.HermiteE.has_samecoef method polynomial.hermite_e.HermiteE.has_samecoef(other)[source]
Check if coefficients match. New in version 1.6.0. Parameters
otherclass instance
The other class must have the coef attribute. Returns
boolboolean
True if the coefficients are the same, False otherwise. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.has_samecoef |
numpy.polynomial.hermite_e.HermiteE.has_samedomain method polynomial.hermite_e.HermiteE.has_samedomain(other)[source]
Check if domains match. New in version 1.6.0. Parameters
otherclass instance
The other class must have the domain attribute. Returns
boolboolean
True if the domains are the same, False otherwise. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.has_samedomain |
numpy.polynomial.hermite_e.HermiteE.has_sametype method polynomial.hermite_e.HermiteE.has_sametype(other)[source]
Check if types match. New in version 1.7.0. Parameters
otherobject
Class instance. Returns
boolboolean
True if other is same class as self | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.has_sametype |
numpy.polynomial.hermite_e.HermiteE.has_samewindow method polynomial.hermite_e.HermiteE.has_samewindow(other)[source]
Check if windows match. New in version 1.6.0. Parameters
otherclass instance
The other class must have the window attribute. Returns
boolboolean
True if the windows are the same, False otherwise. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.has_samewindow |
numpy.polynomial.hermite_e.HermiteE.identity method classmethod polynomial.hermite_e.HermiteE.identity(domain=None, window=None)[source]
Identity function. If p is the returned series, then p(x) == x for all values of x. Parameters
domain{None, array_like}, optional
If given, the array must be of the form [beg, end], where beg and end are the endpoints of the domain. If None is given then the class domain is used. The default is None.
window{None, array_like}, optional
If given, the resulting array must be if the form [beg, end], where beg and end are the endpoints of the window. If None is given then the class window is used. The default is None. Returns
new_seriesseries
Series of representing the identity. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.identity |
numpy.polynomial.hermite_e.HermiteE.integ method polynomial.hermite_e.HermiteE.integ(m=1, k=[], lbnd=None)[source]
Integrate. Return a series instance that is the definite integral of the current series. Parameters
mnon-negative int
The number of integrations to perform.
karray_like
Integration constants. The first constant is applied to the first integration, the second to the second, and so on. The list of values must less than or equal to m in length and any missing values are set to zero.
lbndScalar
The lower bound of the definite integral. Returns
new_seriesseries
A new series representing the integral. The domain is the same as the domain of the integrated series. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.integ |
numpy.polynomial.hermite_e.HermiteE.linspace method polynomial.hermite_e.HermiteE.linspace(n=100, domain=None)[source]
Return x, y values at equally spaced points in domain. Returns the x, y values at n linearly spaced points across the domain. Here y is the value of the polynomial at the points x. By default the domain is the same as that of the series instance. This method is intended mostly as a plotting aid. New in version 1.5.0. Parameters
nint, optional
Number of point pairs to return. The default value is 100.
domain{None, array_like}, optional
If not None, the specified domain is used instead of that of the calling instance. It should be of the form [beg,end]. The default is None which case the class domain is used. Returns
x, yndarray
x is equal to linspace(self.domain[0], self.domain[1], n) and y is the series evaluated at element of x. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.linspace |
numpy.polynomial.hermite_e.HermiteE.mapparms method polynomial.hermite_e.HermiteE.mapparms()[source]
Return the mapping parameters. The returned values define a linear map off + scl*x that is applied to the input arguments before the series is evaluated. The map depends on the domain and window; if the current domain is equal to the window the resulting map is the identity. If the coefficients of the series instance are to be used by themselves outside this class, then the linear function must be substituted for the x in the standard representation of the base polynomials. Returns
off, sclfloat or complex
The mapping function is defined by off + scl*x. Notes If the current domain is the interval [l1, r1] and the window is [l2, r2], then the linear mapping function L is defined by the equations: L(l1) = l2
L(r1) = r2 | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.mapparms |
numpy.polynomial.hermite_e.HermiteE.roots method polynomial.hermite_e.HermiteE.roots()[source]
Return the roots of the series polynomial. Compute the roots for the series. Note that the accuracy of the roots decrease the further outside the domain they lie. Returns
rootsndarray
Array containing the roots of the series. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.roots |
numpy.polynomial.hermite_e.HermiteE.trim method polynomial.hermite_e.HermiteE.trim(tol=0)[source]
Remove trailing coefficients Remove trailing coefficients until a coefficient is reached whose absolute value greater than tol or the beginning of the series is reached. If all the coefficients would be removed the series is set to [0]. A new series instance is returned with the new coefficients. The current instance remains unchanged. Parameters
tolnon-negative number.
All trailing coefficients less than tol will be removed. Returns
new_seriesseries
New instance of series with trimmed coefficients. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.trim |
numpy.polynomial.hermite_e.HermiteE.truncate method polynomial.hermite_e.HermiteE.truncate(size)[source]
Truncate series to length size. Reduce the series to length size by discarding the high degree terms. The value of size must be a positive integer. This can be useful in least squares where the coefficients of the high degree terms may be very small. Parameters
sizepositive int
The series is reduced to length size by discarding the high degree terms. The value of size must be a positive integer. Returns
new_seriesseries
New instance of series with truncated coefficients. | numpy.reference.generated.numpy.polynomial.hermite_e.hermitee.truncate |
numpy.polynomial.hermite_e.poly2herme polynomial.hermite_e.poly2herme(pol)[source]
Convert a polynomial to a Hermite series. Convert an array representing the coefficients of a polynomial (relative to the “standard” basis) ordered from lowest degree to highest, to an array of the coefficients of the equivalent Hermite series, ordered from lowest to highest degree. Parameters
polarray_like
1-D array containing the polynomial coefficients Returns
cndarray
1-D array containing the coefficients of the equivalent Hermite series. See also herme2poly
Notes The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples >>> from numpy.polynomial.hermite_e import poly2herme
>>> poly2herme(np.arange(4))
array([ 2., 10., 2., 3.]) | numpy.reference.generated.numpy.polynomial.hermite_e.poly2herme |
numpy.polynomial.laguerre.lag2poly polynomial.laguerre.lag2poly(c)[source]
Convert a Laguerre series to a polynomial. Convert an array representing the coefficients of a Laguerre series, ordered from lowest degree to highest, to an array of the coefficients of the equivalent polynomial (relative to the “standard” basis) ordered from lowest to highest degree. Parameters
carray_like
1-D array containing the Laguerre series coefficients, ordered from lowest order term to highest. Returns
polndarray
1-D array containing the coefficients of the equivalent polynomial (relative to the “standard” basis) ordered from lowest order term to highest. See also poly2lag
Notes The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples >>> from numpy.polynomial.laguerre import lag2poly
>>> lag2poly([ 23., -63., 58., -18.])
array([0., 1., 2., 3.]) | numpy.reference.generated.numpy.polynomial.laguerre.lag2poly |