Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.polydiv

numpy.polydiv(u,v)[source]

Returns the quotient and remainder of polynomial division.

The input arrays are the coefficients (including any coefficientsequal to zero) of the “numerator” (dividend) and “denominator”(divisor) polynomials, respectively.

Parameters:
u:array_like or poly1d

Dividend polynomial’s coefficients.

v:array_like or poly1d

Divisor polynomial’s coefficients.

Returns:
q:ndarray

Coefficients, including those equal to zero, of the quotient.

r:ndarray

Coefficients, including those equal to zero, of the remainder.

Notes

Bothu andv must be 0-d or 1-d (ndim = 0 or 1), butu.ndim neednot equalv.ndim. In other words, all four possible combinations -u.ndim=v.ndim=0,u.ndim=v.ndim=1,u.ndim=1,v.ndim=0, andu.ndim=0,v.ndim=1 - work.

Examples

\frac{3x^2 + 5x + 2}{2x + 1} = 1.5x + 1.75, remainder 0.25

>>>x=np.array([3.0,5.0,2.0])>>>y=np.array([2.0,1.0])>>>np.polydiv(x,y)(array([ 1.5 ,  1.75]), array([ 0.25]))

Previous topic

numpy.polyadd

Next topic

numpy.polymul

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp