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