MCPcopy Create free account
hub / github.com/numpy/numpy / lagmul

Function lagmul

numpy/polynomial/laguerre.py:442–505  ·  view source on GitHub ↗

Multiply one Laguerre series by another. Returns the product of two Laguerre series `c1` * `c2`. The arguments are sequences of coefficients, from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2

(c1, c2)

Source from the content-addressed store, hash-verified

440
441
442def lagmul(c1, c2):
443 """
444 Multiply one Laguerre series by another.
445
446 Returns the product of two Laguerre series `c1` * `c2`. The arguments
447 are sequences of coefficients, from lowest order "term" to highest,
448 e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
449
450 Parameters
451 ----------
452 c1, c2 : array_like
453 1-D arrays of Laguerre series coefficients ordered from low to
454 high.
455
456 Returns
457 -------
458 out : ndarray
459 Of Laguerre series coefficients representing their product.
460
461 See Also
462 --------
463 lagadd, lagsub, lagmulx, lagdiv, lagpow
464
465 Notes
466 -----
467 In general, the (polynomial) product of two C-series results in terms
468 that are not in the Laguerre polynomial basis set. Thus, to express
469 the product as a Laguerre series, it is necessary to "reproject" the
470 product onto said basis set, which may produce "unintuitive" (but
471 correct) results; see Examples section below.
472
473 Examples
474 --------
475 >>> from numpy.polynomial.laguerre import lagmul
476 >>> lagmul([1, 2, 3], [0, 1, 2])
477 array([ 8., -13., 38., -51., 36.])
478
479 """
480 # s1, s2 are trimmed copies
481 [c1, c2] = pu.as_series([c1, c2])
482
483 if len(c1) > len(c2):
484 c = c2
485 xs = c1
486 else:
487 c = c1
488 xs = c2
489
490 if len(c) == 1:
491 c0 = c[0]*xs
492 c1 = 0
493 elif len(c) == 2:
494 c0 = c[0]*xs
495 c1 = c[1]*xs
496 else:
497 nd = len(c)
498 c0 = c[-2]*xs
499 c1 = c[-1]*xs

Callers

nothing calls this directly

Calls 3

lagsubFunction · 0.85
lagaddFunction · 0.85
lagmulxFunction · 0.85

Tested by

no test coverage detected