neulab/docprompting-conala huggingface dataset:
numpy.where   numpy.where(condition, [x, y, ]/)
 
Return elements chosen from x or y depending on condition.  Note When only condition is provided, this function is a shorthand for np.asarray(condition).nonzero(). Using nonzero directly should be preferred, as it behaves correctly for subclasses. The rest of this documentation covers only the case where all three arguments are provided.   Parameters 
 
conditionarray_like, bool


Where True, yield x, otherwise yield y.  
x, yarray_like


Values from which to choose. x, y and condition need to be broadcastable to some shape.    Returns 
 
outndarray


An array with elements from x where condition is True, and elements from y elsewhere.      See also  choose
nonzero

The function that is called when x and y are omitted    Notes If all the arrays are 1-D, where is equivalent to: [xv if c else yv
 for c, xv, yv in zip(condition, x, y)]
 Examples >>> a = np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.where(a < 5, a, 10*a)
array([ 0,  1,  2,  3,  4, 50, 60, 70, 80, 90])
 This can be used on multidimensional arrays too: >>> np.where([[True, False], [True, True]],
...          [[1, 2], [3, 4]],
...          [[9, 8], [7, 6]])
array([[1, 8],
       [3, 4]])
 The shapes of x, y, and the condition are broadcast together: >>> x, y = np.ogrid[:3, :4]
>>> np.where(x < y, x, 10 + y)  # both x and 10+y are broadcast
array([[10,  0,  0,  0],
       [10, 11,  1,  1],
       [10, 11, 12,  2]])
 >>> a = np.array([[0, 1, 2],
...               [0, 2, 4],
...               [0, 3, 6]])
>>> np.where(a < 4, a, -1)  # -1 is broadcast
array([[ 0,  1,  2],
       [ 0,  2, -1],
       [ 0,  3, -1]])
numpy.who   numpy.who(vardict=None)[source]
 
Print the NumPy arrays in the given dictionary. If there is no dictionary passed in or vardict is None then returns NumPy arrays in the globals() dictionary (all NumPy arrays in the namespace).  Parameters 
 
vardictdict, optional


A dictionary possibly containing ndarrays. Default is globals().    Returns 
 
outNone


Returns ‘None’.     Notes Prints out the name, shape, bytes and type of all of the ndarrays present in vardict. Examples >>> a = np.arange(10)
>>> b = np.ones(20)
>>> np.who()
Name            Shape            Bytes            Type
===========================================================
a               10               80               int64
b               20               160              float64
Upper bound on total bytes  =       240
 >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str',
... 'idx':5}
>>> np.who(d)
Name            Shape            Bytes            Type
===========================================================
x               2                16               float64
y               3                24               float64
Upper bound on total bytes  =       40
numpy.zeros   numpy.zeros(shape, dtype=float, order='C', *, like=None)
 
Return a new array of given shape and type, filled with zeros.  Parameters 
 
shapeint or tuple of ints


Shape of the new array, e.g., (2, 3) or 2.  
dtypedata-type, optional


The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.  
order{‘C’, ‘F’}, optional, default: ‘C’


Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.  
likearray_like


Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.  New in version 1.20.0.     Returns 
 
outndarray


Array of zeros with the given shape, dtype, and order.      See also  zeros_like

Return an array of zeros with shape and type of input.  empty

Return a new uninitialized array.  ones

Return a new array setting values to one.  full

Return a new array of given shape filled with value.    Examples >>> np.zeros(5)
array([ 0.,  0.,  0.,  0.,  0.])
 >>> np.zeros((5,), dtype=int)
array([0, 0, 0, 0, 0])
 >>> np.zeros((2, 1))
array([[ 0.],
       [ 0.]])
 >>> s = (2,2)
>>> np.zeros(s)
array([[ 0.,  0.],
       [ 0.,  0.]])
 >>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype
array([(0, 0), (0, 0)],
      dtype=[('x', '<i4'), ('y', '<i4')])
numpy.zeros_like   numpy.zeros_like(a, dtype=None, order='K', subok=True, shape=None)[source]
 
Return an array of zeros with the same shape and type as a given array.  Parameters 
 
aarray_like


The shape and data-type of a define these same attributes of the returned array.  
dtypedata-type, optional


Overrides the data type of the result.  New in version 1.6.0.   
order{‘C’, ‘F’, ‘A’, or ‘K’}, optional


Overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.  New in version 1.6.0.   
subokbool, optional.


If True, then the newly created array will use the sub-class type of a, otherwise it will be a base-class array. Defaults to True.  
shapeint or sequence of ints, optional.


Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.  New in version 1.17.0.     Returns 
 
outndarray


Array of zeros with the same shape and type as a.      See also  empty_like

Return an empty array with shape and type of input.  ones_like

Return an array of ones with shape and type of input.  full_like

Return a new array with shape of input filled with value.  zeros

Return a new array setting values to zero.    Examples >>> x = np.arange(6)
>>> x = x.reshape((2, 3))
>>> x
array([[0, 1, 2],
       [3, 4, 5]])
>>> np.zeros_like(x)
array([[0, 0, 0],
       [0, 0, 0]])
 >>> y = np.arange(3, dtype=float)
>>> y
array([0., 1., 2.])
>>> np.zeros_like(y)
array([0.,  0.,  0.])
paths(*paths, **kws)[source]
 
Apply glob to paths and prepend local_path if needed. Applies glob.glob(…) to each path in the sequence (if needed) and pre-pends the local_path if needed. Because this is called on all source lists, this allows wildcard characters to be specified in lists of sources for extension modules and libraries and scripts and allows path-names be relative to the source directory.
Poly1d  Basics  
poly1d(c_or_r[, r, variable]) A one-dimensional polynomial class.  
polyval(p, x) Evaluate a polynomial at specific values.  
poly(seq_of_zeros) Find the coefficients of a polynomial with the given sequence of roots.  
roots(p) Return the roots of a polynomial with coefficients given in p.     Fitting  
polyfit(x, y, deg[, rcond, full, w, cov]) Least squares polynomial fit.     Calculus  
polyder(p[, m]) Return the derivative of the specified order of a polynomial.  
polyint(p[, m, k]) Return an antiderivative (indefinite integral) of a polynomial.     Arithmetic  
polyadd(a1, a2) Find the sum of two polynomials.  
polydiv(u, v) Returns the quotient and remainder of polynomial division.  
polymul(a1, a2) Find the product of two polynomials.  
polysub(a1, a2) Difference (subtraction) of two polynomials.     Warnings  
RankWarning Issued by polyfit when the Vandermonde matrix is rank deficient.
numpy.poly1d.__call__ method   poly1d.__call__(val)[source]
 
Call self as a function.
numpy.poly1d.deriv method   poly1d.deriv(m=1)[source]
 
Return a derivative of this polynomial. Refer to polyder for full documentation.  See also  polyder

equivalent function
numpy.poly1d.integ method   poly1d.integ(m=1, k=0)[source]
 
Return an antiderivative (indefinite integral) of this polynomial. Refer to polyint for full documentation.  See also  polyint

equivalent function
numpy.polynomial.chebyshev.cheb2poly   polynomial.chebyshev.cheb2poly(c)[source]
 
Convert a Chebyshev series to a polynomial. Convert an array representing the coefficients of a Chebyshev 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 Chebyshev 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  poly2cheb
  Notes The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples >>> from numpy import polynomial as P
>>> c = P.Chebyshev(range(4))
>>> c
Chebyshev([0., 1., 2., 3.], domain=[-1,  1], window=[-1,  1])
>>> p = c.convert(kind=P.Polynomial)
>>> p
Polynomial([-2., -8.,  4., 12.], domain=[-1.,  1.], window=[-1.,  1.])
>>> P.chebyshev.cheb2poly(range(4))
array([-2.,  -8.,   4.,  12.])
numpy.polynomial.chebyshev.chebadd   polynomial.chebyshev.chebadd(c1, c2)[source]
 
Add one Chebyshev series to another. Returns the sum of two Chebyshev series c1 + c2. The arguments are sequences of coefficients ordered from lowest order term to highest, i.e., [1,2,3] represents the series T_0 + 2*T_1 + 3*T_2.  Parameters 
 
c1, c2array_like


1-D arrays of Chebyshev series coefficients ordered from low to high.    Returns 
 
outndarray


Array representing the Chebyshev series of their sum.      See also  
chebsub, chebmulx, chebmul, chebdiv, chebpow

  Notes Unlike multiplication, division, etc., the sum of two Chebyshev series is a Chebyshev 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 import chebyshev as C
