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

Function hermemulx

numpy/polynomial/hermite_e.py:392–438  ·  view source on GitHub ↗

Multiply a Hermite series by x. Multiply the Hermite series `c` by x, where x is the independent variable. Parameters ---------- c : array_like 1-D array of Hermite series coefficients ordered from low to high. Returns ------- out : ndarray

(c)

Source from the content-addressed store, hash-verified

390
391
392def hermemulx(c):
393 """Multiply a Hermite series by x.
394
395 Multiply the Hermite series `c` by x, where x is the independent
396 variable.
397
398
399 Parameters
400 ----------
401 c : array_like
402 1-D array of Hermite series coefficients ordered from low to
403 high.
404
405 Returns
406 -------
407 out : ndarray
408 Array representing the result of the multiplication.
409
410 Notes
411 -----
412 The multiplication uses the recursion relationship for Hermite
413 polynomials in the form
414
415 .. math::
416
417 xP_i(x) = (P_{i + 1}(x) + iP_{i - 1}(x)))
418
419 Examples
420 --------
421 >>> from numpy.polynomial.hermite_e import hermemulx
422 >>> hermemulx([1, 2, 3])
423 array([2., 7., 2., 3.])
424
425 """
426 # c is a trimmed copy
427 [c] = pu.as_series([c])
428 # The zero series needs special treatment
429 if len(c) == 1 and c[0] == 0:
430 return c
431
432 prd = np.empty(len(c) + 1, dtype=c.dtype)
433 prd[0] = c[0]*0
434 prd[1] = c[0]
435 for i in range(1, len(c)):
436 prd[i + 1] = c[i]
437 prd[i - 1] += c[i]*i
438 return prd
439
440
441def hermemul(c1, c2):

Callers 2

poly2hermeFunction · 0.85
hermemulFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected