§
    PŠtjÎE  ã                   ó  — d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZmZmZ d d	lmZ d d
lmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d dlm Z m!Z! d dl"m#Z# d„ Z$dd„Z%d„ Z&d„ Z'd„ Z(ddœd„Z)dS )é    )ÚAdd)Úfactor_terms)Ú
expand_logÚ_mexpand)ÚPow)ÚS)Úordered)ÚDummy)ÚLambertWÚexpÚlog)Úroot)Úroots)ÚPolyÚfactor)Úseparatevars)Úcollect)Úpowsimp)ÚsolveÚ_invert)Úuniqc                 óæ   ‡— ˆfd„| j         D ¦   «         }t          |¦  «        D ]L}d|z  }||v rA||v r=|                     ¦   «         d         t          j        ur|}|                     |¦  «         ŒM|S )aª  process the generators of ``poly``, returning the set of generators that
    have ``symbol``.  If there are two generators that are inverses of each other,
    prefer the one that has no denominator.

    Examples
    ========

    >>> from sympy.solvers.bivariate import _filtered_gens
    >>> from sympy import Poly, exp
    >>> from sympy.abc import x
    >>> _filtered_gens(Poly(x + 1/x + exp(x)), x)
    {x, exp(x)}

    c                 ó&   •— h | ]}‰|j         v ¯|’ŒS © ©Úfree_symbols)Ú.0ÚgÚsymbols     €úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/solvers/bivariate.pyú	<setcomp>z!_filtered_gens.<locals>.<setcomp>%   s%   ø€ Ð=Ð=Ð=�! F¨a¬nÐ$<Ð$<ˆAÐ$<Ð$<Ð$<ó    é   )ÚgensÚlistÚas_numer_denomr   ÚOneÚremove)Úpolyr   r$   r   Úags    `   r    Ú_filtered_gensr+      s‡   ø€ ð$ >Ð=Ð=Ð=�t”yÐ=Ñ=Ô=€DÝ�$‰ZŒZð ð ˆØˆq‰SˆØ�ˆ9ˆ9˜˜t˜˜Ø× Ò Ñ"Ô" 1Ô%­Q¬UÐ2Ð2Ø�Ø�KŠK˜‰NŒNˆNøØ€Kr"   Nc                 óâ   ‡‡— ˆfd„|                       ‰¦  «        D ¦   «         }t          |¦  «        dk    r|d         S |r.t          t          t	          |¦  «        ¦  «        ˆfd„¬¦  «        S dS )a+  Returns the term in lhs which contains the most of the
    func-type things e.g. log(log(x)) wins over log(x) if both terms appear.

    ``func`` can be a function (exp, log, etc...) or any other SymPy object,
    like Pow.

    If ``X`` is not ``None``, then the function returns the term composed with the
    most ``func`` having the specified variable.

    Examples
    ========

    >>> from sympy.solvers.bivariate import _mostfunc
    >>> from sympy import exp
    >>> from sympy.abc import x, y
    >>> _mostfunc(exp(x) + exp(exp(x) + 2), exp)
    exp(exp(x) + 2)
    >>> _mostfunc(exp(x) + exp(exp(y) + 2), exp)
    exp(exp(y) + 2)
    >>> _mostfunc(exp(x) + exp(exp(y) + 2), exp, x)
    exp(x)
    >>> _mostfunc(x, exp, x) is None
    True
    >>> _mostfunc(exp(x) + exp(x*y), exp, x)
    exp(x)
    c                 óp   •— g | ]2}‰r,‰j         r	‰|j        v s‰j         °|                     ‰¦  «        ¯0|‘Œ3S r   )Ú	is_Symbolr   Úhas)r   ÚtmpÚXs     €r    ú
<listcomp>z_mostfunc.<locals>.<listcomp>J   s]   ø€ ð )ð )ð )�c°Qð )Ø	Œð)Ø˜SÔ-Ð-Ð-ØŒKð .ØŸGšG A™JœJð .ð Ø-Ð-Ð-r"   r#   r   c                 ó.   •— |                       ‰¦  «        S ©N)Úcount)ÚxÚfuncs    €r    ú<lambda>z_mostfunc.<locals>.<lambda>P   s   ø€ ¸¿ºÀ¹¼€ r"   )ÚkeyN)ÚatomsÚlenÚmaxr%   r	   )Úlhsr7   r1   Úftermss    `` r    Ú	_mostfuncr?   /   s‹   øø€ ð6)ð )ð )ð )˜SŸYšY t™_œ_ð )ñ )ô )€Fõ ˆ6�{„{�aÒÐØ�aŒyÐØ	ð GÝ•4� ™œÑ(Ô(Ð.EÐ.EÐ.EÐ.EÐFÑFÔFÐFØˆ4r"   c                 óz  — t          |                      ¦   «         ¦  «        } |                      |¦  «        \  }}| j        r&|j        rt          ||¦  «        \  }}}||z  ||z  |fS | j        sd}||}}n)|}t          |¦  «                             |d¬¦  «        \  }}|                     ¦   «         r| }| }|||fS )aî  Return ``a, b, X`` assuming ``arg`` can be written as ``a*X + b``
    where ``X`` is a symbol-dependent factor and ``a`` and ``b`` are
    independent of ``symbol``.

    Examples
    ========

    >>> from sympy.solvers.bivariate import _linab
    >>> from sympy.abc import x, y
    >>> from sympy import exp, S
    >>> _linab(S(2), x)
    (2, 0, 1)
    >>> _linab(2*x, x)
    (2, 0, x)
    >>> _linab(y + y*x + 2*x, x)
    (y + 2, y, x)
    >>> _linab(3 + 2*exp(x), x)
    (2, 3, exp(x))
    r   F©Úas_Add)r   ÚexpandÚas_independentÚis_MulÚis_AddÚ_linabr   Úcould_extract_minus_sign)Úargr   ÚindÚdepÚaÚbr6   s          r    rG   rG   T   sÝ   € õ( �s—z’z‘|”|Ñ
$Ô
$€CØ×!Ò! &Ñ)Ô)�H€CˆØ
„zð �c”jð Ý˜˜fÑ%Ô%‰ˆˆ1ˆaØ�1‰u�c˜!‘e˜QˆÐØŒ:ð FØˆØ�Cˆ1ˆˆàˆÝ˜CÑ Ô ×/Ò/°¸uÐ/ÑEÔE‰ˆˆ1Ø×!Ò!Ñ#Ô#ð ØˆBˆØˆBˆØˆa�ˆ7€Nr"   c                 ó¨  ‡‡‡‡‡— t          t          | ¦  «        ¦  «        } t          | t          |¦  «        }|sg S |                      |d¦  «        }t          | t          ¦  «        r\| |z
                       ||j        d         ¦  «        } |j        d         }t          |t          ¦  «        sg S | j        d          }| |z  } ||j        vrg S t          ||¦  «        \  Š}}t          | |z
  |¦  «        }| 
                    |¦  «        Š‰�	|‰j        v rg S |j        d         }t          ||¦  «        \  Š}}	|	|k    rg S t          d¦  «        Št          |	‰z
  |¦  «        }
ddg}g }|‰z  ‰|z  z
  ‰z  ‰z                       ¦   «         \  }}|                     ¦   «         \  }}t          ||z  ¦  «        }t          d¦  «        }ˆˆˆfd„t!          ||z  |z
  |¦  «                             ¦   «         D ¦   «         }|D ]R}|D ]M}t%          ||¦  «        }|r|j        sŒ| ‰z  ‰‰z  |z  z   Š|                     ˆˆfd„|
D ¦   «         ¦  «         ŒNŒS|S )zô
    Given an expression assumed to be in the form
        ``F(X, a..f) = a*log(b*X + c) + d*X + f = 0``
    where X = g(x) and x = g^-1(X), return the Lambert solution,
        ``x = g^-1(-c/b + (a/d)*W(d/(a*b)*exp(c*d/a/b)*exp(-f/a)))``.
    r   NÚrhséÿÿÿÿÚtc                 ó&   •— g | ]}‰‰‰z  z  |z  ‘ŒS r   r   )r   rQ   rL   rM   Úds     €€€r    r2   z_lambert.<locals>.<listcomp>³   s%   ø€ Ð9Ð9Ð9˜!ˆAˆq�‰s‰G�A‰IÐ9Ð9Ð9r"   c              3   óD   •K  — | ]}|                      ‰‰¦  «        V — Œd S r4   )Úsubs)r   ÚxurO   Úus     €€r    ú	<genexpr>z_lambert.<locals>.<genexpr>½   s/   øè è € Ð9Ð9¨2�r—w’w˜q #‘”Ð9Ð9Ð9Ð9Ð9Ð9r"   )r   r   r?   r   rU   Ú
isinstanceÚargsr   rG   r   Úas_coefficientr
   r   r&   Úas_coeff_Mulr   r   Úkeysr   Úis_realÚextend)Úeqr6   ÚmainlogÚotherÚfÚX2ÚlogtermÚlogargÚcÚX1ÚxusolnsÚlambert_real_branchesÚsolÚnumÚdenÚpÚerQ   rZ   rI   ÚkÚwrL   rM   rS   rO   rW   s                         @@@@@r    Ú_lambertrr   y   s©  øøøøø€ õ 
•*˜R‘.”.Ñ	!Ô	!€BÝ˜�C Ñ#Ô#€GØð Øˆ	Ø�GŠG�G˜QÑÔ€EÝ�5�&�#ÑÔð Ø�5‰j×Ò˜w¨¬°Q¬Ñ8Ô8ˆØ”,˜q”/ˆÝ˜'¥3Ñ'Ô'ð 	ØˆIØ�&”˜qÔ!Ð!ˆØ
ˆe‰ˆØ�Ô"Ð"Ð"Øˆ	Ý�e˜QÑÔ�H€A€qˆ"Ý�b˜5‘j 'Ñ*Ô*€GØ×Ò˜wÑ'Ô'€AØ€y�A˜œÐ'Ð'Øˆ	ØŒ\˜!Œ_€FÝ�f˜aÑ Ô �H€A€qˆ"Ø	ˆR‚x€xØˆ	õ 	ˆe‰Œ€AÝ�B˜‘F˜AÑÔ€Gð   ˜GÐØ
€Cð �1‘�Q�q‘S‘˜!‘˜A‘×-Ò-Ñ/Ô/�H€CˆØ×ÒÑÔ�F€A€sÝˆC�‰G‰Œ€AÝˆc‰
Œ
€AØ9Ð9Ð9Ð9Ð9Ð9�u Q¨¡T¨A¡X¨qÑ1Ô1×6Ò6Ñ8Ô8Ð9Ñ9Ô9€Dð ð :ð :ˆØ&ð 	:ð 	:ˆAÝ˜˜aÑ Ô ˆAØð ˜œð ØØ�"�Q‘$˜!˜A™#˜q™‘.ˆCà�JŠJÐ9Ð9Ð9Ð9Ð9°Ð9Ñ9Ô9Ñ9Ô9Ð9Ð9ð	:ð €Jr"   c                 óp
  ‡‡‡— ˆfd„}|                       ‰d¬¦  «        \  }}| }ˆfd„‰D ¦   «         }|st          ¦   «         ‚|j        s|j        �rQt	          di ‰j        ¤ŽŠ|                     ˆfd„ˆfd„¦  «        }|j        r¢|                     ‰¦  «        r�|                     ‰d¦  «        }||z
  }	||z
  }
|	j        se|
rc|	                     t          j
        t          j        ¦  «        s9t          t          |	¦  «        t          |
¦  «        z
  ¦  «        } ||‰‰¦  «        S nd|j        r]|r[t          t          |¦  «        d¬	¦  «        }t          |¦  «        }|                     ‰¦  «        r|j        r||z
  } ||‰‰¦  «        S |                     ‰‰i¦  «        }t          t!          |d¬
¦  «        ¦  «        }t	          ¦   «         }t#          ||z
  ‰¦  «        \  }}|                     ||i¦  «        }g }|�st%          |t          ‰¦  «        }|�r|j        r4|dk    r.t'          t          |¦  «        t          |¦  «        z
  ‰¦  «        }nÇ|j        rÀ|                     |d¦  «        }|r•|j        sŽˆfd„|                     t*          ¦  «        D ¦   «         rh|s#t          |¦  «        t          ||z
  ¦  «        z
  }n%t          ||z
  ¦  «        t          ||z
  ¦  «        z
  }t'          t          |¦  «        ‰¦  «        }nt'          ||z
  ‰¦  «        }|�st%          |t,          ‰¦  «        }|rít/          ||¦  «        }|j        rA|dk    r;t'          t          t          |¦  «        t          |¦  «        z
  ¦  «        ‰¦  «        }n•|j        rŽ|                     |d¦  «        }||z
  }||z
  }|                     ¦   «         r|                     ¦   «         r
|dz  }|dz  }t          |¦  «        t          |¦  «        z
  }t'          t          |¦  «        ‰¦  «        }|sát%          |t*          ‰¦  «        }|rÉ‰|j        j        v r»t/          ||¦  «        }|j        rA|dk    r;t'          t          t          |¦  «        t          |¦  «        z
  ¦  «        ‰¦  «        }nc|j        r\|                     |d¦  «        }||z
  }||z
  }t          |¦  «        t          |¦  «        z
  }t'          t          |¦  «        ‰¦  «        }|st          d| z  ¦  «        ‚t5          t7          |¦  «        ¦  «        S )aä  Return solution to ``f`` if it is a Lambert-type expression
    else raise NotImplementedError.

    For ``f(X, a..f) = a*log(b*X + c) + d*X - f = 0`` the solution
    for ``X`` is ``X = -c/b + (a/d)*W(d/(a*b)*exp(c*d/a/b)*exp(f/a))``.
    There are a variety of forms for `f(X, a..f)` as enumerated below:

    1a1)
      if B**B = R for R not in [0, 1] (since those cases would already
      be solved before getting here) then log of both sides gives
      log(B) + log(log(B)) = log(log(R)) and
      X = log(B), a = 1, b = 1, c = 0, d = 1, f = log(log(R))
    1a2)
      if B*(b*log(B) + c)**a = R then log of both sides gives
      log(B) + a*log(b*log(B) + c) = log(R) and
      X = log(B), d=1, f=log(R)
    1b)
      if a*log(b*B + c) + d*B = R and
      X = B, f = R
    2a)
      if (b*B + c)*exp(d*B + g) = R then log of both sides gives
      log(b*B + c) + d*B + g = log(R) and
      X = B, a = 1, f = log(R) - g
    2b)
      if g*exp(d*B + h) - b*B = c then the log form is
      log(g) + d*B + h - log(b*B + c) = 0 and
      X = B, a = -1, f = -h - log(g)
    3)
      if d*p**(a*B + g) - b*B = c then the log form is
      log(d) + (a*B + g)*log(p) - log(b*B + c) = 0 and
      X = B, a = -1, d = a*log(p), f = -log(d) - g*log(p)
    c                 óÞ   •‡ ‡‡— ˆ ˆˆfd„dD ¦   «         \  }}t          |‰‰¦  «        }||k    r$|                     t          |‰‰¦  «        ¦  «         t          t          |¦  «        ¦  «        S )a„  Return the unique solutions of equations derived from
        ``expr`` by replacing ``t`` with ``+/- symbol``.

        Parameters
        ==========

        expr : Expr
            The expression which includes a dummy variable t to be
            replaced with +symbol and -symbol.

        symbol : Symbol
            The symbol for which a solution is being sought.

        Returns
        =======

        List of unique solution of the two equations generated by
        replacing ``t`` with positive and negative ``symbol``.

        Notes
        =====

        If ``expr = 2*log(t) + x/2` then solutions for
        ``2*log(x) + x/2 = 0`` and ``2*log(-x) + x/2 = 0`` are
        returned by this function. Though this may seem
        counter-intuitive, one must note that the ``expr`` being
        solved here has been derived from a different expression. For
        an expression like ``eq = x**2*g(x) = 1``, if we take the
        log of both sides we obtain ``log(x**2) + log(g(x)) = 0``. If
        x is positive then this simplifies to
        ``2*log(x) + log(g(x)) = 0``; the Lambert-solving routines will
        return solutions for this, but we must also consider the
        solutions for  ``2*log(-x) + log(g(x))`` since those must also
        be a solution of ``eq`` which has the same value when the ``x``
        in ``x**2`` is negated. If `g(x)` does not have even powers of
        symbol then we do not want to replace the ``x`` there with
        ``-x``. So the role of the ``t`` in the expression received by
        this function is to mark where ``+/-x`` should be inserted
        before obtaining the Lambert solutions.

        c                 óD   •— g | ]}‰                      ‰|‰z  i¦  «        ‘ŒS r   )Úxreplace)r   ÚsgnÚexprr   rQ   s     €€€r    r2   zC_solve_lambert.<locals>._solve_even_degree_expr.<locals>.<listcomp>  s:   ø€ ð ?ð ?ð ?Ø/2ˆD�MŠM˜1˜c &™j˜/Ñ*Ô*ð?ð ?ð ?r"   )rP   r#   )Ú_solve_lambertr_   r%   r   )rx   rQ   r   ÚnlhsÚplhsÚsolsr$   s   ```   €r    Ú_solve_even_degree_exprz/_solve_lambert.<locals>._solve_even_degree_exprã   s‹   øøøø€ ðT?ð ?ð ?ð ?ð ?ð ?Ø6=ð?ñ ?ô ?‰