>>> c1 = (1,2,3)
>>> c2 = (3,2,1)
>>> C.chebadd(c1,c2)
array([4., 4., 4.])
numpy.polynomial.chebyshev.chebcompanion   polynomial.chebyshev.chebcompanion(c)[source]
 
Return the scaled companion matrix of c. The basis polynomials are scaled so that the companion matrix is symmetric when c is a Chebyshev 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 Chebyshev 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.polynomial.chebyshev.chebder   polynomial.chebyshev.chebder(c, m=1, scl=1, axis=0)[source]
 
Differentiate a Chebyshev series. Returns the Chebyshev 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*T_0 + 2*T_1 + 3*T_2 while [[1,2],[1,2]] represents 1*T_0(x)*T_0(y) + 1*T_1(x)*T_0(y) +
2*T_0(x)*T_1(y) + 2*T_1(x)*T_1(y) if axis=0 is x and axis=1 is y.  Parameters 
 
carray_like


Array of Chebyshev 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


Chebyshev series of the derivative.      See also  chebint
  Notes In general, the result of differentiating 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 import chebyshev as C
>>> c = (1,2,3,4)
>>> C.chebder(c)
array([14., 12., 24.])
>>> C.chebder(c,3)
array([96.])
>>> C.chebder(c,scl=-1)
array([-14., -12., -24.])
>>> C.chebder(c,2,-1)
array([12.,  96.])
numpy.polynomial.chebyshev.chebdiv   polynomial.chebyshev.chebdiv(c1, c2)[source]
 
Divide one Chebyshev series by another. Returns the quotient-with-remainder of two Chebyshev series c1 / c2. The arguments are sequences of coefficients from lowest order “term” to highest, e.g., [1,2,3] represents the series T_0 + 2*T_1 + 3*T_2.  Parameters 
 
c1, c2array_like


1-D arrays of Chebyshev series coefficients ordered from low to high.    Returns 
 
[quo, rem]ndarrays


Of Chebyshev series coefficients representing the quotient and remainder.      See also  
chebadd, chebsub, chebmulx, chebmul, chebpow

  Notes In general, the (polynomial) division of one C-series by another results in quotient and remainder terms that are not in the Chebyshev polynomial basis set. Thus, to express these results as C-series, it is typically necessary to “reproject” the results onto said basis set, which typically produces “unintuitive” (but correct) results; see Examples section below. Examples >>> from numpy.polynomial import chebyshev as C
>>> c1 = (1,2,3)
>>> c2 = (3,2,1)
>>> C.chebdiv(c1,c2) # quotient "intuitive," remainder not
(array([3.]), array([-8., -4.]))
>>> c2 = (0,1,2,3)
>>> C.chebdiv(c2,c1) # neither "intuitive"
(array([0., 2.]), array([-2., -4.]))
numpy.polynomial.chebyshev.chebfromroots   polynomial.chebyshev.chebfromroots(roots)[source]
 
Generate a Chebyshev series with given roots. The function returns the coefficients of the polynomial  \[p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),\] in Chebyshev 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 * T_1(x) + ... + c_n * T_n(x)\] The coefficient of the last term is not generally 1 for monic polynomials in Chebyshev 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.hermite_e.hermefromroots
  Examples >>> import numpy.polynomial.chebyshev as C
>>> C.chebfromroots((-1,0,1)) # x^3 - x relative to the standard basis
array([ 0.  , -0.25,  0.  ,  0.25])
>>> j = complex(0,1)
>>> C.chebfromroots((-j,j)) # x^2 + 1 relative to the standard basis
array([1.5+0.j, 0. +0.j, 0.5+0.j])
numpy.polynomial.chebyshev.chebgauss   polynomial.chebyshev.chebgauss(deg)[source]
 
