Subtract one polynomial from another. Returns the difference 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 : arr
(c1, c2)
| 249 | |
| 250 | |
| 251 | def polysub(c1, c2): |
| 252 | """ |
| 253 | Subtract one polynomial from another. |
| 254 | |
| 255 | Returns the difference of two polynomials `c1` - `c2`. The arguments |
| 256 | are sequences of coefficients from lowest order term to highest, i.e., |
| 257 | [1,2,3] represents the polynomial ``1 + 2*x + 3*x**2``. |
| 258 | |
| 259 | Parameters |
| 260 | ---------- |
| 261 | c1, c2 : array_like |
| 262 | 1-D arrays of polynomial coefficients ordered from low to |
| 263 | high. |
| 264 | |
| 265 | Returns |
| 266 | ------- |
| 267 | out : ndarray |
| 268 | Of coefficients representing their difference. |
| 269 | |
| 270 | See Also |
| 271 | -------- |
| 272 | polyadd, polymulx, polymul, polydiv, polypow |
| 273 | |
| 274 | Examples |
| 275 | -------- |
| 276 | >>> from numpy.polynomial import polynomial as P |
| 277 | >>> c1 = (1,2,3) |
| 278 | >>> c2 = (3,2,1) |
| 279 | >>> P.polysub(c1,c2) |
| 280 | array([-2., 0., 2.]) |
| 281 | >>> P.polysub(c2,c1) # -P.polysub(c1,c2) |
| 282 | array([ 2., 0., -2.]) |
| 283 | |
| 284 | """ |
| 285 | return pu._sub(c1, c2) |
| 286 | |
| 287 | |
| 288 | def polymulx(c): |