ˆˆdå˜d F¨DÑ1Ô1ˆØ�4Š<ˆ<Ø�KŠK� t¨V°TÑ:Ô:Ñ;Ô;Ð;õ •D˜‘J”JÑÔÐr"   TrA   c                 óh   •— g | ].}|j         t          t          fv s|j        r‰|j        j        v ¯,|‘Œ/S r   )r7   r   r   Úis_Powr   ©r   r0   r   s     €r    r2   z"_solve_lambert.<locals>.<listcomp>  sP   ø€ ð Bð Bð B˜Ø”H¥¥c 
Ð*Ð*Ø”ð +Ø &¨#¬'Ô*>Ð >Ð >ð à >Ð >Ð >r"   rQ   c                 ó@   •— | j         o| j        ‰k    o| j        j        S r4   )r   Úbaser   Úis_even)Úir   s    €r    r8   z _solve_lambert.<locals>.<lambda>(  s"   ø€ Ø”Ð?˜QœV vÒ-Ð?°!´%´-ð r"   c                 ó   •— ‰| j         z  S r4   )r   )r„   rQ   s    €r    r8   z _solve_lambert.<locals>.<lambda>*  s   ø€ Ø�1”5‘ð r"   r   )Úforce)Údeepc                 ó&   •— g | ]}‰|j         v ¯|‘ŒS r   r   r€   s     €r    r2   z"_solve_lambert.<locals>.<listcomp>\  s1   ø€ ð 37ð 37ð 37Ø #Ø! SÔ%5Ð5Ð5ð Ø5Ð5Ð5r"   rP   z:%s does not appear to have a solution in terms of LambertW)rQ   )rD   ÚNotImplementedErrorrF   rE   r
   Úassumptions0Úreplacer/   rU   r   ÚComplexInfinityÚNaNr   r   rv   r   r   r   r?   rr   r:   r   r   r   rH   r   r%   r	   )rc   r   r$   r}   Únrhsr=   rO   ÚlamcheckÚt_indepÚt_termÚ_rhsr`   Úrr„   Úsolnra   rb   ÚdiffÚmainexpÚmaintermÚmainpowrQ   s    ``                  @r    ry   ry   Á   s¼  øøø€ ðD4 ð 4 ð 4 ð 4 ð 4 ðl × Ò  °Ð Ñ5Ô5�I€Dˆ#Øˆ%€CðBð Bð Bð B˜tð Bñ Bô B€Hð ð $Ý!Ñ#Ô#Ð#à
„zð (�S”Zñ (õ Ð-Ð-˜Ô,Ð-Ð-ˆØ�kŠkð@ð @ð @ð @ðð ð ð ñô ˆð Œ:ð 	>˜#Ÿ'š' !™*œ*ð 	>Ø—h’h˜q !‘n”nˆGØ˜7‘]ˆFØ˜‘=ˆDØ”=ð > Tð >Ø—J’J�qÔ0µ!´%Ñ8Ô8ð>å¥ F¡¤­c°$©i¬iÑ 7Ñ8Ô8�Ø.Ð.¨r°1°fÑ=Ô=Ð=øØŒZð 	>˜Cð 	>å�S ™XœX¨TÐ2Ñ2Ô2ˆCÝ�c‘(”(ˆCØ�wŠw�q‰zŒzð >˜cœjð >à˜3‘Y�Ø.Ð.¨r°1°fÑ=Ô=Ð=ð �lŠl˜A˜v˜;Ñ'Ô'ˆå
•&˜ 4Ð(Ñ(Ô(Ñ
)Ô
)€Cõ 	‰Œ€AÝ�S˜1‘W˜fÑ%Ô%�F€A€sØ
�*Š*�a˜�XÑ
Ô
€Cð €DØñ 7Ý˜C¥ fÑ-Ô-ˆØñ 	7ØŒzð 7˜c Qšh˜hÝ¥ C¡¤­3¨s©8¬8Ñ 3°VÑ<Ô<��Ø”ð 7ØŸš ¨!Ñ,Ô,�Øð 
7 ¤ð 
7ð 37ð 37ð 37ð 37Ø',§{¢{µ3Ñ'7Ô'7ð37ñ 37ô 37ð 
7ð ð CÝ" 5™zœz­C°¸±Ñ,<Ô,<Ñ<˜˜å" 3¨¡;Ñ/Ô/µ#°c¸E±kÑ2BÔ2BÑB˜Ý#¥J¨tÑ$4Ô$4°fÑ=Ô=�D�Dõ $ C¨#¡I¨vÑ6Ô6�Dð ñ :Ý˜C¥ fÑ-Ô-ˆØð 	:Ý˜#˜wÑ'Ô'ˆCØŒzð :˜c Qšh˜hÝ¥
­3¨s©8¬8µc¸#±h´hÑ+>Ñ ?Ô ?ÀÑHÔH��Ø”ð 
:àŸš ¨!Ñ,Ô,�Ø ™;�Ø˜E‘k�Ø×5Ò5Ñ7Ô7ð Ø×0Ò0Ñ2Ô2ðà ‘N�HØ˜2‘I�CÝ˜8‘}”}¥s¨3¡x¤xÑ/�Ý¥
¨4Ñ 0Ô 0°&Ñ9Ô9�ð ð :Ý˜C¥ fÑ-Ô-ˆØð 	:�v ¤Ô!9Ð9Ð9Ý˜#˜wÑ'Ô'ˆCØŒzð 	:˜c Qšh˜hå¥
­3¨s©8¬8µc¸#±h´hÑ+>Ñ ?Ô ?ÀÑHÔH��Ø”ð :àŸš ¨!Ñ,Ô,�Ø ™;�Ø˜E‘k�Ý˜8‘}”}¥s¨3¡x¤xÑ/�Ý¥
¨4Ñ 0Ô 0°&Ñ9Ô9�àð %Ý!ð # Ø"#ñ#$ñ %ô %ð 	%õ •˜‘”ÑÔÐr"   T©Úfirstc          
      óÐ  ‡‡— t          dd¬¦  «        }|rÁt          | ‰‰¦  «        }|                     ¦   «         } t          ¦   «         }t          ¦   «         }t          t          |                      ‰|‰|i¦  «        ||¦  «        ||d¬¦  «        }|rC|‰|‰i}	|d                              |	¦  «        |d                              |	¦  «        |d         fS d	S | }|                     ¦   «         } t          j        |                     ¦   «         ¦  «        }
g }|
D ]N}t          |                     ‰|‰z  ¦  «        ¦  «        }|j	        }‰|v s‰|v r n%| 
                    |¦  «         ŒO‰‰z  t          |Ž |fS ˆˆfd
„}g }|                     ‰¦  «        }|                     ‰¦  «        |k    rrt          |                     ‰|z  ¦  «        |¦  «        }t          |                     ‰|z  ¦  «        |¦  «        } || ‰||‰z  z
  |z  ¦  «        }|�|‰z  |‰z  z   ||fS g }|                     ‰¦  «        }|                     ‰¦  «        |k    r—t          d¦  «        D ]‰}t          |                     ‰|z  ‰|z  z  ¦  «        |¦  «        }t          |                     ‰|z  ¦  «        |¦  «        } || ‰||‰z  z
  |z  ‰z  ¦  «        }|�|‰z  ‰z  |‰z  z   ||fc S ‰‰cŠŠŒˆd	S d	S )aç  Given an expression, f, 3 tests will be done to see what type
    of composite bivariate it might be, options for u(x, y) are::

        x*y
        x+y
        x*y+x
        x*y+y

    If it matches one of these types, ``u(x, y)``, ``P(u)`` and dummy
    variable ``u`` will be returned. Solving ``P(u)`` for ``u`` and
    equating the solutions to ``u(x, y)`` and then solving for ``x`` or
    ``y`` is equivalent to solving the original expression for ``x`` or
    ``y``. If ``x`` and ``y`` represent two functions in the same
    variable, e.g. ``x = g(t)`` and ``y = h(t)``, then if ``u(x, y) - p``
    can be solved for ``t`` then these represent the solutions to
    ``P(u) = 0`` when ``p`` are the solutions of ``P(u) = 0``.

    Only positive values of ``u`` are considered.

    Examples
    ========

    >>> from sympy import solve
    >>> from sympy.solvers.bivariate import bivariate_type
    >>> from sympy.abc import x, y
    >>> eq = (x**2 - 3).subs(x, x + y)
    >>> bivariate_type(eq, x, y)
    (x + y, _u**2 - 3, _u)
    >>> uxy, pu, u = _
    >>> usol = solve(pu, u); usol
    [sqrt(3)]
    >>> [solve(uxy - s) for s in solve(pu, u)]
    [[{x: -y + sqrt(3)}]]
    >>> all(eq.subs(s).equals(0) for sol in _ for s in sol)
    True

    rW   T)ÚpositiveFr™   r   r#   é   Nc                 óp   •— t          |                      ||¦  «        ¦  «        }|j        }‰|v s‰|v rd n|S r4   )r   rU   r   )rc   Úvrg   ÚnewÚfreer6   Úys        €€r    Úokzbivariate_type.<locals>.okä  s>   ø€ Ý�q—v’v˜a ‘|”|Ñ$Ô$ˆØÔˆØ˜T˜	˜	 Q¨$ Y Yˆtˆt°SÐ8r"   )r
   r   Úas_exprÚbivariate_typerU   rv   r   Ú	make_argsr   r   ÚappendÚdegreer   Úcoeff_monomialÚrange)rc   r6   r¢   rš   rW   rn   Ú_xÚ_yÚrvÚrepsrZ   r    rL   r¡   r£   rS   rM   Úitrys    ``               r    r¥   r¥   ¡  s-  øø€ õN 	ˆc˜DÐ!Ñ!Ô!€Aàð 	Ý��A�q‰MŒMˆØ�IŠI‰KŒKˆÝ‰WŒWˆÝ‰WŒWˆÝ�D §¢¨¨B°°2¨Ñ!7Ô!7¸¸RÑ@Ô@À"ÀbÐPUÐVÑVÔVˆØð 	EØ˜˜2˜q�>ˆDØ�a”5—>’> $Ñ'Ô'¨¨A¬¯ª¸Ñ)=Ô)=¸rÀ!¼uÐDÐDØˆà	€AØ	�	Š	‰Œ€Aõ Œ=˜Ÿš™œÑ%Ô%€DØ
€CØð !ð !ˆÝ�Q—V’V˜A˜q ™s‘^”^Ñ$Ô$ˆØŒ~ˆØ�ˆ9ˆ9˜˜T˜	˜	ØˆEØ�
Š
�1‰Œˆˆà�‰s•C˜�I˜qÐ Ð ð9ð 9ð 9ð 9ð 9ð 9ð €CØ	�Š�‰Œ€AØ‡x‚x��{„{�aÒÐÝ�×!Ò! ! Q¡$Ñ'Ô'¨Ñ+Ô+ˆÝ�×!Ò! ! Q¡$Ñ'Ô'¨Ñ+Ô+ˆØˆb��A˜˜A˜a™C™ ‘{Ñ#Ô#ˆØˆ?Ø�Q‘3˜˜1™‘9˜c 1Ð$Ð$ð €CØ	�Š�‰Œ€AØ‡x‚x��{„{�aÒÐÝ˜!‘H”Hð 	ð 	ˆDÝ�Q×%Ò% a¨¡d¨1¨a©4¡iÑ0Ô0°!Ñ4Ô4ˆAÝ�Q×%Ò% a¨¡dÑ+Ô+¨QÑ/Ô/ˆAØ�"�Q˜˜A  !¡™G Q™; q™=Ñ)Ô)ˆCØˆØ˜‘s˜1‘u˜q ™s‘{ C¨Ð*Ð*Ð*Ð*Ø�aˆDˆAˆqˆqð Ðð	ð 	r"   r4   )*Úsympy.core.addr   Úsympy.core.exprtoolsr   Úsympy.core.functionr   r   Úsympy.core.powerr   Úsympy.core.singletonr   Úsympy.core.sortingr	   Úsympy.core.symbolr
   Ú&sympy.functions.elementary.exponentialr   r   r   Ú(sympy.functions.elementary.miscellaneousr   Úsympy.polys.polyrootsr   Úsympy.polys.polytoolsr   r   Úsympy.simplify.simplifyr   Úsympy.simplify.radsimpr   r   Úsympy.solvers.solversr   r   Úsympy.utilities.iterablesr   r+   r?   rG   rr   ry   r¥   r   r"   r    ú<module>r¿      sÌ  ðØ Ð Ð Ð Ð Ð Ø -Ð -Ð -Ð -Ð -Ð -Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø  Ð  Ð  Ð  Ð  Ð  Ø "Ð "Ð "Ð "Ð "Ð "Ø &Ð &Ð &Ð &Ð &Ð &Ø #Ð #Ð #Ð #Ð #Ð #Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø *Ð *Ð *Ð *Ð *Ð *Ø +Ð +Ð +Ð +Ð +Ð +Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø *Ð *Ð *Ð *Ð *Ð *ðð ð ð8"ð "ð "ð "ðJ"ð "ð "ðJEð Eð EðP]ð ]ð ]ð@ &*ð \ð \ð \ð \ð \ð \ð \r"   