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

Function poly2herme

numpy/polynomial/hermite_e.py:97–140  ·  view source on GitHub ↗

poly2herme(pol) 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

(pol)

Source from the content-addressed store, hash-verified

95
96
97def poly2herme(pol):
98 """
99 poly2herme(pol)
100
101 Convert a polynomial to a Hermite series.
102
103 Convert an array representing the coefficients of a polynomial (relative
104 to the "standard" basis) ordered from lowest degree to highest, to an
105 array of the coefficients of the equivalent Hermite series, ordered
106 from lowest to highest degree.
107
108 Parameters
109 ----------
110 pol : array_like
111 1-D array containing the polynomial coefficients
112
113 Returns
114 -------
115 c : ndarray
116 1-D array containing the coefficients of the equivalent Hermite
117 series.
118
119 See Also
120 --------
121 herme2poly
122
123 Notes
124 -----
125 The easy way to do conversions between polynomial basis sets
126 is to use the convert method of a class instance.
127
128 Examples
129 --------
130 >>> from numpy.polynomial.hermite_e import poly2herme
131 >>> poly2herme(np.arange(4))
132 array([ 2., 10., 2., 3.])
133
134 """
135 [pol] = pu.as_series([pol])
136 deg = len(pol) - 1
137 res = 0
138 for i in range(deg, -1, -1):
139 res = hermeadd(hermemulx(res), pol[i])
140 return res
141
142
143def herme2poly(c):

Callers

nothing calls this directly

Calls 2

hermeaddFunction · 0.85
hermemulxFunction · 0.85

Tested by

no test coverage detected