Gauss-Chebyshev quadrature. Computes the sample points and weights for Gauss-Chebyshev quadrature. These sample points and weights will correctly integrate polynomials of degree \(2*deg - 1\) or less over the interval \([-1, 1]\) with the weight function \(f(x) = 1/\sqrt{1 - 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. For Gauss-Chebyshev there are closed form solutions for the sample points and weights. If n = deg, then  \[x_i = \cos(\pi (2 i - 1) / (2 n))\]  \[w_i = \pi / n\]
numpy.polynomial.chebyshev.chebgrid2d   polynomial.chebyshev.chebgrid2d(x, y, c)[source]
 
Evaluate a 2-D Chebyshev series on the Cartesian product of x and y. This function returns the values:  \[p(a,b) = \sum_{i,j} c_{i,j} * T_i(a) * T_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 + y.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 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 Chebyshev series at points in the Cartesian product of x and y.      See also  
chebval, chebval2d, chebval3d, chebgrid3d

  Notes  New in version 1.7.0.
numpy.polynomial.chebyshev.chebgrid3d   polynomial.chebyshev.chebgrid3d(x, y, z, c)[source]
 
Evaluate a 3-D Chebyshev 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} * T_i(a) * T_j(b) * T_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  
chebval, chebval2d, chebgrid2d, chebval3d

  Notes  New in version 1.7.0.
numpy.polynomial.chebyshev.chebint   polynomial.chebyshev.chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0)[source]
 
Integrate a Chebyshev series. Returns the Chebyshev 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 T_0 + 2*T_1 + 3*T_2 while [[1,2],[1,2]] represents 1*T_0(x)*T_0(y) + 1*T_1(x)*T_0(y) + 2*T_0(x)*T_1(y) +
2*T_1(x)*T_1(y) if axis=0 is x and axis=1 is y.  Parameters 
 
carray_like


Array of Chebyshev 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 zero is the first value in the list, the value of the second integral at zero 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


C-series coefficients of the integral.    Raises 
 ValueError

If m < 1, len(k) > m, np.ndim(lbnd) != 0, or np.ndim(scl) != 0.      See also  chebder
  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 import chebyshev as C
>>> c = (1,2,3)
>>> C.chebint(c)
array([ 0.5, -0.5,  0.5,  0.5])
>>> C.chebint(c,3)
array([ 0.03125   , -0.1875    ,  0.04166667, -0.05208333,  0.01041667, # may vary
    0.00625   ])
>>> C.chebint(c, k=3)
array([ 3.5, -0.5,  0.5,  0.5])
>>> C.chebint(c,lbnd=-2)
array([ 8.5, -0.5,  0.5,  0.5])
>>> C.chebint(c,scl=-2)
array([-1.,  1., -1., -1.])
numpy.polynomial.chebyshev.chebinterpolate   polynomial.chebyshev.chebinterpolate(func, deg, args=())[source]
 
Interpolate a function at the Chebyshev points of the first kind. Returns the Chebyshev series that interpolates func at the Chebyshev points of the first kind in the interval [-1, 1]. The interpolating series tends to a minmax approximation to func with increasing deg if the function is continuous in the interval.  New in version 1.14.0.   Parameters 
 
funcfunction


The function to be approximated. It must be a function of a single variable of the form f(x, a, b, c...), where a, b, c... are extra arguments passed in the args parameter.  
degint


Degree of the interpolating polynomial  
argstuple, optional


Extra arguments to be used in the function call. Default is no extra arguments.    Returns 
 
coefndarray, shape (deg + 1,)


Chebyshev coefficients of the interpolating series ordered from low to high.     Notes The Chebyshev polynomials used in the interpolation are orthogonal when sampled at the Chebyshev points of the first kind. If it is desired to constrain some of the coefficients they can simply be set to the desired value after the interpolation, no new interpolation or fit is needed. This is especially useful if it is known apriori that some of coefficients are zero. For instance, if the function is even then the coefficients of the terms of odd degree in the result can be set to zero. Examples >>> import numpy.polynomial.chebyshev as C
>>> C.chebfromfunction(lambda x: np.tanh(x) + 0.5, 8)
array([  5.00000000e-01,   8.11675684e-01,  -9.86864911e-17,
        -5.42457905e-02,  -2.71387850e-16,   4.51658839e-03,
         2.46716228e-17,  -3.79694221e-04,  -3.26899002e-16])
numpy.polynomial.chebyshev.chebline   polynomial.chebyshev.chebline(off, scl)[source]
 
Chebyshev 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 Chebyshev series for off + scl*x.      See also  numpy.polynomial.polynomial.polyline
numpy.polynomial.legendre.legline
numpy.polynomial.laguerre.lagline
numpy.polynomial.hermite.hermline
numpy.polynomial.hermite_e.hermeline
  Examples >>> import numpy.polynomial.chebyshev as C
>>> C.chebline(3,2)
array([3, 2])
>>> C.chebval(-3, C.chebline(3,2)) # should be -3
-3.0