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

Function lagval

numpy/polynomial/laguerre.py:801–893  ·  view source on GitHub ↗

Evaluate a Laguerre series at points x. If `c` is of length `n + 1`, this function returns the value: .. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_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

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

Callers 2

lagintFunction · 0.85
laggaussFunction · 0.85

Calls 2

astypeMethod · 0.80
reshapeMethod · 0.80

Tested by

no test coverage detected