MCPcopy Create free account
hub / github.com/numpy/numpy / hermeval

Function hermeval

numpy/polynomial/hermite_e.py:795–887  ·  view source on GitHub ↗

Evaluate an HermiteE series at points x. If `c` is of length `n + 1`, this function returns the value: .. math:: 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

(x, c, tensor=True)

Source from the content-addressed store, hash-verified

793
794
795def hermeval(x, c, tensor=True):
796 """
797 Evaluate an HermiteE series at points x.
798
799 If `c` is of length `n + 1`, this function returns the value:
800
801 .. math:: p(x) = c_0 * He_0(x) + c_1 * He_1(x) + ... + c_n * He_n(x)
802
803 The parameter `x` is converted to an array only if it is a tuple or a
804 list, otherwise it is treated as a scalar. In either case, either `x`
805 or its elements must support multiplication and addition both with
806 themselves and with the elements of `c`.
807
808 If `c` is a 1-D array, then `p(x)` will have the same shape as `x`. If
809 `c` is multidimensional, then the shape of the result depends on the
810 value of `tensor`. If `tensor` is true the shape will be c.shape[1:] +
811 x.shape. If `tensor` is false the shape will be c.shape[1:]. Note that
812 scalars have shape (,).
813
814 Trailing zeros in the coefficients will be used in the evaluation, so
815 they should be avoided if efficiency is a concern.
816
817 Parameters
818 ----------
819 x : array_like, compatible object
820 If `x` is a list or tuple, it is converted to an ndarray, otherwise
821 it is left unchanged and treated as a scalar. In either case, `x`
822 or its elements must support addition and multiplication with
823 with themselves and with the elements of `c`.
824 c : array_like
825 Array of coefficients ordered so that the coefficients for terms of
826 degree n are contained in c[n]. If `c` is multidimensional the
827 remaining indices enumerate multiple polynomials. In the two
828 dimensional case the coefficients may be thought of as stored in
829 the columns of `c`.
830 tensor : boolean, optional
831 If True, the shape of the coefficient array is extended with ones
832 on the right, one for each dimension of `x`. Scalars have dimension 0
833 for this action. The result is that every column of coefficients in
834 `c` is evaluated for every element of `x`. If False, `x` is broadcast
835 over the columns of `c` for the evaluation. This keyword is useful
836 when `c` is multidimensional. The default value is True.
837
838 .. versionadded:: 1.7.0
839
840 Returns
841 -------
842 values : ndarray, algebra_like
843 The shape of the return value is described above.
844
845 See Also
846 --------
847 hermeval2d, hermegrid2d, hermeval3d, hermegrid3d
848
849 Notes
850 -----
851 The evaluation uses Clenshaw recursion, aka synthetic division.
852

Callers 1

hermeintFunction · 0.85

Calls 2

astypeMethod · 0.80
reshapeMethod · 0.80

Tested by

no test coverage detected