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

Function hermval

numpy/polynomial/hermite.py:802–895  ·  view source on GitHub ↗

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

(x, c, tensor=True)

Source from the content-addressed store, hash-verified

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

Callers 1

hermintFunction · 0.85

Calls 2

astypeMethod · 0.80
reshapeMethod · 0.80

Tested by

no test coverage detected