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

Function lagmulx

numpy/polynomial/laguerre.py:388–439  ·  view source on GitHub ↗

Multiply a Laguerre series by x. Multiply the Laguerre series `c` by x, where x is the independent variable. Parameters ---------- c : array_like 1-D array of Laguerre series coefficients ordered from low to high. Returns ------- out : ndarray

(c)

Source from the content-addressed store, hash-verified

386
387
388def lagmulx(c):
389 """Multiply a Laguerre series by x.
390
391 Multiply the Laguerre series `c` by x, where x is the independent
392 variable.
393
394
395 Parameters
396 ----------
397 c : array_like
398 1-D array of Laguerre series coefficients ordered from low to
399 high.
400
401 Returns
402 -------
403 out : ndarray
404 Array representing the result of the multiplication.
405
406 See Also
407 --------
408 lagadd, lagsub, lagmul, lagdiv, lagpow
409
410 Notes
411 -----
412 The multiplication uses the recursion relationship for Laguerre
413 polynomials in the form
414
415 .. math::
416
417 xP_i(x) = (-(i + 1)*P_{i + 1}(x) + (2i + 1)P_{i}(x) - iP_{i - 1}(x))
418
419 Examples
420 --------
421 >>> from numpy.polynomial.laguerre import lagmulx
422 >>> lagmulx([1, 2, 3])
423 array([-1., -1., 11., -9.])
424
425 """
426 # c is a trimmed copy
427 [c] = pu.as_series([c])
428 # The zero series needs special treatment
429 if len(c) == 1 and c[0] == 0:
430 return c
431
432 prd = np.empty(len(c) + 1, dtype=c.dtype)
433 prd[0] = c[0]
434 prd[1] = -c[0]
435 for i in range(1, len(c)):
436 prd[i + 1] = -c[i]*(i + 1)
437 prd[i] += c[i]*(2*i + 1)
438 prd[i - 1] -= c[i]*i
439 return prd
440
441
442def lagmul(c1, c2):

Callers 2

poly2lagFunction · 0.85
lagmulFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected