L i#>ddlmZmZmZmZmZmZddlmZdgZ ddZ y))zerosasarrayeyepoly1dhstackr_)linalgpadeNct|}|!t|dz |z }|dkr td|dkr td||z}|t|dz kDr td|d|dz}t|dz|dz|j}t |dz|f|j}t d|dzD]}|d|ddd ||d|f<t |dz|dzD]}|||z |ddd ||ddf<t||f}tj||}|d|dz} td ||dzdf} t| dddt| dddfS) a Return Pade approximation to a polynomial as the ratio of two polynomials. Parameters ---------- an : (N,) array_like Taylor series coefficients. m : int The order of the returned approximating polynomial `q`. n : int, optional The order of the returned approximating polynomial `p`. By default, the order is ``len(an)-1-m``. Returns ------- p, q : Polynomial class The Pade approximation of the polynomial defined by `an` is ``p(x)/q(x)``. Examples -------- >>> import numpy as np >>> from scipy.interpolate import pade >>> e_exp = [1.0, 1.0, 1.0/2.0, 1.0/6.0, 1.0/24.0, 1.0/120.0] >>> p, q = pade(e_exp, 2) >>> e_exp.reverse() >>> e_poly = np.poly1d(e_exp) Compare ``e_poly(x)`` and the Pade approximation ``p(x)/q(x)`` >>> e_poly(1) 2.7166666666666668 >>> p(1)/q(1) 2.7179487179487181 Nrz.Order of q must be smaller than len(an)-1.z&Order of p must be greater than 0.z0Order of q+p must be smaller than len(an).)dtypeg?) rlen ValueErrorrr rrangerr solverr) anmnNAkjBkjrowCpqpqs ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/scipy/interpolate/_pade.pyr r sN By GaK!O q5MN N1uABB AA3r719}KLL DQqSB ac1Q3bhh 'C 1a )CQ!}*Tc(DbD))CH *QqS!A#,#a%}dd++CE ,SzA a B 4AaCA 31Q34=A !DbD'?F1TrT7O ++)N) numpyrrrrrrscipyr __all__r rrr$s99 (<,r