Multiply a Chebyshev series by x. Multiply the polynomial `c` by x, where x is the independent variable. Parameters ---------- c : array_like 1-D array of Chebyshev series coefficients ordered from low to high. Returns ------- out : ndarray
(c)
| 653 | |
| 654 | |
| 655 | def chebmulx(c): |
| 656 | """Multiply a Chebyshev series by x. |
| 657 | |
| 658 | Multiply the polynomial `c` by x, where x is the independent |
| 659 | variable. |
| 660 | |
| 661 | |
| 662 | Parameters |
| 663 | ---------- |
| 664 | c : array_like |
| 665 | 1-D array of Chebyshev series coefficients ordered from low to |
| 666 | high. |
| 667 | |
| 668 | Returns |
| 669 | ------- |
| 670 | out : ndarray |
| 671 | Array representing the result of the multiplication. |
| 672 | |
| 673 | Notes |
| 674 | ----- |
| 675 | |
| 676 | .. versionadded:: 1.5.0 |
| 677 | |
| 678 | Examples |
| 679 | -------- |
| 680 | >>> from numpy.polynomial import chebyshev as C |
| 681 | >>> C.chebmulx([1,2,3]) |
| 682 | array([1. , 2.5, 1. , 1.5]) |
| 683 | |
| 684 | """ |
| 685 | # c is a trimmed copy |
| 686 | [c] = pu.as_series([c]) |
| 687 | # The zero series needs special treatment |
| 688 | if len(c) == 1 and c[0] == 0: |
| 689 | return c |
| 690 | |
| 691 | prd = np.empty(len(c) + 1, dtype=c.dtype) |
| 692 | prd[0] = c[0]*0 |
| 693 | prd[1] = c[0] |
| 694 | if len(c) > 1: |
| 695 | tmp = c[1:]/2 |
| 696 | prd[2:] = tmp |
| 697 | prd[0:-2] += tmp |
| 698 | return prd |
| 699 | |
| 700 | |
| 701 | def chebmul(c1, c2): |