관리-도구
편집 파일: laguerre.cpython-37.pyc
B ��Fd]� � @ s� d Z ddlmZmZmZ ddlZddlZddlm Z ddlmZ ddl mZ ddlmZ dd d ddd ddddddddddddddddddd d!d"d#d$d%d&gZejZd'd� Zd(d� Ze�ddg�Ze�dg�Ze�dg�Ze�dd)g�Zd*d� Zd+d� Zd,d � Zd-d� Zd.d� Z d/d� Z!d0d� Z"dEd2d�Z#dFd3d�Z$dg dddfd4d�Z%dGd6d�Z&d7d� Z'd8d � Z(d9d� Z)d:d!� Z*d;d� Z+d<d"� Z,d=d#� Z-dHd?d�Z.d@d$� Z/dAd� Z0dBd%� Z1dCd&� Z2G dDd� de�Z3dS )Ia� Objects for dealing with Laguerre series. This module provides a number of objects (mostly functions) useful for dealing with Laguerre series, including a `Laguerre` 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`). Constants --------- - `lagdomain` -- Laguerre series default domain, [-1,1]. - `lagzero` -- Laguerre series that evaluates identically to 0. - `lagone` -- Laguerre series that evaluates identically to 1. - `lagx` -- Laguerre series for the identity map, ``f(x) = x``. Arithmetic ---------- - `lagmulx` -- multiply a Laguerre series in ``P_i(x)`` by ``x``. - `lagadd` -- add two Laguerre series. - `lagsub` -- subtract one Laguerre series from another. - `lagmul` -- multiply two Laguerre series. - `lagdiv` -- divide one Laguerre series by another. - `lagval` -- evaluate a Laguerre series at given points. - `lagval2d` -- evaluate a 2D Laguerre series at given points. - `lagval3d` -- evaluate a 3D Laguerre series at given points. - `laggrid2d` -- evaluate a 2D Laguerre series on a Cartesian product. - `laggrid3d` -- evaluate a 3D Laguerre series on a Cartesian product. Calculus -------- - `lagder` -- differentiate a Laguerre series. - `lagint` -- integrate a Laguerre series. Misc Functions -------------- - `lagfromroots` -- create a Laguerre series with specified roots. - `lagroots` -- find the roots of a Laguerre series. - `lagvander` -- Vandermonde-like matrix for Laguerre polynomials. - `lagvander2d` -- Vandermonde-like matrix for 2D power series. - `lagvander3d` -- Vandermonde-like matrix for 3D power series. - `laggauss` -- Gauss-Laguerre quadrature, points and weights. - `lagweight` -- Laguerre weight function. - `lagcompanion` -- symmetrized companion matrix in Laguerre form. - `lagfit` -- least-squares fit returning a Laguerre series. - `lagtrim` -- trim leading coefficients from a Laguerre series. - `lagline` -- Laguerre series of given straight line. - `lag2poly` -- convert a Laguerre series to a polynomial. - `poly2lag` -- convert a polynomial to a Laguerre series. Classes ------- - `Laguerre` -- A Laguerre series class. See also -------- `numpy.polynomial` � )�division�absolute_import�print_functionN)�normalize_axis_index� )� polyutils)�ABCPolyBase�lagzero�lagone�lagx� lagdomain�lagline�lagadd�lagsub�lagmulx�lagmul�lagdiv�lagpow�lagval�lagder�lagint�lag2poly�poly2lag�lagfromroots� lagvander�lagfit�lagtrim�lagroots�Laguerre�lagval2d�lagval3d� laggrid2d� laggrid3d�lagvander2d�lagvander3d�lagcompanion�laggauss� lagweightc C sJ t �| g�\} t| �d }d}x&t|dd�D ]}tt|�| | �}q,W |S )a� poly2lag(pol) Convert a polynomial to a Laguerre 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 Laguerre 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 Laguerre series. See Also -------- lag2poly Notes ----- The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples -------- >>> from numpy.polynomial.laguerre import poly2lag >>> poly2lag(np.arange(4)) array([ 23., -63., 58., -18.]) r r ���)�pu� as_series�len�ranger r )Zpol�deg�res�i� r0 �L/opt/alt/python37/lib64/python3.7/site-packages/numpy/polynomial/laguerre.pyr Q s &c C s� ddl m}m}m} t�| g�\} t| �}|dkr6| S | d }| d }x^t|d dd�D ]J}|}|| |d ||d | �}|||d| d | ||��| �}qXW ||||||���S dS )a Convert a Laguerre series to a polynomial. Convert an array representing the coefficients of a Laguerre 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 Laguerre 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 -------- poly2lag Notes ----- The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples -------- >>> from numpy.polynomial.laguerre import lag2poly >>> lag2poly([ 23., -63., 58., -18.]) array([ 0., 1., 2., 3.]) r )�polyadd�polysub�polymulx���r( � N)� polynomialr2 r3 r4 r) r* r+ r, ) �cr2 r3 r4 �n�c0�c1r/ �tmpr0 r0 r1 r s &(r( c C s, |dkrt �| | | g�S t �| g�S dS )a Laguerre series whose graph is a straight line. Parameters ---------- off, scl : scalars The specified line is given by ``off + scl*x``. Returns ------- y : ndarray This module's representation of the Laguerre series for ``off + scl*x``. See Also -------- polyline, chebline Examples -------- >>> from numpy.polynomial.laguerre import lagline, lagval >>> lagval(0,lagline(3, 2)) 3.0 >>> lagval(1,lagline(3, 2)) 5.0 r N)�np�array)�off�sclr0 r0 r1 r � s c s� t | �dkrt�d�S tj| gdd�\} | �� dd� | D ��t ��}xT|dkr�t|d�\� }� �fdd�t� �D �}|r�t|d �d �|d<