Add one Legendre series to another. Returns the sum of two Legendre series `c1` + `c2`. The arguments are sequences of coefficients ordered from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : a
(c1, c2)
| 320 | |
| 321 | |
| 322 | def legadd(c1, c2): |
| 323 | """ |
| 324 | Add one Legendre series to another. |
| 325 | |
| 326 | Returns the sum of two Legendre series `c1` + `c2`. The arguments |
| 327 | are sequences of coefficients ordered from lowest order term to |
| 328 | highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. |
| 329 | |
| 330 | Parameters |
| 331 | ---------- |
| 332 | c1, c2 : array_like |
| 333 | 1-D arrays of Legendre series coefficients ordered from low to |
| 334 | high. |
| 335 | |
| 336 | Returns |
| 337 | ------- |
| 338 | out : ndarray |
| 339 | Array representing the Legendre series of their sum. |
| 340 | |
| 341 | See Also |
| 342 | -------- |
| 343 | legsub, legmulx, legmul, legdiv, legpow |
| 344 | |
| 345 | Notes |
| 346 | ----- |
| 347 | Unlike multiplication, division, etc., the sum of two Legendre series |
| 348 | is a Legendre series (without having to "reproject" the result onto |
| 349 | the basis set) so addition, just like that of "standard" polynomials, |
| 350 | is simply "component-wise." |
| 351 | |
| 352 | Examples |
| 353 | -------- |
| 354 | >>> from numpy.polynomial import legendre as L |
| 355 | >>> c1 = (1,2,3) |
| 356 | >>> c2 = (3,2,1) |
| 357 | >>> L.legadd(c1,c2) |
| 358 | array([4., 4., 4.]) |
| 359 | |
| 360 | """ |
| 361 | return pu._add(c1, c2) |
| 362 | |
| 363 | |
| 364 | def legsub(c1, c2): |