§
    JŠtjEr  ã                   óô  — d Z ddlmZ ddlmZmZ d„ Z G d„ de¦  «        ZdJd„Z	dKd„Z
d„ Zd„ Zd„ Zd„ Zd„ ddfd„ ddfd„ ddfd„ ddfd„ ddfd„ ddfd„ ddfd „ d!dfd"„ d#dfd$„ d%dfd&„ d'dfd(„ d)dfd*„ d+dfd,„ d-dfd.„ d/dfd0„ d1dfd2„ d3dfd4„ d5dfd6„ d7dfd8„ d9dfd:„ d;dfd<„ d=dfd>„ d?dfd@„ dAdfdB„ dCdfdD„ dEdfdF„ dGdfgZg ddd
d
fdH„Ze	e_	        e
e_
        ee_        edIk    rddlZ ej        ¦   «          dS dS )Lzs
Implements the PSLQ algorithm for integer relation detection,
and derivative algorithms for constant recognition.
é   )Úxrange)Ú	int_typesÚ
sqrt_fixedc                 ó$   — | d|dz
  z  z   |z	  |z  S ©Nr   © )ÚxÚprecs     úS/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/mpmath/identification.pyÚround_fixedr   
   s   € Ø�!�d˜1‘f‘+Ñ 4Ñ'¨DÑ0Ð0ó    c                   ó   — e Zd ZdS )ÚIdentificationMethodsN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r      s   € € € € € Ø€Dr   r   Néè  éd   Fc                 ób  ‡ ‡"‡#‡$— t          |¦  «        }|dk     rt          d¦  «        ‚‰ j        Š$‰$dk     rt          d¦  «        ‚|r&‰$t          d|¦  «        z  dk     rt	          d¦  «         t          ‰$dz  ¦  «        }|€‰                      d¦  «        | z  }n‰                      |¦  «        }d	}‰$|z  Š$|r't	          d
‰$‰                      |¦  «        fz  ¦  «         ‰  	                    |‰$¦  «        }|sJ ‚dgˆ ˆ$fd„|D ¦   «         z   }t          d„ |dd…         D ¦   «         ¦  «        }	|	st          d¦  «        ‚|	|dz  k     r|rt	          d¦  «         dS t          d‰$z  dz  ‰$¦  «        }
i }i Š"i }t          d|dz   ¦  «        D ]4Š#t          d|dz   ¦  «        D ]}‰#|k    ‰$z  x|‰#|f<   ‰"‰#|f<   d|‰#|f<   ŒŒ5dgdg|z  z   }t          d|dz   ¦  «        D ]>}d}t          ||dz   ¦  «        D ]}|||         dz  ‰$z	  z  }Œt          |‰$¦  «        ||<   Œ?|d         }|dd…         }t          d|dz   ¦  «        D ]$}||         ‰$z  |z  ||<   ||         ‰$z  |z  ||<   Œ%t          d|dz   ¦  «        D ]¢Š#t          ‰#dz   |¦  «        D ]	}d|‰#|f<   Œ
‰#|dz
  k    r,|‰#         r|‰#dz            ‰$z  |‰#         z  |‰#‰#f<   nd|‰#‰#f<   t          d‰#¦  «        D ]=}||         ||dz            z  }|r|‰#          ||         z  ‰$z  |z  |‰#|f<   Œ6d|‰#|f<   Œ>Œ£t          d|dz   ¦  «        D ]ñŠ#t          ‰#dz
  dd¦  «        D ]Ú}|||f         r't          |‰#|f         ‰$z  |||f         z  ‰$¦  «        }nŒ4||         ||‰#         z  ‰$z	  z   ||<   t          d|dz   ¦  «        D ]"}|‰#|f         ||||f         z  ‰$z	  z
  |‰#|f<   Œ#t          d|dz   ¦  «        D ]B}|‰#|f         ||||f         z  ‰$z	  z
  |‰#|f<   ‰"||f         |‰"|‰#f         z  ‰$z	  z   ‰"||f<   ŒCŒÛŒòt          |¦  «        D �]V}d}d}t          d|¦  «        D ]4Š#|‰#‰#f         }|
‰#z  t          |¦  «        z  ‰$‰#dz
  z  z	  }||k    r‰#}|}Œ5||dz            ||         c||<   ||dz   <   t          d|dz   ¦  «        D ]'Š#||dz   ‰#f         ||‰#f         c||‰#f<   ||dz   ‰#f<   Œ(t          d|dz   ¦  «        D ]'Š#||dz   ‰#f         ||‰#f         c||‰#f<   ||dz   ‰#f<   Œ(t          d|dz   ¦  «        D ]'Š#‰"‰#|dz   f         ‰"‰#|f         c‰"‰#|f<   ‰"‰#|dz   f<   Œ(||dz
  k    r®t          |||f         dz  |||dz   f         dz  z   ‰$z	  ‰$¦  «        }|s �n|||f         ‰$z  |z  }|||dz   f         ‰$z  |z  }t          ||dz   ¦  «        D ]CŠ#|‰#|f         }|‰#|dz   f         }||z  ||z  z   ‰$z	  |‰#|f<   | |z  ||z  z   ‰$z	  |‰#|dz   f<   ŒDt          |dz   |dz   ¦  «        D �]
