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