
    ^Mh	                         d Z ddlZddlmZ 	 ddlZn# e$ r Y nw xY wd Zd Zd Z	d Z
d Zd	Zd
Zd Zedk    r e             dS dS )z
Precompute coefficients of Temme's asymptotic expansion for gammainc.

This takes about 8 hours to run on a 2.3 GHz Macbook Pro with 4GB ram.

Sources:
[1] NIST, "Digital Library of Mathematical Functions",
    https://dlmf.nist.gov/

    N)lagrange_inversionc                 d   t          j        d          dz  g}t          d|           D ]}|d         |z  }t          dt          |                    D ]}|||         ||          z  |dz   z  z  }||d         dt          j        d          |dz   z  z   z  z  }|                    |           |S )za_k from DLMF 5.11.6      r   )mpsqrtrangelenmpfappend)nakakjs        f/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/special/_precompute/gammainc_asy.py	compute_ar      s    	AA1a[[  rU1Wq#a&&!! 	% 	%A!A$q!u*a!e$$BB
adAq		1q5))**	H    c                 b    t          d| z            fdt          |           D             }|S )zg_k from DLMF 5.11.3/5.11.5r   c                 |    g | ]8}t          j        d           t          j        d|          z  d |z           z  9S )r   g      ?)r   r	   rf).0r   r   s     r   
<listcomp>zcompute_g.<locals>.<listcomp>#   s=    ;;;QBE#qMM	!!AaC&	(;;;r   )r   r
   )r   gr   s     @r   	compute_gr       s6    !A#A;;;;%((;;;AHr   c                     | dk    r/t          j        d| t          j        | dz             z
  z            S | dk     r0t          j        d| t          j        | dz             z
  z             S dS )z6Function from DLMF 8.12.1 shifted to be centered at 0.r   r   r   )r   r	   log)lams    r   etar    '   sh    
Qwwwq#sQw/0111	q3a012222qr   c                 \    t          j        t          d| dz
            }t          |          S )zalpha_n from DLMF 8.12.13r   r   )r   taylorr    r   )r   coeffss     r   compute_alphar$   1   s'    YsAq1u%%Ff%%%r   c           	      b   |d| z  z   }t          j        d           dz  g}t          |dz             }t          d|          D ]&}|                    |dz   ||dz            z             '|g}t          |           }t          d|           D ]|}g }	t          |d|z  z
            D ]M}|	                    d|z  ||         z  |d         |         z  |dz   ||dz
           |dz            z  z              N|                    |	           }t          |           D ]}||         d|         ||<   |S )zd_{k, n} from DLMF 8.12.12r   r      r   r   N)r   r   r$   r
   r   r   )
KNMd0alphar   dr   r   dks
             r   	compute_dr.   7   sM   	AaCA6!99*Q,B!a%  E1a[[ & &
		1q5%!*$%%%%	A!A1a[[  q1Q3w 	B 	BAIIrAgadl1Q47*a!eQqsVAaC[-@@AAAA	1XX  tBQBx!Hr   z/* This file was automatically generated by _precomp/gammainc.py.
 * Do not edit it manually!
 */

#ifndef IGAM_H
#define IGAM_H

#define K {}
#define N {}

static const double d[K][N] =
{{z
#endif
c                  p   t          t                     d} d}t          j        d          5  t	          | |          }d d d            n# 1 swxY w Y   t
          j                            t
          j                            t                    ddd          }t          |dz   d          5 }|                    t                              | |                     t          |          D ]\  }}d |D             }|                    d	           |                    d
                    |                     || dz
  k     r|                    d           m|                    d           |                    t                     d d d            n# 1 swxY w Y   t          j        |dz   |           d S )N   2   z..cepheszigam.hz.newwc                 >    g | ]}t          j        |d dd          S )   r   )	min_fixed	max_fixed)r   nstr)r   xs     r   r   zmain.<locals>.<listcomp>h   s+    III271bA;;;IIIr   {z, r   z},
z}};
)print__doc__r   workdpsr.   ospathjoindirname__file__openwriteheaderformat	enumeratefooterrename)r'   r(   r,   fnfr   rows          r   mainrM   ^   s   	'NNN
A
A	B  aOO              	bgooh//x	J	JB	b6k3		 
1	a##$$$ll 	! 	!FAsIISIIICGGCLLLGGDIIcNN###1q5yy    	
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Ib6k2s$   A

AA,CFFF__main__)r<   r>   scipy.special._precompute.utilsr   mpmathr   ImportErrorr   r   r    r$   r.   rE   rH   rM   __name__ r   r   <module>rT      s   	 	 
			 > > > > > >	 	 	 	D		 	 	    & & &  (    * zDFFFFF s    