Š#t          t          ‰#dz
  |dz   ¦  «        dd¦  «        D ]á}	 t          |‰#|f         ‰$z  |||f         z  ‰$¦  «        }n# t           $ r Y  n«w xY w||         ||‰#         z  ‰$z	  z   ||<   t          d|dz   ¦  «        D ]"}|‰#|f         ||||f         z  ‰$z	  z
  |‰#|f<   Œ#t          d|dz   ¦  «        D ]B}|‰#|f         ||||f         z  ‰$z	  z
  |‰#|f<   ‰"||f         |‰"|‰#f         z  ‰$z	  z   ‰"||f<   ŒCŒâ�Œ|‰$z  }t          d|dz   ¦  «        D ]µŠ#t          |‰#         ¦  «        }||k     rˆˆ"ˆ#ˆ$fd„t          d|dz   ¦  «        D ¦   «         }t          d„ |D ¦   «         ¦  «        |k     rJ|rBt	          d||‰                      |‰                      d¦  «        ‰$z  z  d¦  «        fz  ¦  «         |c c S t          ||¦  «        }Œ¶t          d„ |                     ¦   «         D ¦   «         ¦  «        } | rdd‰$z  z  | z  ‰$z	  }!|!dz  }!n‰ j        }!|rCt	          d||‰                      |‰                      d¦  «        ‰$z  z  d¦  «        |!fz  ¦  «         |!|k    r n�ŒX|r&t	          d||fz  ¦  «         t	          d|!z  ¦  «         dS )a¾  
    Given a vector of real numbers `x = [x_0, x_1, ..., x_n]`, ``pslq(x)``
    uses the PSLQ algorithm to find a list of integers
    `[c_0, c_1, ..., c_n]` such that

    .. math ::

        |c_1 x_1 + c_2 x_2 + ... + c_n x_n| < \mathrm{tol}

    and such that `\max |c_k| < \mathrm{maxcoeff}`. If no such vector
    exists, :func:`~mpmath.pslq` returns ``None``. The tolerance defaults to
    3/4 of the working precision.

    **Examples**

    Find rational approximations for `\pi`::

        >>> from mpmath import *
        >>> mp.dps = 15; mp.pretty = True
        >>> pslq([-1, pi], tol=0.01)
        [22, 7]
        >>> pslq([-1, pi], tol=0.001)
        [355, 113]
        >>> mpf(22)/7; mpf(355)/113; +pi
        3.14285714285714
        3.14159292035398
        3.14159265358979

    Pi is not a rational number with denominator less than 1000::

        >>> pslq([-1, pi])
        >>>

    To within the standard precision, it can however be approximated
    by at least one rational number with denominator less than `10^{12}`::

        >>> p, q = pslq([-1, pi], maxcoeff=10**12)
        >>> print(p); print(q)
        238410049439
        75888275702
        >>> mpf(p)/q
        3.14159265358979

    The PSLQ algorithm can be applied to long vectors. For example,
    we can investigate the rational (in)dependence of integer square
    roots::

        >>> mp.dps = 30
        >>> pslq([sqrt(n) for n in range(2, 5+1)])
        >>>
        >>> pslq([sqrt(n) for n in range(2, 6+1)])
        >>>
        >>> pslq([sqrt(n) for n in range(2, 8+1)])
        [2, 0, 0, 0, 0, 0, -1]

    **Machin formulas**

    A famous formula for `\pi` is Machin's,

    .. math ::

        \frac{\pi}{4} = 4 \operatorname{acot} 5 - \operatorname{acot} 239

    There are actually infinitely many formulas of this type. Two
    others are

    .. math ::

        \frac{\pi}{4} = \operatorname{acot} 1

        \frac{\pi}{4} = 12 \operatorname{acot} 49 + 32 \operatorname{acot} 57
            + 5 \operatorname{acot} 239 + 12 \operatorname{acot} 110443

    We can easily verify the formulas using the PSLQ algorithm::

        >>> mp.dps = 30
        >>> pslq([pi/4, acot(1)])
        [1, -1]
        >>> pslq([pi/4, acot(5), acot(239)])
        [1, -4, 1]
        >>> pslq([pi/4, acot(49), acot(57), acot(239), acot(110443)])
        [1, -12, -32, 5, -12]

    We could try to generate a custom Machin-like formula by running
    the PSLQ algorithm with a few inverse cotangent values, for example
    acot(2), acot(3) ... acot(10). Unfortunately, there is a linear
    dependence among these values, resulting in only that dependence
    being detected, with a zero coefficient for `\pi`::

        >>> pslq([pi] + [acot(n) for n in range(2,11)])
        [0, 1, -1, 0, 0, 0, -1, 0, 0, 0]

    We get better luck by removing linearly dependent terms::

        >>> pslq([pi] + [acot(n) for n in range(2,11) if n not in (3, 5)])
        [1, -8, 0, 0, 4, 0, 0, 0]

    In other words, we found the following formula::

        >>> 8*acot(2) - 4*acot(7)
        3.14159265358979323846264338328
        >>> +pi
        3.14159265358979323846264338328

    **Algorithm**

    This is a fairly direct translation to Python of the pseudocode given by
    David Bailey, "The PSLQ Integer Relation Algorithm":
    http://www.cecm.sfu.ca/organics/papers/bailey/paper/html/node3.html

    The present implementation uses fixed-point instead of floating-point
    arithmetic, since this is significantly (about 7x) faster.
    é   zn cannot be less than 2é5   zprec cannot be less than 53é   z*Warning: precision for PSLQ may be too lowg      è?Né<   zPSLQ using prec %i and tol %sc                 ób   •— g | ]+}‰                      ‰                     |¦  «        ‰¦  «        ‘Œ,S r   )Úto_fixedÚmpf)Ú.0ÚxkÚctxr
   s     €€r   ú
<listcomp>zpslq.<locals>.<listcomp>¤   s1   ø€ Ð>Ð>Ð>°b�#—,’,˜sŸwšw r™{œ{¨DÑ1Ô1Ð>Ð>Ð>r   c              3   ó4   K  — | ]}t          |¦  «        V — Œd S ©N©Úabs)r   Úxxs     r   ú	<genexpr>zpslq.<locals>.<genexpr>§   s(   è è € Ð'Ð'˜2�s�2‰wŒwÐ'Ð'Ð'Ð'Ð'Ð'r   r   z)PSLQ requires a vector of nonzero numbersr   z#STOPPING: (one number is too small)é   é   é    éÿÿÿÿc           	      ó`   •— g | ]*}t          t          ‰|‰f         ‰¦  «        ‰z	  ¦  «        ‘Œ+S r   )Úintr   )r   ÚjÚBÚir
   s     €€€r   r    zpslq.<locals>.<listcomp>  sD   ø€ ð ð ð À!•s�; q¨¨1¨¤v¨tÑ4Ô4¸Ñ<Ñ=Ô=ð ð ð r   c              3   ó4   K  — | ]}t          |¦  «        V — Œd S r"   r#   )r   Úvs     r   r&   zpslq.<locals>.<genexpr>  s(   è è € Ð+Ð+ !•s˜1‘v”vÐ+Ð+Ð+Ð+Ð+Ð+r   z'FOUND relation at iter %i/%i, error: %sc              3   ó4   K  — | ]}t          |¦  «        V — Œd S r"   r#   )r   Úhs     r   r&   zpslq.<locals>.<genexpr>'  s(   è è € Ð1Ð1 •c˜!‘f”fÐ1Ð1Ð1Ð1Ð1Ð1r   z%i/%i:  Error: %8s   Norm: %szCANCELLING after step %i/%i.z2Could not find an integer relation. Norm bound: %s)ÚlenÚ
