polynomial.polynomial.
polyvalfromroots
在点x处计算由其根指定的多项式。
如果 r 长度 N ,此函数返回值
System Message: WARNING/2 (p(x)=\prod n=1 ^ n(x-r_n))
latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...��x)=\prod n=1 ^ n(x-r_n)\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 468 bytes). Transcript written on math.log.
参数 x 只有当数组是元组或列表时才转换为数组,否则将被视为标量。在任何一种情况下,要么 x 或者它的元素必须支持自身和元素的乘法和加法。 r .
如果 r 是一维数组,然后 p(x) 将具有与相同的形状 x . 如果 r 是多维的,则结果的形状取决于 tensor .如果 tensor is ` ` true``形状将为r.shape [1:] +x.shape;也就是说,每个多项式的每个值都是 `x .如果 tensor 是 False ,形状为R。 [1:] ;也就是说,每个多项式只针对 x . 请注意,标量具有形状(,)。
False
1.12 新版功能.
如果 x 是一个列表或元组,它被转换为一个ndarray,否则它将保持不变并被视为一个标量。在任何一种情况下, x 或者其元素必须支持与自身和元素的加法和乘法 r .
根数组。如果 r 是多维的,第一个索引是根索引,而其余的索引枚举多个多项式。例如,在二维情况下,每个多项式的根可以被认为是存储在 r .
如果为真,则根数组的形状将用右边的形状扩展,每个维度的形状都扩展一个。 x . 此操作的标量的维度为0。结果是每列系数 r 对的每个元素进行了评估 x . 如果是假的, x 是通过以下列广播的 r 用于评估。当 r 是多维的。默认值为true。
上面描述了返回数组的形状。
参见
polyroots
polyfromroots
polyval
实例
>>> from numpy.polynomial.polynomial import polyvalfromroots >>> polyvalfromroots(1, [1,2,3]) 0.0 >>> a = np.arange(4).reshape(2,2) >>> a array([[0, 1], [2, 3]]) >>> polyvalfromroots(a, [-1, 0, 1]) array([[-0., 0.], [ 6., 24.]]) >>> r = np.arange(-2, 2).reshape(2,2) # multidimensional coefficients >>> r # each column of r defines one polynomial array([[-2, -1], [ 0, 1]]) >>> b = [-2, 1] >>> polyvalfromroots(b, r, tensor=True) array([[-0., 3.], [ 3., 0.]]) >>> polyvalfromroots(b, r, tensor=False) array([-0., 0.])