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

Function hermefromroots

numpy/polynomial/hermite_e.py:256–309  ·  view source on GitHub ↗

Generate a HermiteE series with given roots. The function returns the coefficients of the polynomial .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), in HermiteE form, where the `r_n` are the roots specified in `roots`. If a zero has multiplicity n, then it must appe

(roots)

Source from the content-addressed store, hash-verified

254
255
256def hermefromroots(roots):
257 """
258 Generate a HermiteE series with given roots.
259
260 The function returns the coefficients of the polynomial
261
262 .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
263
264 in HermiteE form, where the `r_n` are the roots specified in `roots`.
265 If a zero has multiplicity n, then it must appear in `roots` n times.
266 For instance, if 2 is a root of multiplicity three and 3 is a root of
267 multiplicity 2, then `roots` looks something like [2, 2, 2, 3, 3]. The
268 roots can appear in any order.
269
270 If the returned coefficients are `c`, then
271
272 .. math:: p(x) = c_0 + c_1 * He_1(x) + ... + c_n * He_n(x)
273
274 The coefficient of the last term is not generally 1 for monic
275 polynomials in HermiteE form.
276
277 Parameters
278 ----------
279 roots : array_like
280 Sequence containing the roots.
281
282 Returns
283 -------
284 out : ndarray
285 1-D array of coefficients. If all roots are real then `out` is a
286 real array, if some of the roots are complex, then `out` is complex
287 even if all the coefficients in the result are real (see Examples
288 below).
289
290 See Also
291 --------
292 numpy.polynomial.polynomial.polyfromroots
293 numpy.polynomial.legendre.legfromroots
294 numpy.polynomial.laguerre.lagfromroots
295 numpy.polynomial.hermite.hermfromroots
296 numpy.polynomial.chebyshev.chebfromroots
297
298 Examples
299 --------
300 >>> from numpy.polynomial.hermite_e import hermefromroots, hermeval
301 >>> coef = hermefromroots((-1, 0, 1))
302 >>> hermeval((-1, 0, 1), coef)
303 array([0., 0., 0.])
304 >>> coef = hermefromroots((-1j, 1j))
305 >>> hermeval((-1j, 1j), coef)
306 array([0.+0.j, 0.+0.j])
307
308 """
309 return pu._fromroots(hermeline, hermemul, roots)
310
311
312def hermeadd(c1, c2):

Callers

nothing calls this directly

Calls 1

_fromrootsMethod · 0.80

Tested by

no test coverage detected