ValueErrorr
   ÚmaxÚprintr,   r   ÚconvertÚnstrr   Úminr   r   Úranger   r$   ÚZeroDivisionErrorÚvaluesÚinf)%r   r	   ÚtolÚmaxcoeffÚmaxstepsÚverboseÚnÚtargetÚextraÚminxÚgÚAÚHr-   ÚsÚkÚtÚyÚsjj1ÚREPÚmÚszmaxr3   ÚszÚt0Út1Út2Út3Út4Úbest_errÚerrÚvecÚrecnormÚnormr.   r/   r
   s%   `                                 @@@r   Úpslqr]      sp  øøøø€ õf 	ˆA‰Œ€AØˆ1‚u€uÝÐ2Ñ3Ô3Ð3ð Œ8€DØˆb‚y€yÝÐ6Ñ7Ô7Ð7àð <�4�3˜q ™8œ8Ñ# aÒ'Ð'ÝÐ:Ñ;Ô;Ð;å�˜‘ÑÔ€Fà
€{Ø�gŠg�a‰jŒj˜F˜7Ñ#ˆˆà�kŠk˜#ÑÔˆà€EØˆE�M€Dàð GÝÐ-°°s·x²xÀ±}´}Ð0EÑEÑFÔFÐFà
�,Š,�s˜DÑ
!Ô
!€CØ€J€Jˆ3ð 
ˆÐ>Ð>Ð>Ð>Ð>¸AÐ>Ñ>Ô>Ñ>€Aõ Ð'Ð'  1 2 2¤Ð'Ñ'Ô'Ñ'Ô'€DØð FÝÐDÑEÔEÐEØˆc�3‰h‚€Øð 	9ÝÐ7Ñ8Ô8Ð8Øˆtå�A�t‘G˜a‘< Ñ&Ô&€AØ
€AØ
€AØ
€Aõ �A�q˜‘s‰^Œ^ð ð ˆÝ˜˜1˜Q™3‘”ð 	ð 	ˆAØ  !št¨™nÐ,ˆAˆa�ˆc‰F�Q�q˜�s‘VØˆAˆa�ˆc‰FˆFð	ð 
ˆ�!��q‘Ñ€AÝ�A�q˜‘s‰^Œ^ð #ð #ˆØˆÝ˜˜1˜Q™3‘”ð 	#ð 	#ˆAØ�!�A”$˜‘'˜T‘/Ñ"ˆAˆAÝ˜!˜TÑ"Ô"ˆˆ!‰ˆØ	ˆ!Œ€AØ	ˆ!ˆ!ˆ!Œ€AÝ�A�q˜‘s‰^Œ^ð #ð #ˆØ�!”˜‘ Ñ"ˆˆ!‰Ø�!”˜‘ Ñ"ˆˆ!‰ˆå�A�q˜‘s‰^Œ^ð ð ˆÝ˜˜!™˜Q‘”ð 	ð 	ˆAØˆAˆa�ˆc‰FˆFØ��!‘Š8ˆ8Ø�Œtð Ø˜A˜a™Cœ& D™.¨Q¨q¬TÑ1��!�A�#‘�à��!�A�#‘Ý�q˜!‘”ð 	ð 	ˆAØ�Q”4˜˜!˜A™#œ‘;ˆDØð Ø˜aœD˜5  1¤™:¨Ñ,¨tÑ3��!�A�#‘�à��!�A�#‘�ð	õ �A�q˜‘s‰^Œ^ð 5ð 5ˆÝ˜˜!™˜Q Ñ#Ô#ð 	5ð 	5ˆAà��1�Œvð Ý  1 Q 3¤¨4¡°!°A°a°C´&Ñ 8¸$Ñ?Ô?��ð Ø�Q”4˜1˜Q˜qœT™6 T™>Ñ*ˆAˆa‰DÝ˜A˜q ™s‘^”^ð 5ð 5�Ø˜1˜Q˜3œ 1 Q q¨ s¤V¡8¨tÑ#3Ñ4��!�A�#‘�Ý˜A˜q ™s‘^”^ð 5ð 5�Ø˜1˜Q˜3œ 1 Q q¨ s¤V¡8¨tÑ#3Ñ4��!�A�#‘Ø˜1˜Q˜3œ 1 Q q¨ s¤V¡8¨tÑ#3Ñ4��!�A�#‘�ð5ð	5õ �X‰Œð Mñ MˆàˆØˆÝ�q˜!‘”ð 	ð 	ˆAØ�!�A�#”ˆAØ�Q‘$�˜Q™œ‘- T¨1¨Q©3¡ZÑ0ˆBØ�EŠzˆzØ�Ø�øà˜˜1™”v˜q œtˆˆˆ!‰ˆa��!‘‰fÝ˜˜!˜A™#‘”ÐCÐCˆA°1°Q°q±S¸°U´8¸Q¸qÀ¸s¼VÐ 0  ! A #¡¨¨!¨A©#¨a¨%©¨Ý˜˜!˜A™#‘”ÐCÐCˆA°1°Q°q±S¸°U´8¸Q¸qÀ¸s¼VÐ 0  ! A #¡¨¨!¨A©#¨a¨%©¨Ý˜˜!˜A™#‘”ÐCÐCˆA°1°Q°q¸±s°U´8¸Q¸qÀ¸s¼VÐ 0  ! A #¡¨¨!¨A¨a©C¨%©¨à��A‘Š:ˆ:Ý˜Q˜q ˜sœV Q™Y¨¨1¨Q¨q©S¨5¬°1©Ñ4°tÑ;¸TÑBÔBˆBð ð Ø‘Ø�A�a�C”&˜D‘. RÑ'ˆBØ�A�a˜‘c�E”(˜dÑ" rÑ)ˆBÝ˜A˜q ™s‘^”^ð 2ð 2�Ø�q˜�s”V�Ø�q˜˜1™�u”X�Ø˜R™%  2¡™+¨$Ñ.��!�A�#‘Ø˜C ™F 2 b¡5™L¨TÑ1��!�A�a‘C�%‘�å˜˜!™˜Q˜q™SÑ!Ô!ð 	9ñ 	9ˆAÝ�C  !¡ Q q¡S™MœM¨1¨bÑ1Ô1ð 9ð 9�ðÝ# Q q¨ s¤V¨t¡^°a¸¸!¸´fÑ$<¸dÑCÔC�A�Aøå(ð ð ð Ø�E�Eðøøøà˜”t  ! A¤$¡¨4Ñ/Ñ0��!‘Ý  1 Q¡3™œð 9ð 9�AØ˜q ˜sœV q¨¨1¨Q¨3¬¡x°4Ñ'7Ñ8�A�a˜�c‘F�FÝ  1 Q¡3™œð 9ð 9�AØ˜q ˜sœV q¨¨1¨Q¨3¬¡x°4Ñ'7Ñ8�A�a˜�c‘FØ˜q ˜sœV q¨¨1¨Q¨3¬¡x°4Ñ'7Ñ8�A�a˜�c‘F�Fð9ùð ˜T‘>ˆÝ˜˜1˜Q™3‘”ð 	*ð 	*ˆAÝ�a˜”d‘)”)ˆCà�SŠyˆyðð ð ð ð ð Ý�a˜˜!™‘”ðñ ô �åÐ+Ð+ sÐ+Ñ+Ô+Ñ+Ô+¨hÒ6Ð6Øð RÝÐGØ  (¨C¯HªH°S¸3¿7º7À1¹:¼:ÀtÑ;KÑ5KÈQÑ,OÔ,OÐPñQñ Rô Rð Rà�J�J�J�J�JÝ˜3 Ñ)Ô)ˆHˆHõ Ð1Ð1 a§h¢h¡j¤jÐ1Ñ1Ô1Ñ1Ô1ˆØð 	Ø˜1˜T™6‘] wÑ.°4Ñ7ˆDØ�S‰LˆDˆDà”7ˆDØð 	QÝÐ1Ø�h §¢¨°C·G²G¸A±J´JÀÑ4DÑ)DÀaÑ HÔ HÈ$ÐOñPñ Qô Qð Qà�8ÒÐØˆEñ àð KÝÐ,°°X¨Ñ>Ñ?Ô?Ð?ÝÐBÀTÑIÑJÔJÐJØˆ4s   Ù&Y(Ù(
Y6	Ù5Y6	c                 ó0  — |                       |¦  «        }|dk     rt          d¦  «        ‚|dk    rddgS |                       d¦  «        g}t          d|dz   ¦  «        D ]7}|                     ||z  ¦  «          | j        |fi |¤Ž}|�|ddd…         c S Œ8dS )aù  
    ``findpoly(x, n)`` returns the coefficients of an integer
    polynomial `P` of degree at most `n` such that `P(x) \approx 0`.
    If no polynomial having `x` as a root can be found,
    :func:`~mpmath.findpoly` returns ``None``.

    :func:`~mpmath.findpoly` works by successively calling :func:`~mpmath.pslq` with
    the vectors `[1, x]`, `[1, x, x^2]`, `[1, x, x^2, x^3]`, ...,
    `[1, x, x^2, .., x^n]` as input. Keyword arguments given to
    :func:`~mpmath.findpoly` are forwarded verbatim to :func:`~mpmath.pslq`. In
    particular, you can specify a tolerance for `P(x)` with ``tol``
    and a maximum permitted coefficient size with ``maxcoeff``.

    For large values of `n`, it is recommended to run :func:`~mpmath.findpoly`
    at high precision; preferably 50 digits or more.

    **Examples**

    By default (degree `n = 1`), :func:`~mpmath.findpoly` simply finds a linear
    polynomial with a rational root::

        >>> from mpmath import *
        >>> mp.dps = 15; mp.pretty = True
        >>> findpoly(0.7)
        [-10, 7]

    The generated coefficient list is valid input to ``polyval`` and
    ``polyroots``::

        >>> nprint(polyval(findpoly(phi, 2), phi), 1)
        -2.0e-16
        >>> for r in polyroots(findpoly(phi, 2)):
        ...     print(r)
        ...
        -0.618033988749895
        1.61803398874989

    Numbers of the form `m + n \sqrt p` for integers `(m, n, p)` are
    solutions to quadratic equations. As we find here, `1+\sqrt 2`
    is a root of the polynomial `x^2 - 2x - 1`::

        >>> findpoly(1+sqrt(2), 2)
        [1, -2, -1]
        >>> findroot(lambda x: x**2 - 2*x - 1, 1)
        2.4142135623731

    Despite only containing square roots, the following number results
    in a polynomial of degree 4::

        >>> findpoly(sqrt(2)+sqrt(3), 4)
        [1, 0, -10, 0, 1]

    In fact, `x^4 - 10x^2 + 1` is the *minimal polynomial* of
    `r = \sqrt 2 + \sqrt 3`, meaning that a rational polynomial of
    lower degree having `r` as a root does not exist. Given sufficient
    precision, :func:`~mpmath.findpoly` will usually find the correct
    minimal polynomial of a given algebraic number.

    **Non-algebraic numbers**

    If :func:`~mpmath.findpoly` fails to find a polynomial with given
    coefficient size and tolerance constraints, that means no such
    polynomial exists.

    We can verify that `\pi` is not an algebraic number of degree 3 with
    coefficients less than 1000::

        >>> mp.dps = 15
        >>> findpoly(pi, 3)
        >>>

    It is always possible to find an algebraic approximation of a number
    using one (or several) of the following methods:

        1. Increasing the permitted degree
        2. Allowing larger coefficients
        3. Reducing the tolerance

    One example of each method is shown below::

        >>> mp.dps = 15
        >>> findpoly(pi, 4)
        [95, -545, 863, -183, -298]
        >>> findpoly(pi, 3, maxcoeff=10000)
        [836, -1734, -2658, -457]
        >>> findpoly(pi, 3, tol=1e-7)
        [-4, 22, -29, -2]

    It is unknown whether Euler's constant is transcendental (or even
    irrational). We can use :func:`~mpmath.findpoly` to check that if is
    an algebraic number, its minimal polynomial must have degree
    at least 7 and a coefficient of magnitude at least 1000000::

        >>> mp.dps = 200
        >>> findpoly(euler, 6, maxcoeff=10**6, tol=1e-100, maxsteps=1000)
        >>>

    Note that the high precision and strict tolerance is necessary
    for such high-degree runs, since otherwise unwanted low-accuracy
    approximations will be detected. It may also be necessary to set
    maxsteps high to prevent a premature exit (before the coefficient
    bound has been reached). Running with ``verbose=True`` to get an
    idea what is happening can be useful.
    r   zn cannot be less than 1r)   Nr*   )r   r5   r;   Úappendr]   )r   r	   rC   ÚkwargsÚxsr/   Úas          r   Úfindpolyrc   7  s½   € ðR 	�Š�‰
Œ
€AØˆ1‚u€uÝÐ2Ñ3Ô3Ð3ØˆA‚v€vØ�1ˆvˆØ
�'Š'�!‰*Œ*ˆ€BÝ�1�Q�q‘S‰\Œ\ð ð ˆØ
�	Š	�!�Q‘$‰ŒˆØˆCŒH�RÐ"Ð"˜6Ð"Ð"ˆØˆ=Ø�T�T�r�T”7ˆNˆNˆNð ðð r   c                 óX   — | |}}|r	|||z  }}|°	|dk    r
| |z  } ||z  }|dk    r| S | |fS r   r   )ÚpÚqr	   rM   s       r   Úfracgcdrg   ¬  s\   € Øˆa€q€AØ
ð Ø�!�a‘%ˆ1ˆð ð àˆA‚v€vØ	ˆa‰ˆØ	ˆa‰ˆØˆA‚v€vØˆØˆaˆ4€Kr   c                 óÐ  — | d         }| dd …         } g }t          t          | ¦  «        ¦  «        D ]�}| |         }|r�t          | |¦  «        }||         d         }|dk    rd}nd|z   }t          |t          ¦  «        r"|dk    rt          |¦  «        |z   }nd|z  |z   }nd|z  |z   }|                     |¦  «         ŒŽd                     |¦  «        }d	|v sd|v rd
|z   dz   }|pdS )Nr)   r   Ú1Ú Ú*z(%s)z(%s/%s)z + ú+ú(ú)Ú0)r;   r4   rg   Ú
isinstancer   Ústrr_   Újoin)	ÚrÚ	constantsrf   rJ   r/   re   ÚzÚcsÚterms	            r   Ú
pslqstringrx   ·  s  € Ø	ˆ!Œ€AØ	ˆ!ˆ"ˆ"Œ€AØ
€AÝ•3�q‘6”6‰]Œ]ð ð ˆØˆaŒDˆØð 	Ý˜˜˜1‘”ˆAØ˜1”˜a”ˆBØ�SŠyˆyØ��à˜2‘X�Ý˜!�YÑ'Ô'ð ,Ø�q’5�5¥ Q¡¤¨"¡˜$˜$Ø"(¨1¡*°Ñ!2˜$˜$à! A™¨Ñ+�Ø�HŠH�T‰NŒNˆNøØ�
Š
�1‰Œ€AØ
ˆa€x€x�3˜!�8�8Ø�!‰G�c‰MˆØˆ8�€Or   c                 óž  — | d         }| dd …         } g }g }t          t          | ¦  «        ¦  «        D ]×}| |         }|rËt          | |¦  «        }||         d         }t          |t          ¦  «        rLt          |¦  «        dk    r|}	n|›dt          |¦  «        ›�}	||g|dk                                   |	¦  «         ŒŒ|›dt          |d         ¦  «        ›d|d         ›d�}	||g|d         dk                                   |	¦  «         ŒØd                     |¦  «        }d                     |¦  «        }|r|r	d|›d	|›d�S |r|S |rd
|z  S d S )Nr)   r   z**z**(ú/rn   rk   rm   z)/(z1/(%s))r;   r4   rg   rp   r   r$   r_   rr   )
rs   rt   rf   ÚnumÚdenr/   re   ru   rv   rL   s
             r   Ú
prodstringr}   Ï  ss  € Ø	ˆ!Œ€AØ	ˆ!ˆ"ˆ"Œ€AØ
€CØ
€CÝ•3�q‘6”6‰]Œ]ð .ð .ˆØˆaŒDˆØð 		.Ý˜˜˜1‘”ˆAØ˜1”˜a”ˆBÝ˜!�YÑ'Ô'ð .Ý�q‘6”6˜Q’;�; B  Ø02°°µC¸±F´F°FÐ$; Ø�c�˜1˜Qš3”×'Ò'¨Ñ*Ô*Ð*Ð*à%' R R­¨Q¨q¬T©¬¨¨°A°a´D°D°DÐ9�Ø�c�˜1˜Qœ4 š6Ô"×*Ò*¨1Ñ-Ô-Ð-øØ
�(Š(�3‰-Œ-€CØ
�(Š(�3‰-Œ-€CØ
Ð3ˆsÐ3Ð3¨#¨#¨#¨s¨s¨sÐ3Ð3Ø
Ð�3ˆJØ
Ð!�8˜c‘>Ð!Ð!Ð!r   c                 óâ  — |dk     r	| | | }}}| |                       |dz  d|z  |z  z
  ¦  «        z   d|z  z  }| |                       |dz  d|z  |z  z
  ¦  «        z
  d|z  z  }t          ||z
  ¦  «        t          ||z
  ¦  «        k     r2|rd| ›d|dz  d|z  |z  z
  ›dd|z  ›d�}nDdd	|z  |z  ›d
d|z  ›d�}n1|rd| ›d|dz  d|z  |z  z
  ›dd|z  ›d�}ndd	|z  |z  ›d
d|z  ›d�}|S )Nr)   r   r'   z((z+sqrt(z))/rn   z(sqrt(éüÿÿÿz)/z-sqrt(z(-sqrt()Úsqrtr$   )r   rL   rb   ÚbÚcÚu1Úu2rJ   s           r   Úquadraticstringr…   æ  sd  € Øˆ1‚u€uØ��A�2�q�bˆAˆ!ˆØˆ"ˆS�XŠX�a˜‘d˜1˜Q™3˜q™5‘jÑ!Ô!Ñ
! A a¡CÑ	(€BØˆ"ˆS�XŠX�a˜‘d˜1˜Q™3˜q™5‘jÑ!Ô!Ñ
! A a¡CÑ	(€BÝ
ˆ2ˆa‰4�y„y•3�r˜!‘t‘9”9ÒÐØð 	2ð 	2¨A¨2¨2¨2¨a°©d°1°Q±3°q±5©j¨j¨j¸¸1¹¸¸Ð=ˆqˆqð 	2Ø&(¨¡d¨1¡f f f¨Q¨q©S¨S¨SÐ1ˆqˆqàð 	3ð 	3¨A¨2¨2¨2¨a°©d°1°Q±3°q±5©j¨j¨j¸¸1¹¸¸Ð=ˆqˆqð 	3Ø')¨!¡t¨A¡v v v¨a°©c¨c¨cÐ2ˆqØ€Hr   c                 ó   — ||z  S r"   r   ©r   r	   r‚   s      r   ú<lambda>rˆ   ÷  ó
   € �1�Q‘3€ r   z$y/$cr)   c                 ó   — ||z  S r"   r   r‡   s      r   rˆ   rˆ   ø  r‰   r   z$c*$yc                 ó   — ||z  S r"   r   r‡   s      r   rˆ   rˆ   ù  r‰   r   z$c/$yc                 ó   — ||z  dz  S ©Nr   r   r‡   s      r   rˆ   rˆ   ú  ó   € �A�a‘C˜!‘8€ r   zsqrt($y)/$cc                 ó   — ||z  dz  S r�   r   r‡   s      r   rˆ   rˆ   û  rŽ   r   z$c*sqrt($y)c                 ó   — ||z  dz  S r�   r   r‡   s      r   rˆ   rˆ   ü  rŽ   r   z$c/sqrt($y)c                 ó   — ||dz  z  S r�   r   r‡   s      r   rˆ   rˆ   ý  ó   € �1�Q˜‘T‘6€ r   zsqrt($y)/sqrt($c)c                 ó   — |dz  |z  S r�   r   r‡   s      r   rˆ   rˆ   þ  s   € �1�a‘4˜‘6€ r   zsqrt($c)*sqrt($y)c                 ó   — ||dz  z  S r�   r   r‡   s      r   rˆ   rˆ   ÿ  r’   r   zsqrt($c)/sqrt($y)c                 ó2   — |                       ||z  ¦  «        S r"   ©r€   r‡   s      r   rˆ   rˆ      ó   € �3—8’8˜A˜a™C‘=”=€ r   z$y**2/$cc                 ó2   — |                       ||z  ¦  «        S r"   r–   r‡   s      r   rˆ   rˆ     r—   r   z$c*$y**2c                 ó2   — |                       ||z  ¦  «        S r"   r–   r‡   s      r   rˆ   rˆ     r—   r   z$c/$y**2c                 ó2   — ||                       |¦  «        z  S r"   r–   r‡   s      r   rˆ   rˆ     ó   € �1�S—X’X˜a‘[”[‘=€ r   z$y**2/$c**2c                 ó2   — |                       |¦  «        |z  S r"   r–   r‡   s      r   rˆ   rˆ     s   € �3—8’8˜A‘;”;˜q‘=€ r   z$c**2*$y**2c                 ó2   — ||                       |¦  «        z  S r"   r–   r‡   s      r   rˆ   rˆ     r›   r   z$c**2/$y**2c                 ó2   — |                       ||z  ¦  «        S r"   ©Úexpr‡   s      r   rˆ   rˆ     ó   € �3—7’7˜1˜Q™3‘<”<€ r   z
log($y)/$cc                 ó2   — |                       ||z  ¦  «        S r"   rŸ   r‡   s      r   rˆ   rˆ     r¡   r   z
$c*log($y)c                 ó2   — |                       ||z  ¦  «        S r"   rŸ   r‡   s      r   rˆ   rˆ     r¡   r   z
$c/log($y)c                 ó2   — ||                       |¦  «        z  S r"   rŸ   r‡   s      r   rˆ   rˆ   	  ó   € �1�S—W’W˜Q‘Z”Z‘<€ r   z
log($y/$c)c                 ó2   — |                       |¦  «        |z  S r"   rŸ   r‡   s      r   rˆ   rˆ   
  s   € �3—7’7˜1‘:”:˜a‘<€ r   z
log($c*$y)c                 ó2   — ||                       |¦  «        z  S r"   rŸ   r‡   s      r   rˆ   rˆ     r¥   r   z
log($c/$y)c                 ó2   — |                       ||z  ¦  «        S r"   ©Úlnr‡   s      r   rˆ   rˆ     ó   € �3—6’6˜!˜A™#‘;”;€ r   z
exp($y)/$cc                 ó2   — |                       ||z  ¦  «        S r"   r©   r‡   s      r   rˆ   rˆ     r«   r   z
$c*exp($y)c                 ó2   — |                       ||z  ¦  «        S r"   r©   r‡   s      r   rˆ   rˆ     r«   r   z
$c/exp($y)c                 ó2   — ||                       |¦  «        z  S r"   r©   r‡   s      r   rˆ   rˆ     ó   € �1�S—V’V˜A‘Y”Y‘;€ r   z
exp($y/$c)c                 ó2   — |                       |¦  «        |z  S r"   r©   r‡   s      r   rˆ   rˆ     s   € �3—6’6˜!‘9”9˜Q‘;€ r   z
exp($c*$y)c                 ó2   — ||                       |¦  «        z  S r"   r©   r‡   s      r   rˆ   rˆ     r¯   r   z
exp($c/$y)c           	      ó$  ‡ ‡‡‡‡— g Šˆˆfd„}‰                       |¦  «        }|dk    r|rdgS dS |dk     r2‰                      | ||||‰¦  «        }|€|S |rd„ |D ¦   «         S d|z  S |r‰                       |¦  «        }n
‰ j        dz  }|}	|rzt          |t          ¦  «        r.ˆ fd„t          |                     ¦   «         ¦  «        D ¦   «         }n9t	          ˆ fd	„t          ‰ ¦  «        D ¦   «         ¦  «        Šˆfd
„|D ¦   «         }ng }dd„ |D ¦   «         vr‰                       d¦  «        dfg|z   }t          D �]Ï\  }
}}|D �]Ä\  }}|r|dk    rŒ |
‰ ||¦  «        }t          |¦  «        |	dz  k    st          |¦  «        |k     rŒF‰  
                    |gd„ |D ¦   «         z   ||	¦  «        }d}|�6t          d„ |D ¦   «         ¦  «        |	k    r|d         rt          ||¦  «        }n”‰  
                    ‰ j        ||dz  g||	¦  «        }|�pt          |¦  «        dk    r]|d         rU|\  }}}t          t          |¦  «        t          |¦  «        t          |¦  «        ¦  «        |	k    rt          ‰ ||||¦  «        }|rx|dk    r/d|v r+|                     d|¦  «                             dd¦  «        }n*|                     d|¦  «                             d|¦  «        } ||¦  «         |s‰d         c c S ‰rt#          d¦  «         �ŒÆ�ŒÑ|dk    rçg d¢}g }|D ]K\  Š}t%          ˆˆ fd„|D ¦   «         ¦  «        s*|                     ‰                      ‰¦  «        |f¦  «         ŒLˆ fd„|D ¦   «         |z   }‰  
                    ‰                      |¦  «        gd„ |D ¦   «         z   ||	¦  «        }|�Ht          d„ |D ¦   «         ¦  «        |	k    r+|d         r# |t+          ||¦  «        ¦  «         |s‰d         S |rt          ‰t          ¬¦  «        S dS )an  
    Given a real number `x`, ``identify(x)`` attempts to find an exact
    formula for `x`. This formula is returned as a string. If no match
    is found, ``None`` is returned. With ``full=True``, a list of
    matching formulas is returned.

    As a simple example, :func:`~mpmath.identify` will find an algebraic
    formula for the golden ratio::

        >>> from mpmath import *
        >>> mp.dps = 15; mp.pretty = True
        >>> identify(phi)
        '((1+sqrt(5))/2)'

    :func:`~mpmath.identify` can identify simple algebraic numbers and simple
    combinations of given base constants, as well as certain basic
    transformations thereof. More specifically, :func:`~mpmath.identify`
    looks for the following:

        1. Fractions
        2. Quadratic algebraic numbers
        3. Rational linear combinations of the base constants
        4. Any of the above after first transforming `x` into `f(x)` where
           `f(x)` is `1/x`, `\sqrt x`, `x^2`, `\log x` or `\exp x`, either
           directly or with `x` or `f(x)` multiplied or divided by one of
           the base constants
        5. Products of fractional powers of the base constants and
           small integers

    Base constants can be given as a list of strings representing mpmath
    expressions (:func:`~mpmath.identify` will ``eval`` the strings to numerical
    values and use the original strings for the output), or as a dict of
    formula:value pairs.

    In order not to produce spurious results, :func:`~mpmath.identify` should
    be used with high precision; preferably 50 digits or more.

    **Examples**

    Simple identifications can be performed safely at standard
    precision. Here the default recognition of rational, algebraic,
    and exp/log of algebraic numbers is demonstrated::

        >>> mp.dps = 15
        >>> identify(0.22222222222222222)
        '(2/9)'
        >>> identify(1.9662210973805663)
        'sqrt(((24+sqrt(48))/8))'
        >>> identify(4.1132503787829275)
        'exp((sqrt(8)/2))'
        >>> identify(0.881373587019543)
        'log(((2+sqrt(8))/2))'

    By default, :func:`~mpmath.identify` does not recognize `\pi`. At standard
    precision it finds a not too useful approximation. At slightly
    increased precision, this approximation is no longer accurate
    enough and :func:`~mpmath.identify` more correctly returns ``None``::

        >>> identify(pi)
        '(2**(176/117)*3**(20/117)*5**(35/39))/(7**(92/117))'
        >>> mp.dps = 30
        >>> identify(pi)
        >>>

    Numbers such as `\pi`, and simple combinations of user-defined
    constants, can be identified if they are provided explicitly::

        >>> identify(3*pi-2*e, ['pi', 'e'])
        '(3*pi + (-2)*e)'

    Here is an example using a dict of constants. Note that the
    constants need not be "atomic"; :func:`~mpmath.identify` can just
    as well express the given number in terms of expressions
    given by formulas::

        >>> identify(pi+e, {'a':pi+2, 'b':2*e})
        '((-2) + 1*a + (1/2)*b)'

    Next, we attempt some identifications with a set of base constants.
    It is necessary to increase the precision a bit.

        >>> mp.dps = 50
        >>> base = ['sqrt(2)','pi','log(2)']
        >>> identify(0.25, base)
        '(1/4)'
        >>> identify(3*pi + 2*sqrt(2) + 5*log(2)/7, base)
        '(2*sqrt(2) + 3*pi + (5/7)*log(2))'
        >>> identify(exp(pi+2), base)
        'exp((2 + 1*pi))'
        >>> identify(1/(3+sqrt(2)), base)
        '((3/7) + (-1/7)*sqrt(2))'
        >>> identify(sqrt(2)/(3*pi+4), base)
        'sqrt(2)/(4 + 3*pi)'
        >>> identify(5**(mpf(1)/3)*pi*log(2)**2, base)
        '5**(1/3)*pi*log(2)**2'

    An example of an erroneous solution being found when too low
    precision is used::

        >>> mp.dps = 15
        >>> identify(1/(3*pi-4*e+sqrt(8)), ['pi', 'e', 'sqrt(2)'])
        '((11/25) + (-158/75)*pi + (76/75)*e + (44/15)*sqrt(2))'
        >>> mp.dps = 50
        >>> identify(1/(3*pi-4*e+sqrt(8)), ['pi', 'e', 'sqrt(2)'])
        '1/(3*pi + (-4)*e + 2*sqrt(2))'

    **Finding approximate solutions**

    The tolerance ``tol`` defaults to 3/4 of the working precision.
    Lowering the tolerance is useful for finding approximate matches.
    We can for example try to generate approximations for pi::

        >>> mp.dps = 15
        >>> identify(pi, tol=1e-2)
        '(22/7)'
        >>> identify(pi, tol=1e-3)
        '(355/113)'
        >>> identify(pi, tol=1e-10)
        '(5**(339/269))/(2**(64/269)*3**(13/269)*7**(92/269))'

    With ``full=True``, and by supplying a few base constants,
    ``identify`` can generate almost endless lists of approximations
    for any number (the output below has been truncated to show only
    the first few)::

        >>> for p in identify(pi, ['e', 'catalan'], tol=1e-5, full=True):
        ...     print(p)
        ...  # doctest: +ELLIPSIS
        e/log((6 + (-4/3)*e))
        (3**3*5*e*catalan**2)/(2*7**2)
        sqrt(((-13) + 1*e + 22*catalan))
        log(((-6) + 24*e + 4*catalan)/e)
        exp(catalan*((-1/5) + (8/15)*e))
        catalan*(6 + (-6)*e + 15*catalan)
        sqrt((5 + 26*e + (-3)*catalan))/e
        e*sqrt(((-27) + 2*e + 25*catalan))
        log(((-1) + (-11)*e + 59*catalan))
        ((3/20) + (21/20)*e + (3/20)*catalan)
        ...

    The numerical values are roughly as close to `\pi` as permitted by the
    specified tolerance:

        >>> e/log(6-4*e/3)
        3.14157719846001
        >>> 135*e*catalan**2/98
        3.14166950419369
        >>> sqrt(e-13+22*catalan)
        3.14158000062992
        >>> log(24*e-6+4*catalan)-1
        3.14158791577159

    **Symbolic processing**

    The output formula can be evaluated as a Python expression.
    Note however that if fractions (like '2/3') are present in
    the formula, Python's :func:`~mpmath.eval()` may erroneously perform
    integer division. Note also that the output is not necessarily
    in the algebraically simplest form::

        >>> identify(sqrt(2))
        '(sqrt(8)/2)'

    As a solution to both problems, consider using SymPy's
    :func:`~mpmath.sympify` to convert the formula into a symbolic expression.
    SymPy can be used to pretty-print or further simplify the formula
    symbolically::

        >>> from sympy import sympify # doctest: +SKIP
        >>> sympify(identify(sqrt(2))) # doctest: +SKIP
        2**(1/2)

    Sometimes :func:`~mpmath.identify` can simplify an expression further than
    a symbolic algorithm::

        >>> from sympy import simplify # doctest: +SKIP
        >>> x = sympify('-1/(-3/2+(1/2)*5**(1/2))*(3/2-1/2*5**(1/2))**(1/2)') # doctest: +SKIP
        >>> x # doctest: +SKIP
        (3/2 - 5**(1/2)/2)**(-1/2)
        >>> x = simplify(x) # doctest: +SKIP
        >>> x # doctest: +SKIP
        2/(6 - 2*5**(1/2))**(1/2)
        >>> mp.dps = 30 # doctest: +SKIP
        >>> x = sympify(identify(x.evalf(30))) # doctest: +SKIP
        >>> x # doctest: +SKIP
        1/2 + 5**(1/2)/2

    (In fact, this functionality is available directly in SymPy as the
    function :func:`~mpmath.nsimplify`, which is essentially a wrapper for
    :func:`~mpmath.identify`.)

    **Miscellaneous issues and limitations**

    The input `x` must be a real number. All base constants must be
    positive real numbers and must not be rationals or rational linear
    combinations of each other.

    The worst-case computation time grows quickly with the number of
    base constants. Already with 3 or 4 base constants,
    :func:`~mpmath.identify` may require several seconds to finish. To search
    for relations among a large number of constants, you should
    consider using :func:`~mpmath.pslq` directly.

    The extended transformations are applied to x, not the constants
    separately. As a result, ``identify`` will for example be able to
    recognize ``exp(2*pi+3)`` with ``pi`` given as a base constant, but
    not ``2*exp(pi)+3``. It will be able to recognize the latter if
    ``exp(pi)`` is given explicitly as a base constant.

    c                 óV   •— ‰rt          d| ¦  «         ‰                     | ¦  «         d S )NzFound: )r7   r_   )rJ   Ú	solutionsrB   s    €€r   Úaddsolutionzidentify.<locals>.addsolutionë  s2   ø€ ØÐ'•E˜) QÑ'Ô'Ð'Ø×Ò˜ÑÔÐÐÐr   r)   ro   Nc                 ó   — g | ]}d |z  ‘ŒS )ú-(%s)r   )r   rJ   s     r   r    zidentify.<locals>.<listcomp>ú  s   € Ð+Ð+Ð+ !�G˜A‘IÐ+Ð+Ð+r   r·   gffffffæ?c                 óD   •— g | ]\  }}‰                      |¦  «        |f‘ŒS r   )r   )r   Únamer1   r   s      €r   r    zidentify.<locals>.<listcomp>  s,   ø€ ÐWÐWÐW±	°°q˜#Ÿ'š' !™*œ* dÐ+ÐWÐWÐWr   c              3   ó<   •K  — | ]}|t          ‰|¦  «        fV — Œd S r"   )Úgetattr)r   r¹   r   s     €r   r&   zidentify.<locals>.<genexpr>  s2   øè è € ÐLÐL¸4˜d¥G¨C°Ñ$5Ô$5Ð6ÐLÐLÐLÐLÐLÐLr   c                 ó4   •— g | ]}t          |‰¦  «        |f‘ŒS r   )Úeval)r   re   Ú	namespaces     €r   r    zidentify.<locals>.<listcomp>	  s(   ø€ ÐDÐDÐD°Q�$˜q )Ñ,Ô,¨aÐ0ÐDÐDÐDr   r   c                 ó   — g | ]\  }}|‘ŒS r   r   )r   r¹   Úvalues      r   r    zidentify.<locals>.<listcomp>  s   € Ð6Ð6Ð6™=˜D %�Ð6Ð6Ð6r   ri   r   c                 ó   — g | ]
}|d          ‘ŒS ©r)   r   ©r   rb   s     r   r    zidentify.<locals>.<listcomp>  s   € Ð8Ð8Ð8¨  !¤Ð8Ð8Ð8r   c              3   ó4   K  — | ]}t          |¦  «        V — Œd S r"   r#   ©r   Úuws     r   r&   zidentify.<locals>.<genexpr>  s(   è è € Ð$9Ð$9°¥S¨¡W¤WÐ$9Ð$9Ð$9Ð$9Ð$9Ð$9r   r(   z/$cz$yrj   z$cú.)r   r(   r   é   c           	   3   ó°   •K  — | ]P}t          ‰                     ‰                     ‰¦  «        ‰                     |¦  «        z  d ¦  «        ¦  «        V — ŒQdS )r   N)Úboolrc   rª   )r   r/   rb   r   s     €€r   r&   zidentify.<locals>.<genexpr>8  sR   øè è € ÐPÐPÀQ•t˜CŸLšL¨¯ª°©¬°3·6²6¸!±9´9Ñ)<¸QÑ?Ô?Ñ@Ô@ÐPÐPÐPÐPÐPÐPr   c                 óX   •— g | ]&}‰                      |¦  «        t          |¦  «        f‘Œ'S r   )rª   rq   )r   r/   r   s     €r   r    zidentify.<locals>.<listcomp>:  s.   ø€ Ð2Ð2Ð2 q�—’˜‘”�3˜q™6œ6Ð"Ð2Ð2Ð2r   c                 ó   — g | ]
}|d          ‘ŒS rÂ   r   rÃ   s     r   r    zidentify.<locals>.<listcomp>;  s   € Ð#7Ð#7Ð#7¨Q A a¤DÐ#7Ð#7Ð#7r   c              3   ó4   K  — | ]}t          |¦  «        V — Œd S r"   r#   rÅ   s     r   r&   zidentify.<locals>.<genexpr><  s(   è è € Ð 5Ð 5¨R¥ R¡¤Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5r   )Úkey)r   ÚidentifyÚepsrp   ÚdictÚsortedÚitemsÚdirÚ
transformsr$   r]   r6   rx   Úoner4   r…   Úreplacer7   Úsumr_   rª   r}   )r   r	   rt   r?   r@   ÚfullrB   rµ   ÚsolÚMÚftÚftnÚredr‚   ÚcnrL   rs   rJ   rf   ÚaaÚbbÚccÚilogsÚlogsrb   r¾   r´   s   `     `                 @@@r   rÏ   rÏ     sï  øøøøø€ ðj €Iðð ð ð ð ð ð 	�Š�‰
Œ
€Að 	ˆA‚v€vØð 	˜˜�Ø˜Øˆ1‚u€uØ�lŠl˜A˜2˜y¨#¨x¸¸wÑGÔGˆØˆ;ØˆJØð 	!Ø+Ð+ sÐ+Ñ+Ô+Ð+à˜S‘=Ð à
ð Ø�gŠg�c‰lŒlˆˆàŒg�s‰lˆØ€Aàð Ý�i¥Ñ&Ô&ð 	EØWÐWÐWÐW½VÀIÇOÂOÑDUÔDUÑ=VÔ=VÐWÑWÔWˆIˆIåÐLÐLÐLÐLÅ3ÀsÁ8Ä8ÐLÑLÔLÑLÔLˆIØDÐDÐDÐD¸)ÐDÑDÔDˆIˆIàˆ	ð 	Ð6Ð6¨IÐ6Ñ6Ô6Ð6Ð6Ø—g’g˜a‘j”j #Ð&Ð'¨)Ñ3ˆ	õ #ð ñ ‰ˆˆC�Øð 	ñ 	‰EˆAˆrØð �r˜S’y�yØØ��3�q˜‘”ˆAå�1‰vŒv˜˜1™Š}ˆ}¥ A¡¤¨¢ Øà—’˜!˜Ð8Ð8¨iÐ8Ñ8Ô8Ñ8¸#¸qÑAÔAˆAØˆAØˆ}¥Ð$9Ð$9°qÐ$9Ñ$9Ô$9Ñ!9Ô!9¸QÒ!>Ð!>À1ÀQÄ4Ð!>Ý˜q )Ñ,Ô,��ð —H’H˜cœg q¨!¨Q©$Ð/°°aÑ8Ô8�Ø�=¥S¨¡V¤V¨q¢[ [°Q°q´T [Ø!"‘J�B˜˜BÝ�3˜r™7œ7¥3 r¡7¤7­3¨r©7¬7Ñ3Ô3°qÒ8Ð8Ý+¨C°°"°R¸Ñ;Ô;˜Øð 1Ø˜’9�9 %¨3 , ,ØŸš D¨!Ñ,Ô,×4Ò4°U¸BÑ?Ô?�A�AàŸš D¨!Ñ,Ô,×4Ò4°T¸2Ñ>Ô>�AØ�˜A‘”�ØÐ0 I¨a¤LÐ0Ð0Ð0Ð0Ð0àð Ý�c‘
”
�
ùñ9	ð> 	ˆA‚v€và�	�	ˆàˆØð 	,ð 	,‰DˆAˆqÝÐPÐPÐPÐPÐPÈ%ÐPÑPÔPÑPÔPð ,Ø—’˜SŸVšV A™YœY¨˜NÑ+Ô+Ð+øØ2Ð2Ð2Ð2¨EÐ2Ñ2Ô2°TÑ9ˆØ�HŠH�c—f’f˜Q‘i”i�[Ð#7Ð#7°$Ð#7Ñ#7Ô#7Ñ7¸¸aÑ@Ô@ˆØˆ=�SÐ 5Ð 5°1Ð 5Ñ 5Ô 5Ñ5Ô5¸Ò:Ð:¸qÀ¼tÐ:ØˆK�
 1 dÑ+Ô+Ñ,Ô,Ð,ØÐ, 	¨!¤Ð,àð Ý�i¥SÐ)Ñ)Ô)Ð)àˆtr   Ú__main__)Nr   r   F)r   )Ú__doc__Úlibmp.backendr   Úlibmpr   r   r   Úobjectr   r]   rc   rg   rx   r}   r…   rÕ   rÏ   r   ÚdoctestÚtestmodr   r   r   ú<module>rì      sÅ  ððð ð
 "Ð !Ð !Ð !Ð !Ð !Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (ð1ð 1ð 1ð	ð 	ð 	ð 	ð 	˜Fñ 	ô 	ð 	ðdð dð dð dðL	sð sð sð sðj	ð 	ð 	ðð ð ð0"ð "ð "ð.ð ð ð" Ð˜ Ð#ØÐ˜ Ð#ØÐ˜ Ð#ØÐ˜]¨AÐ.ØÐ˜]¨AÐ.ØÐ˜]¨AÐ.ØÐÐ.°Ð2ØÐÐ.°Ð2ØÐÐ.°Ð2Ø Ð  *¨aÐ0Ø Ð  *¨aÐ0Ø Ð  *¨aÐ0Ø Ð  -°Ð3Ø Ð  -°Ð3Ø Ð  -°Ð3ØÐ ¨qÐ1ØÐ ¨qÐ1ØÐ ¨qÐ1ØÐ ¨qÐ1ØÐ ¨qÐ1ØÐ ¨qÐ1ØÐ ¨aÐ0ØÐ ¨aÐ0ØÐ ¨aÐ0ØÐ ¨aÐ0ØÐ ¨aÐ0ØÐ ¨aÐ0ð7€
ð<  " t°dÀØðoð oð oð oðb	 "Ð Ô Ø!)Ð Ô Ø!)Ð Ô ð ˆzÒÐØ€N€N€NØ€G„OÑÔÐÐÐð Ðr   