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

Function legdiv

numpy/polynomial/legendre.py:532–578  ·  view source on GitHub ↗

Divide one Legendre series by another. Returns the quotient-with-remainder of two Legendre 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)

Source from the content-addressed store, hash-verified

530
531
532def legdiv(c1, c2):
533 """
534 Divide one Legendre series by another.
535
536 Returns the quotient-with-remainder of two Legendre series
537 `c1` / `c2`. The arguments are sequences of coefficients from lowest
538 order "term" to highest, e.g., [1,2,3] represents the series
539 ``P_0 + 2*P_1 + 3*P_2``.
540
541 Parameters
542 ----------
543 c1, c2 : array_like
544 1-D arrays of Legendre series coefficients ordered from low to
545 high.
546
547 Returns
548 -------
549 quo, rem : ndarrays
550 Of Legendre series coefficients representing the quotient and
551 remainder.
552
553 See Also
554 --------
555 legadd, legsub, legmulx, legmul, legpow
556
557 Notes
558 -----
559 In general, the (polynomial) division of one Legendre series by another
560 results in quotient and remainder terms that are not in the Legendre
561 polynomial basis set. Thus, to express these results as a Legendre
562 series, it is necessary to "reproject" the results onto the Legendre
563 basis set, which may produce "unintuitive" (but correct) results; see
564 Examples section below.
565
566 Examples
567 --------
568 >>> from numpy.polynomial import legendre as L
569 >>> c1 = (1,2,3)
570 >>> c2 = (3,2,1)
571 >>> L.legdiv(c1,c2) # quotient "intuitive," remainder not
572 (array([3.]), array([-8., -4.]))
573 >>> c2 = (0,1,2,3)
574 >>> L.legdiv(c2,c1) # neither "intuitive"
575 (array([-0.07407407, 1.66666667]), array([-1.03703704, -2.51851852])) # may vary
576
577 """
578 return pu._div(legmul, c1, c2)
579
580
581def legpow(c, pow, maxpower=16):

Callers

nothing calls this directly

Calls 1

_divMethod · 0.80

Tested by

no test coverage detected