Add one polynomial to another. Returns the sum of two polynomials `c1` + `c2`. The arguments are sequences of coefficients from lowest order term to highest, i.e., [1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``. Parameters ---------- c1, c2 : array_like
(c1, c2)
| 213 | |
| 214 | |
| 215 | def polyadd(c1, c2): |
| 216 | """ |
| 217 | Add one polynomial to another. |
| 218 | |
| 219 | Returns the sum of two polynomials `c1` + `c2`. The arguments are |
| 220 | sequences of coefficients from lowest order term to highest, i.e., |
| 221 | [1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``. |
| 222 | |
| 223 | Parameters |
| 224 | ---------- |
| 225 | c1, c2 : array_like |
| 226 | 1-D arrays of polynomial coefficients ordered from low to high. |
| 227 | |
| 228 | Returns |
| 229 | ------- |
| 230 | out : ndarray |
| 231 | The coefficient array representing their sum. |
| 232 | |
| 233 | See Also |
| 234 | -------- |
| 235 | polysub, polymulx, polymul, polydiv, polypow |
| 236 | |
| 237 | Examples |
| 238 | -------- |
| 239 | >>> from numpy.polynomial import polynomial as P |
| 240 | >>> c1 = (1,2,3) |
| 241 | >>> c2 = (3,2,1) |
| 242 | >>> sum = P.polyadd(c1,c2); sum |
| 243 | array([4., 4., 4.]) |
| 244 | >>> P.polyval(2, sum) # 4 + 4(2) + 4(2**2) |
| 245 | 28.0 |
| 246 | |
| 247 | """ |
| 248 | return pu._add(c1, c2) |
| 249 | |
| 250 | |
| 251 | def polysub(c1, c2): |