/usr/local/lib64/python3.6/site-packages/numpy/polynomial/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/numpy/polynomial/__pycache__/legendre.cpython-36.pyc (50081B)
3
Eg @ s d Z ddlZddljZddlmZ ddlm Z
ddlmZ ddd d
ddd
ddddddddddddddddddd d!d"d#d$d%gZ
e
jZd&d Zd'd ZejdCdgZejdgZejdgZejddgZd(d Zd)d Zd*d Zd+d
Zd,d Zd-d Zd.d ZdDd0dZdEd1dZdg dddfd2dZ dFd4dZ!d5d Z"d6d Z#d7d Z$d8d Z%d9d Z&d:d! Z'd;d" Z(dGd=dZ)d>d# Z*d?d Z+d@d$ Z,dAd% Z-G dBd deZ.dS )Ha
==================================================
Legendre Series (:mod:`numpy.polynomial.legendre`)
==================================================
This module provides a number of objects (mostly functions) useful for
dealing with Legendre series, including a `Legendre` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with such polynomials is in the
docstring for its "parent" sub-package, `numpy.polynomial`).
Classes
-------
.. autosummary::
:toctree: generated/
Legendre
Constants
---------
.. autosummary::
:toctree: generated/
legdomain
legzero
legone
legx
Arithmetic
----------
.. autosummary::
:toctree: generated/
legadd
legsub
legmulx
legmul
legdiv
legpow
legval
legval2d
legval3d
leggrid2d
leggrid3d
Calculus
--------
.. autosummary::
:toctree: generated/
legder
legint
Misc Functions
--------------
.. autosummary::
:toctree: generated/
legfromroots
legroots
legvander
legvander2d
legvander3d
leggauss
legweight
legcompanion
legfit
legtrim
legline
leg2poly
poly2leg
See also
--------
numpy.polynomial
N)normalize_axis_index ) polyutils)ABCPolyBaselegzerolegonelegx legdomainleglinelegaddlegsublegmulxlegmullegdivlegpowlegvallegderlegintleg2polypoly2leglegfromroots legvanderlegfitlegtrimlegrootsLegendrelegval2dlegval3d leggrid2d leggrid3dlegvander2dlegvander3dlegcompanionleggauss legweightc C sJ t j| g\} t| d }d}x&t|ddD ]}tt|| | }q,W |S )a.
Convert a polynomial to a Legendre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Legendre series, ordered
from lowest to highest degree.
Parameters
----------
pol : array_like
1-D array containing the polynomial coefficients
Returns
-------
c : ndarray
1-D array containing the coefficients of the equivalent Legendre
series.
See Also
--------
leg2poly
Notes
-----
The easy way to do conversions between polynomial basis sets
is to use the convert method of a class instance.
Examples
--------
>>> from numpy import polynomial as P
>>> p = P.Polynomial(np.arange(4))
>>> p
Polynomial([0., 1., 2., 3.], domain=[-1, 1], window=[-1, 1])
>>> c = P.Legendre(P.legendre.poly2leg(p.coef))
>>> c
Legendre([ 1. , 3.25, 1. , 0.75], domain=[-1, 1], window=[-1, 1]) # may vary
r r r% )pu as_serieslenranger r
)Zpoldegresi r- E/usr/local/lib64/python3.6/site-packages/numpy/polynomial/legendre.pyr d s (c C s ddl m}m}m} tj| g\} t| }|dk r6| S | d }| d }xXt|d ddD ]D}|}|| |d ||d | }||||d| d | }qXW ||||S dS ) a
Convert a Legendre series to a polynomial.
Convert an array representing the coefficients of a Legendre series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to highest degree.
Parameters
----------
c : array_like
1-D array containing the Legendre series coefficients, ordered
from lowest order term to highest.
Returns
-------
pol : ndarray
1-D array containing the coefficients of the equivalent polynomial
(relative to the "standard" basis) ordered from lowest order term
to highest.
See Also
--------
poly2leg
Notes
-----
The easy way to do conversions between polynomial basis sets
is to use the convert method of a class instance.
Examples
--------
>>> from numpy import polynomial as P
>>> c = P.Legendre(range(4))
>>> c
Legendre([0., 1., 2., 3.], domain=[-1, 1], window=[-1, 1])
>>> p = c.convert(kind=P.Polynomial)
>>> p
Polynomial([-1. , -3.5, 3. , 7.5], domain=[-1., 1.], window=[-1., 1.])
>>> P.leg2poly(range(4))
array([-1. , -3.5, 3. , 7.5])
r )polyaddpolysubpolymulx Nr% r% )Z
polynomialr/ r0 r1 r&