ó
9­\c           @  s¹  d  Z  d d l m Z m Z d d l m Z d d l m Z m Z m	 Z	 m
 Z
 m Z d d l m Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z d d l m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& d d	 l' m( Z( d d
 l) m* Z* m+ Z+ m, Z, d d l- m. Z. m/ Z/ m0 Z0 d d l1 m2 Z2 m3 Z3 d d l4 m5 Z5 d d l6 m7 Z7 m8 Z8 m9 Z9 d d l: m; Z; d d l< m= Z= m> Z> m? Z? m@ Z@ mA ZA mB ZB mC ZC mD ZD mE ZE mF ZF mG ZG mH ZH mI ZI mJ ZJ mK ZK d d lL mM ZM mN ZN d d lO mP ZP mQ ZQ mR ZR mS ZS mT ZT mU ZU mV ZV mW ZW mX ZX mY ZY d d lZ m[ Z[ d d l\ m] Z] d d l^ m_ Z_ m` Z` d d la mb Zb mc Zc md Zd me Ze mf Zf mg Zg d d lh mi Zi mj Zj d d lk ml Zl mm Zm d d ln mo Zo d d lp mq Zq d d lr ms Zs mt Zt mu Zu d d lv mw Zw d d lx my Zy d d lz m{ Z{ d d l| m} Z} d d  l~ m Z d d! l€ m Z d d" l‚ Z‚ d# „  Zƒ d$ „  Z„ d% „  Z… d& „  Z† e‡ d' „ Zˆ d( „  Z‰ e‡ d) „ ZŠ d* „  Z‹ d+ „  ZŒ d, „  Z d- g  g  d. „ ZŽ d/ „  Z d0 „  Z d1 „  Z‘ d2 „  Z’ d3 „  Z“ d4 „  Z” e‡ d5 „ Z• d6 „  Z– i d7 „  eA 6d8 „  e@ 6Z— d9 „  Z˜ ew d: „  ƒ Z™ d; „  Zš d< „  Z› d d= lœ m Z mž Zž mŸ ZŸ d" S(>   s  
This module contain solvers for all kinds of equations:

    - algebraic or transcendental, use solve()

    - recurrence, use rsolve()

    - differential, use dsolve()

    - nonlinear (numerically), use nsolve()
      (you will need a good starting point)

iÿÿÿÿ(   t   print_functiont   division(   t   divisors(   t   iterablet   is_sequencet   orderedt   default_sort_keyt   range(   t   sympify(	   t   St   Addt   Symbolt   Equalityt   Dummyt   Exprt   Mult   Powt
   Unequality(   t   factor_terms(   t
   expand_mult   expand_multinomialt
   expand_logt
   Derivativet   AppliedUndeft   UndefinedFunctiont   nfloatt   Functiont   expand_power_expt   Lambdat   _mexpandt   expand(   t   Integral(   t   ilcmt   Floatt   Rational(   t
   Relationalt   Get
   _canonical(   t	   fuzzy_nott	   fuzzy_and(   t   integer_log(   t   Andt   Ort   BooleanAtom(   t   preorder_traversal(   t   logt   expt   LambertWt   cost   sint   tant   acost   asint   atant   Abst   ret   imt   argt   sqrtt   atan2(   t   TrigonometricFunctiont   HyperbolicFunction(
   t   simplifyt   collectt   powsimpt   posifyt	   powdenestt	   nsimplifyt   denomt
   logcombinet
   sqrtdenestt   fraction(   t
   sqrt_depth(   t   TR1(   t   Matrixt   zeros(   t   rootst   cancelt   factort   Polyt   togethert   degree(   t   GeneratorsNeededt   PolynomialError(   t   piecewise_foldt	   Piecewise(   t   lambdify(   t
   filldedent(   t   uniqt   generate_bellt   flatten(   t   conserve_mpmath_dps(   t   findroot(   t   solve_poly_system(   t   reduce_inequalities(   t   GeneratorType(   t   defaultdictNc         C  s  t  |  ƒ r( t  | ƒ r( t d ƒ ‚ n  t | ƒ } i  } x[ t | ƒ D]M \ } } t | t ƒ rG | | k rG t d | ƒ | | <| | | | <qG qG Wg  } xO |  D]G } t | d d ƒ } | d k	 rß | j	 | | ƒ ƒ q¥ | j	 | ƒ q¥ Wd „  | j
 ƒ  Dƒ } | | | f S(   sì  Return (e, s, d) where e and s are versions of eqs and
    symbols in which any non-Symbol objects in symbols have
    been replaced with generic Dummy symbols and d is a dictionary
    that can be used to restore the original expressions.

    Examples
    ========

    >>> from sympy.solvers.solvers import recast_to_symbols
    >>> from sympy import symbols, Function
    >>> x, y = symbols('x y')
    >>> fx = Function('f')(x)
    >>> eqs, syms = [fx + 1, x, y], [fx, y]
    >>> e, s, d = recast_to_symbols(eqs, syms); (e, s, d)
    ([_X0 + 1, x, y], [_X0, y], {_X0: f(x)})

    The original equations and symbols can be restored using d:

    >>> assert [i.xreplace(d) for i in eqs] == eqs
    >>> assert [d.get(i, i) for i in s] == syms
    s%   Both eqs and symbols must be iterables   X%dt   subsc         S  s   i  |  ] \ } } | | “ q S(    (    (   t   .0t   kt   v(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys
   <dictcomp>d   s   	 N(   R   t
   ValueErrort   listt	   enumeratet
   isinstanceR   R   t   getattrt   Nonet   appendt   items(   t   eqst   symbolst   new_symbolst   swap_symt   it   st   new_ft   isubs(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   recast_to_symbols?   s     c         C  s%   t  |  t ƒ o$ |  j p$ t  |  t ƒ S(   s$   Return True if e is a Pow or is exp.(   Rh   R   t   is_PowR.   (   t   e(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _ispowh   s    c         C  sg   t  ƒ  } xW t |  | ƒ D]F } | j rR | j j rR | j j rF q n  | j } n  | j | ƒ q W| S(   N(   t   sett   denomsRv   R.   t	   is_Numbert   is_zerot   baset   add(   t   fRn   t   denst   d(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _simple_densm   s    	c           s   t  |  ƒ } t ƒ  } xV | D]N } t | ƒ } | t j k rC q n  x$ t j | ƒ D] } | j | ƒ qS Wq W| sx | St | ƒ d k rª t	 | d ƒ rª | d } qª n  g  } xC | D]; } | j
 ‰  t ‡  f d †  | Dƒ ƒ r· | j | ƒ q· q· Wt | ƒ S(   sp  Return (recursively) set of all denominators that appear in eq
    that contain any symbol in ``symbols``; if ``symbols`` are not
    provided then all denominators will be returned.

    Examples
    ========

    >>> from sympy.solvers.solvers import denoms
    >>> from sympy.abc import x, y, z
    >>> from sympy import sqrt

    >>> denoms(x/y)
    {y}

    >>> denoms(x/(y*z))
    {y, z}

    >>> denoms(3/x + y/z)
    {x, z}

    >>> denoms(x/2 + y/z)
    {2, z}

    If `symbols` are provided then only denominators containing
    those symbols will be returned

    >>> denoms(1/x + 1/y + 1/z, y, z)
    {y, z}
    i   i    c         3  s   |  ] } | ˆ  k Vq d  S(   N(    (   Rb   Rr   (   t   free(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>«   s    (   R,   Ry   RD   R	   t   OneR   t	   make_argsR~   t   lenR   t   free_symbolst   anyRk   (   t   eqRn   t   potR€   t   pt   denR   t   rv(    (   Rƒ   s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRz   |   s&    		c           s¶  d d l  m } | j d t ƒ } | d k	 r> i | | 6} n4 t | t ƒ rV | } n d } t | | | f ƒ ‚ t |  ƒ râ |  s“ t d ƒ ‚ n  t	 } xB |  D]: } t
 | | |  }	 |	 rÄ q  n  |	 t k rÔ t Sd } q  W| St |  t ƒ r |  j ƒ  }  n© t |  t t f ƒ r©|  j t j t j f k r<|  j }  n  |  j \ }
 } |
 t j t j f k r‘|  j | ƒ }  |  t j t j f k r¦d Sq©|  j t d t ƒ}  n  t |  t ƒ rÂt |  ƒ S|  j r×|  r×t	 S| rû|  j t | j ƒ  ƒ @rûd St t j t j t j  t j! g ƒ ‰  t" ‡  f d †  | j# ƒ  Dƒ ƒ rEt S|  } d } | j d	 t	 ƒ } x&| d
 7} | d k rÇ|  j | ƒ } t | t$ ƒ r°| j% | ƒ d } n  | j& ƒ  ˆ  @rþt Sn7| d
 k r6| j' sþ| j( d | t) | j ƒ  ƒ Œ st S| j* ƒ  \ } } t+ | j, ƒ  d d t	 ƒ} qþnÈ| d k ré| rLd S| j d t	 ƒ r†x% | D] } t- | | ƒ | | <qeWn  t- |  j | ƒ ƒ } | j d t	 ƒ rþt. | ƒ \ } } t+ | d t	 ƒ} | j' ræ| } qæqþnt/ t0 | ƒ ƒ } t ƒ  } t } x€ | D]x } | | k r)qn  | j1 | ƒ | j2 rU| j3 j4 rUt	 } n* | j5 rgt	 } n t | t6 ƒ rt	 } n  | rPqqW| t k rt S| j d t	 ƒ rÁ| j | ƒ } n  t7 | j8 ƒ } | d k	 rý| j' rø| j9 t: ƒ rød S| SP| | k rqfn | j; r#| d k S| r‚| j' r‚| t j t j f k rTt | ƒ St t< | j= d ƒ j= d d t	 ƒƒ d k  ƒ S| } qfW| j d t ƒ r²t> j? d | ƒ n  d S(   s€  Checks whether sol is a solution of equation f == 0.

    Input can be either a single symbol and corresponding value
    or a dictionary of symbols and values. When given as a dictionary
    and flag ``simplify=True``, the values in the dictionary will be
    simplified. ``f`` can be a single equation or an iterable of equations.
    A solution must satisfy all equations in ``f`` to be considered valid;
    if a solution does not satisfy any equation, False is returned; if one or
    more checks are inconclusive (and none are False) then None
    is returned.

    Examples
    ========

    >>> from sympy import symbols
    >>> from sympy.solvers import checksol
    >>> x, y = symbols('x,y')
    >>> checksol(x**4 - 1, x, 1)
    True
    >>> checksol(x**4 - 1, x, 0)
    False
    >>> checksol(x**2 + y**2 - 5**2, {x: 3, y: 4})
    True

    To check if an expression is zero using checksol, pass it
    as ``f`` and send an empty dictionary for ``symbol``:

    >>> checksol(x**2 + x - x*(x + 1), {})
    True

    None is returned if checksol() could not conclude.

    flags:
        'numerical=True (default)'
           do a fast numerical check if ``f`` has only one symbol.
        'minimal=True (default is False)'
           a very fast, minimal testing.
        'warn=True (default is False)'
           show a warning if checksol() could not conclude.
        'simplify=True (default)'
           simplify solution before substituting into function and
           simplify the function before trying specific simplifications
        'force=True (default is False)'
           make positive all symbols without assumptions regarding sign.

    iÿÿÿÿ(   t   Unitt   minimals;   Expecting (sym, val) or ({sym: val}, None) but got (%s, %s)s   no functions to checkNt   evaluatec         3  s+   |  ]! \ } } t  | ƒ j ƒ  ˆ  @Vq d  S(   N(   R   t   atoms(   Rb   Rc   Rd   (   t   illegal(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>  s    t	   numericali   i    R>   t	   recursivei   t   forcei   i   t   chopg•Ö&è.>t   warns(   
	Warning: could not verify solution %s.(@   t   sympy.physics.unitsRŽ   t   gett   FalseRj   Rh   t   dictRe   R   t   Truet   checksolRO   t   as_exprR   R   t   rhsR	   t   truet   falset   reversedt   argsRa   t   rewriteR
   R+   t   boolt   is_RelationalR‡   Ry   t   keyst   NaNt   ComplexInfinityt   Infinityt   NegativeInfinityRˆ   Rl   R   t   as_independentR‘   t	   is_numbert   is_constantRf   t   as_content_primitiveR   t   as_numer_denomR>   RA   R,   R   R~   Rv   R.   t
   is_Integert   is_FunctionR   R&   R|   t   hasR/   t   is_Rationalt   abst   nt   warningsR—   (   R   t   symbolt   solt   flagsRŽ   R   t   msgR   t   fit   checkt   Bt   Et   wast   attemptR“   t   valt   _Rc   t   repst   exvalRŠ   t   seent   saw_pow_funcR‹   t   nz(    (   R’   s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR   °   sØ    /	

 	"
	""							

.
c         K  sf   t  |  ƒ }  i  } xM t | j ƒ  ƒ D]9 } t |  d | d ƒ } | | | k	 r% | | | <q% q% W| S(   s@  Return a dictionary containing assumptions with values not
    matching those of the passed assumptions.

    Examples
    ========

    >>> from sympy import failing_assumptions, Symbol

    >>> x = Symbol('x', real=True, positive=True)
    >>> y = Symbol('y')
    >>> failing_assumptions(6*x + y, real=True, positive=True)
    {'positive': None, 'real': None}

    >>> failing_assumptions(x**2 - 1, positive=True)
    {'positive': None}

    If all assumptions satisfy the `expr` an empty dictionary is returned.

    >>> failing_assumptions(x**2, positive=True)
    {}
    s   is_%sN(   R   Rf   R§   Ri   Rj   (   t   exprt   assumptionst   failedt   keyt   test(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   failing_assumptionso  s    c           s}   t  ˆ ƒ ‰ | rQ t | t ƒ s0 t d ƒ ‚ n  ˆ rE t d ƒ ‚ n  | j ‰ n  ‡ ‡ f d †  ‰  t ‡  f d †  ˆ Dƒ ƒ S(   sˆ  Checks whether expression `expr` satisfies all assumptions.

    `assumptions` is a dict of assumptions: {'assumption': True|False, ...}.

    Examples
    ========

       >>> from sympy import Symbol, pi, I, exp, check_assumptions

       >>> check_assumptions(-5, integer=True)
       True
       >>> check_assumptions(pi, real=True, integer=False)
       True
       >>> check_assumptions(pi, real=True, negative=True)
       False
       >>> check_assumptions(exp(I*pi/7), real=False)
       True

       >>> x = Symbol('x', real=True, positive=True)
       >>> check_assumptions(2*x + 1, real=True, positive=True)
       True
       >>> check_assumptions(-2*x - 5, real=True, positive=True)
       False

       To check assumptions of ``expr`` against another variable or expression,
       pass the expression or variable as ``against``.

       >>> check_assumptions(2*x + 1, x)
       True

       `None` is returned if check_assumptions() could not conclude.

       >>> check_assumptions(2*x - 1, real=True, positive=True)
       >>> z = Symbol('z')
       >>> check_assumptions(z, real=True)

    See Also
    ========
    failing_assumptions
    s    against should be of type Symbols"   No assumptions should be specifiedc           s4   t  ˆ d |  d  ƒ } | d  k	 r0 ˆ  |  | k Sd  S(   Nt   is_(   Ri   Rj   (   RÌ   Rd   (   RÊ   RÉ   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _test¾  s    c         3  s   |  ] } ˆ  | ƒ Vq d  S(   N(    (   Rb   RÌ   (   RÐ   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>Â  s    (   R   Rh   R   t	   TypeErrort   AssertionErrort   assumptions0R'   (   RÉ   t   againstRÊ   (    (   RÐ   RÊ   RÉ   s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   check_assumptionsŽ  s    )c   -        sM  d „  ‰ t  |  ƒ } ˆ oL ˆ d oL t ˆ d t ƒ pL t ˆ d d t ƒ} ‡ f d †  |  ˆ g Dƒ \ }  ‰ t |  t ƒ r· g  |  D]' ‰ ˆ t j k	 o¥ ˆ t k	 r® ˆ ^ q‡ }  n  | j	 d t
 ƒ } ˆ r‰t ƒ  j g  |  D] } | j ^ qà Œ  ‰ t ˆ ƒ t |  ƒ k  rtx^ |  D]V } t | ƒ } xA | D]9 } t | t ƒ rit | d <ˆ j | ƒ | j ƒ  n  q0WqWn  t ˆ ƒ ‰ t
 } n/ t ˆ ƒ d k o¨t  ˆ d ƒ r¸ˆ d ‰ n  | j d t ƒ  ƒ }	 |	 rt |	 t ƒ rî|	 g }	 n  t ƒ  j g  t |	 ƒ D] }
 |
 j ^ qŒ  }	 n  g  ˆ D] ‰ ˆ |	 k r>ˆ ^ q&‰ xÊt |  ƒ D]¼\ } } t | t t f ƒ r³d	 g  | j D] } t | ƒ j ^ qk r°| j | j } nö | j } | d t j t j f k rì| d | d f } n  | \ } } | t j t j f k r‘t | t ƒ r)| } n  | j rQ| t j k rH| n | } n= | j  ra| Sn- | j! oq| j  r|| Sn t" t# d
 ƒ ƒ ‚ n | j$ t% d t
 ƒ} | |  | <n  | j rÏt& |  d ˆ ƒSn  t | t' ƒ rñ| j( ƒ  |  | <n  |  | j) d „  d „  ƒ |  | <|  | j* rKt
 } |  j+ t |  | ƒ ƒ t j, |  | <n  |  | j } | oqt- d „  | Dƒ ƒ r|  | j. ƒ  \ } } |  | j/ t0 t1 t2 t3 ƒ ‰ | oÞ| oÞ| | k oÞt4 ‡ f d †  | | f Dƒ ƒ r
| rðt
 } n  | | g |  | | d +n  n  qQWt4 d „  |  Dƒ ƒ rP| j	 d t
 ƒ rIg  t ƒ  f Sn  g  Sn  t5 d ƒ } t6 | t7 | t8 | d ƒ f | t f ƒ ƒ } xht |  ƒ D]Z\ } } g  } x  | j/ t9 ƒ D] } | j: ˆ Œ  rÕq¹n  | j d j; t< k rþt" d | ƒ ‚ n  | j= | | j d j; r*| | j d ƒ n | | j d t j> ƒ f ƒ q¹W| j? | ƒ } g  | j/ t2 ƒ D] } | j: ˆ Œ  r†| ^ qk} | j@ tA t tB | g  | D]0 } tC t1 | j d ƒ t0 | j d ƒ ƒ ^ q¥ƒ ƒ ƒ ƒ } | |  | <q—Wg  } xo ˆ D]g ‰ ˆ j; pˆ jD r qn  t4 ‡ f d †  |  Dƒ ƒ ri| j= ˆ t0 ˆ ƒ t j> t1 ˆ ƒ f ƒ n  qW| rx{ | D]s \ ‰ } x4 t |  ƒ D]& \ } } | j@ i | ˆ 6ƒ |  | <q“W|  j= ˆ | ƒ ˆ j+ t0 ˆ ƒ t1 ˆ ƒ g ƒ qzW| r t
 } n  t | d <n  t tE ˆ ƒ ƒ ‰ | r;tF ˆ d tG ƒ‰ n  tH |  ˆ ƒ \ }  ‰ ‰ t ˆ ƒ } g  } xˆ |  D]€ } t
 } | j: | Œ  rt } nF | jI rÁ| jJ r¸| jK r±qln  g  Sn  t } n | jL ƒ  rÖt } n  | rì| j= | ƒ n  qlW| rþg  Sn  | }  ~ t ƒ  } t ƒ  ‰ x|  D]þ } t | ƒ } xé | D]á } t | t ƒ p[	t | t7 ƒ ra	n¯ t | tM ƒ pµ	| j pµ	| | k pµ	| jN pµ	| jO pµ	| jP o¥	| pµ	| jQ oµ	| oÊ	| jR t0 t1 f k rÓ	q9	n= | | k r
| j | ƒ | j | @r

ˆ j | ƒ n q9	n  | j ƒ  q9	Wq 	W~ tA t tB ˆ g  ˆ D] } t5 ƒ  ^ q8
ƒ ƒ ƒ ‰ g  |  D] } | j? ˆ ƒ ^ q]
}  g  ˆ jS ƒ  D]* \ ‰ } | ˆ j@ ˆ ƒ j? ˆ ƒ f ^ q…
‰ t
 } | j	 d t ƒ t
 k	 r!xH t |  ƒ D]: \ } } | j: tT ƒ rt } tU | d t ƒ|  | <n  qà
Wn  tV |  d ˆ ƒ | d <‡  ‡ f d †  ‰  x9 t |  ƒ D]+ \ } } ˆ  | ƒ r‚tW | ƒ |  | <n  qWW| r¥tX |  d ˆ | Ž } n tY |  ˆ |  } ˆ ré‡ f d †  }  xtZ d ƒ D]ó } t | tA ƒ rþ|  | ƒ } PnÎ | ot | t ƒ rÁt | d tA ƒ rIg  | D] ‰ |  ˆ ƒ ^ q-} Pnu t | d t[ ƒ r›g  | D]. ‰ t[ g  ˆ D] } | j? ˆ ƒ ^ qsƒ ^ qc} Pn# g  | D] } | j? ˆ ƒ ^ q¢} Pn | rÌPn  qÙWt" t# d | ƒ ƒ ‚ n  ˆ r­g  ˆ D] ‰ ˆ j	 ˆ ˆ ƒ ^ qö‰ t | tA ƒ rB‡ f d †  | jS ƒ  Dƒ } nh | ogt | t ƒ ogt | d tA ƒ rªx: t | ƒ D], \ } }! ‡ f d †  |! jS ƒ  Dƒ | | <qwWn  n  | j	 d t
 ƒ oï| oï| oït | tA ƒ oït- d „  | Dƒ ƒ r<g  | D]: }" t[ g  ˆ D]! ‰ |" j	 ˆ ˆ ƒ j? |" ƒ ^ q	ƒ ^ qù} n  | j	 d t ƒ }# | oo| oo| j	 d t< ƒ t< k r‡t\ | d  t
 ƒ} n  |# o| r¸| j	 d! t
 ƒ }$ g  }% g  }& t | t[ ƒ rÇ| Sn«t | t ƒ rnt | d t[ ƒ rhxy | D]q }! xh tB ˆ |! ƒ D]J \ }' }( t] |( |' j^  }) |) t
 k r4Pn  |) t< k rP|% j= |! ƒ n  qW|& j= |! ƒ qðWnt | d tA ƒ r	xˆ | D]€ }! t
 }* xq |! jS ƒ  D]@ \ }' }( t] |( |' j^  }) |) rÅq›n  |) t
 k rÕPn  t }* q›W|& j= |! ƒ |* r|% j= |! ƒ n  q‚Wnb x_ | D]W }! t] |! ˆ d j^  }) |) t
 k r>qn  |& j= |! ƒ |) t< k rg|% j= |! ƒ n  qWnt | tA ƒ rùt
 }* xp | jS ƒ  D]F \ }' }( t] |( |' j^  }) |) rºqn  |) t
 k rÐt< }& Pn  t }* qW| }& |* rö|% j= | ƒ n  ny t | t_ t` ta f ƒ rft ˆ ƒ d k r2tb d" ƒ ‚ n  |$ oBˆ d j^ rctc jd t# d# ˆ d ƒ ƒ n  n te d$ ƒ ‚ |& } |$ o|% rµtc jd t# d% d& d' jf d( „  |% Dƒ ƒ ƒ ƒ n  n  | j	 d t
 ƒ }+ | j	 d t
 ƒ }, |, oït | t ƒ r| jg d tG ƒ n  |+ o|, r | pg  Sn  | r0g  } n· t | tA ƒ rK| g } nœ t  | d ƒ rŒg  | D]! ‰ tA t tB ˆ ˆ ƒ ƒ ƒ ^ qb} n[ t | d tA ƒ r¢nE t ˆ ƒ d k rÃtb d" ƒ ‚ n  g  | D] ‰ i ˆ ˆ d 6^ qÊ} |+ rô| Sn  |, s th ‚ | rg  t ƒ  f Sn  t ti | d jj ƒ  ƒ ƒ ‰ ˆ ‡ f d) †  | Dƒ f S(*   s°>  
    Algebraically solves equations and systems of equations.

    Currently supported are:
        - polynomial,
        - transcendental
        - piecewise combinations of the above
        - systems of linear and polynomial equations
        - systems containing relational expressions.

    Input is formed as:

    * f
        - a single Expr or Poly that must be zero,
        - an Equality
        - a Relational expression
        - a Boolean
        - iterable of one or more of the above

    * symbols (object(s) to solve for) specified as
        - none given (other non-numeric objects will be used)
        - single symbol
        - denested list of symbols
          e.g. solve(f, x, y)
        - ordered iterable of symbols
          e.g. solve(f, [x, y])

    * flags
        'dict'=True (default is False)
            return list (perhaps empty) of solution mappings
        'set'=True (default is False)
            return list of symbols and set of tuple(s) of solution(s)
        'exclude=[] (default)'
            don't try to solve for any of the free symbols in exclude;
            if expressions are given, the free symbols in them will
            be extracted automatically.
        'check=True (default)'
            If False, don't do any testing of solutions. This can be
            useful if one wants to include solutions that make any
            denominator zero.
        'numerical=True (default)'
            do a fast numerical check if ``f`` has only one symbol.
        'minimal=True (default is False)'
            a very fast, minimal testing.
        'warn=True (default is False)'
            show a warning if checksol() could not conclude.
        'simplify=True (default)'
            simplify all but polynomials of order 3 or greater before
            returning them and (if check is not False) use the
            general simplify function on the solutions and the
            expression obtained when they are substituted into the
            function which should be zero
        'force=True (default is False)'
            make positive all symbols without assumptions regarding sign.
        'rational=True (default)'
            recast Floats as Rational; if this option is not used, the
            system containing floats may fail to solve because of issues
            with polys. If rational=None, Floats will be recast as
            rationals but the answer will be recast as Floats. If the
            flag is False then nothing will be done to the Floats.
        'manual=True (default is False)'
            do not use the polys/matrix method to solve a system of
            equations, solve them one at a time as you might "manually"
        'implicit=True (default is False)'
            allows solve to return a solution for a pattern in terms of
            other functions that contain that pattern; this is only
            needed if the pattern is inside of some invertible function
            like cos, exp, ....
        'particular=True (default is False)'
            instructs solve to try to find a particular solution to a linear
            system with as many zeros as possible; this is very expensive
        'quick=True (default is False)'
            when using particular=True, use a fast heuristic instead to find a
            solution with many zeros (instead of using the very slow method
            guaranteed to find the largest number of zeros possible)
        'cubics=True (default)'
            return explicit solutions when cubic expressions are encountered
        'quartics=True (default)'
            return explicit solutions when quartic expressions are encountered
        'quintics=True (default)'
            return explicit solutions (if possible) when quintic expressions
            are encountered

    Examples
    ========

    The output varies according to the input and can be seen by example::

        >>> from sympy import solve, Poly, Eq, Function, exp
        >>> from sympy.abc import x, y, z, a, b
        >>> f = Function('f')

    * boolean or univariate Relational

        >>> solve(x < 3)
        (-oo < x) & (x < 3)


    * to always get a list of solution mappings, use flag dict=True

        >>> solve(x - 3, dict=True)
        [{x: 3}]
        >>> sol = solve([x - 3, y - 1], dict=True)
        >>> sol
        [{x: 3, y: 1}]
        >>> sol[0][x]
        3
        >>> sol[0][y]
        1


    * to get a list of symbols and set of solution(s) use flag set=True

        >>> solve([x**2 - 3, y - 1], set=True)
        ([x, y], {(-sqrt(3), 1), (sqrt(3), 1)})


    * single expression and single symbol that is in the expression

        >>> solve(x - y, x)
        [y]
        >>> solve(x - 3, x)
        [3]
        >>> solve(Eq(x, 3), x)
        [3]
        >>> solve(Poly(x - 3), x)
        [3]
        >>> solve(x**2 - y**2, x, set=True)
        ([x], {(-y,), (y,)})
        >>> solve(x**4 - 1, x, set=True)
        ([x], {(-1,), (1,), (-I,), (I,)})

    * single expression with no symbol that is in the expression

        >>> solve(3, x)
        []
        >>> solve(x - 3, y)
        []

    * single expression with no symbol given

          In this case, all free symbols will be selected as potential
          symbols to solve for. If the equation is univariate then a list
          of solutions is returned; otherwise -- as is the case when symbols are
          given as an iterable of length > 1 -- a list of mappings will be returned.

            >>> solve(x - 3)
            [3]
            >>> solve(x**2 - y**2)
            [{x: -y}, {x: y}]
            >>> solve(z**2*x**2 - z**2*y**2)
            [{x: -y}, {x: y}, {z: 0}]
            >>> solve(z**2*x - z**2*y**2)
            [{x: y**2}, {z: 0}]

    * when an object other than a Symbol is given as a symbol, it is
      isolated algebraically and an implicit solution may be obtained.
      This is mostly provided as a convenience to save one from replacing
      the object with a Symbol and solving for that Symbol. It will only
      work if the specified object can be replaced with a Symbol using the
      subs method.

          >>> solve(f(x) - x, f(x))
          [x]
          >>> solve(f(x).diff(x) - f(x) - x, f(x).diff(x))
          [x + f(x)]
          >>> solve(f(x).diff(x) - f(x) - x, f(x))
          [-x + Derivative(f(x), x)]
          >>> solve(x + exp(x)**2, exp(x), set=True)
          ([exp(x)], {(-sqrt(-x),), (sqrt(-x),)})

          >>> from sympy import Indexed, IndexedBase, Tuple, sqrt
          >>> A = IndexedBase('A')
          >>> eqs = Tuple(A[1] + A[2] - 3, A[1] - A[2] + 1)
          >>> solve(eqs, eqs.atoms(Indexed))
          {A[1]: 1, A[2]: 2}

        * To solve for a *symbol* implicitly, use 'implicit=True':

            >>> solve(x + exp(x), x)
            [-LambertW(1)]
            >>> solve(x + exp(x), x, implicit=True)
            [-exp(x)]

        * It is possible to solve for anything that can be targeted with
          subs:

            >>> solve(x + 2 + sqrt(3), x + 2)
            [-sqrt(3)]
            >>> solve((x + 2 + sqrt(3), x + 4 + y), y, x + 2)
            {y: -2 + sqrt(3), x + 2: -sqrt(3)}

        * Nothing heroic is done in this implicit solving so you may end up
          with a symbol still in the solution:

            >>> eqs = (x*y + 3*y + sqrt(3), x + 4 + y)
            >>> solve(eqs, y, x + 2)
            {y: -sqrt(3)/(x + 3), x + 2: (-2*x - 6 + sqrt(3))/(x + 3)}
            >>> solve(eqs, y*x, x)
            {x: -y - 4, x*y: -3*y - sqrt(3)}

        * if you attempt to solve for a number remember that the number
          you have obtained does not necessarily mean that the value is
          equivalent to the expression obtained:

            >>> solve(sqrt(2) - 1, 1)
            [sqrt(2)]
            >>> solve(x - y + 1, 1)  # /!\ -1 is targeted, too
            [x/(y - 1)]
            >>> [_.subs(z, -1) for _ in solve((x - y + 1).subs(-1, z), 1)]
            [-x + y]

        * To solve for a function within a derivative, use dsolve.

    * single expression and more than 1 symbol

        * when there is a linear solution

            >>> solve(x - y**2, x, y)
            [(y**2, y)]
            >>> solve(x**2 - y, x, y)
            [(x, x**2)]
            >>> solve(x**2 - y, x, y, dict=True)
            [{y: x**2}]

        * when undetermined coefficients are identified

            * that are linear

                >>> solve((a + b)*x - b + 2, a, b)
                {a: -2, b: 2}

            * that are nonlinear

                >>> solve((a + b)*x - b**2 + 2, a, b, set=True)
                ([a, b], {(-sqrt(2), sqrt(2)), (sqrt(2), -sqrt(2))})

        * if there is no linear solution then the first successful
          attempt for a nonlinear solution will be returned

            >>> solve(x**2 - y**2, x, y, dict=True)
            [{x: -y}, {x: y}]
            >>> solve(x**2 - y**2/exp(x), x, y, dict=True)
            [{x: 2*LambertW(y/2)}]
            >>> solve(x**2 - y**2/exp(x), y, x)
            [(-x*sqrt(exp(x)), x), (x*sqrt(exp(x)), x)]

    * iterable of one or more of the above

        * involving relationals or bools

            >>> solve([x < 3, x - 2])
            Eq(x, 2)
            >>> solve([x > 3, x - 2])
            False

        * when the system is linear

            * with a solution

                >>> solve([x - 3], x)
                {x: 3}
                >>> solve((x + 5*y - 2, -3*x + 6*y - 15), x, y)
                {x: -3, y: 1}
                >>> solve((x + 5*y - 2, -3*x + 6*y - 15), x, y, z)
                {x: -3, y: 1}
                >>> solve((x + 5*y - 2, -3*x + 6*y - z), z, x, y)
                {x: 2 - 5*y, z: 21*y - 6}

            * without a solution

                >>> solve([x + 3, x - 3])
                []

        * when the system is not linear

            >>> solve([x**2 + y -2, y**2 - 4], x, y, set=True)
            ([x, y], {(-2, -2), (0, 2), (2, -2)})

        * if no symbols are given, all free symbols will be selected and a list
          of mappings returned

            >>> solve([x - 2, x**2 + y])
            [{x: 2, y: -4}]
            >>> solve([x - 2, x**2 + f(x)], {f(x), x})
            [{x: 2, f(x): -4}]

        * if any equation doesn't depend on the symbol(s) given it will be
          eliminated from the equation set and an answer may be given
          implicitly in terms of variables that were not of interest

            >>> solve([x - y, y - 3], x)
            {x: y}

    Notes
    =====

    solve() with check=True (default) will run through the symbol tags to
    elimate unwanted solutions.  If no assumptions are included all possible
    solutions will be returned.

        >>> from sympy import Symbol, solve
        >>> x = Symbol("x")
        >>> solve(x**2 - 1)
        [-1, 1]

    By using the positive tag only one solution will be returned:

        >>> pos = Symbol("pos", positive=True)
        >>> solve(pos**2 - 1)
        [1]


    Assumptions aren't checked when `solve()` input involves
    relationals or bools.

    When the solutions are checked, those that make any denominator zero
    are automatically excluded. If you do not want to exclude such solutions
    then use the check=False option:

        >>> from sympy import sin, limit
        >>> solve(sin(x)/x)  # 0 is excluded
        [pi]

    If check=False then a solution to the numerator being zero is found: x = 0.
    In this case, this is a spurious solution since sin(x)/x has the well known
    limit (without dicontinuity) of 1 at x = 0:

        >>> solve(sin(x)/x, check=False)
        [0, pi]

    In the following case, however, the limit exists and is equal to the
    value of x = 0 that is excluded when check=True:

        >>> eq = x**2*(1/x - z**2/x)
        >>> solve(eq, x)
        []
        >>> solve(eq, x, check=False)
        [0]
        >>> limit(eq, x, 0, '-')
        0
        >>> limit(eq, x, 0, '+')
        0

    Disabling high-order, explicit solutions
    ----------------------------------------

    When solving polynomial expressions, one might not want explicit solutions
    (which can be quite long). If the expression is univariate, CRootOf
    instances will be returned instead:

        >>> solve(x**3 - x + 1)
        [-1/((-1/2 - sqrt(3)*I/2)*(3*sqrt(69)/2 + 27/2)**(1/3)) - (-1/2 -
        sqrt(3)*I/2)*(3*sqrt(69)/2 + 27/2)**(1/3)/3, -(-1/2 +
        sqrt(3)*I/2)*(3*sqrt(69)/2 + 27/2)**(1/3)/3 - 1/((-1/2 +
        sqrt(3)*I/2)*(3*sqrt(69)/2 + 27/2)**(1/3)), -(3*sqrt(69)/2 +
        27/2)**(1/3)/3 - 1/(3*sqrt(69)/2 + 27/2)**(1/3)]
        >>> solve(x**3 - x + 1, cubics=False)
        [CRootOf(x**3 - x + 1, 0),
         CRootOf(x**3 - x + 1, 1),
         CRootOf(x**3 - x + 1, 2)]

        If the expression is multivariate, no solution might be returned:

        >>> solve(x**3 - x + a, x, cubics=False)
        []

    Sometimes solutions will be obtained even when a flag is False because the
    expression could be factored. In the following example, the equation can
    be factored as the product of a linear and a quadratic factor so explicit
    solutions (which did not require solving a cubic expression) are obtained:

        >>> eq = x**3 + 3*x**2 + x - 1
        >>> solve(eq, cubics=False)
        [-1, -1 + sqrt(2), -sqrt(2) - 1]

    Solving equations involving radicals
    ------------------------------------

    Because of SymPy's use of the principle root (issue #8789), some solutions
    to radical equations will be missed unless check=False:

        >>> from sympy import root
        >>> eq = root(x**3 - 3*x**2, 3) + 1 - x
        >>> solve(eq)
        []
        >>> solve(eq, check=False)
        [1/3]

    In the above example there is only a single solution to the
    equation. Other expressions will yield spurious roots which
    must be checked manually; roots which give a negative argument
    to odd-powered radicals will also need special checking:

        >>> from sympy import real_root, S
        >>> eq = root(x, 3) - root(x, 5) + S(1)/7
        >>> solve(eq)  # this gives 2 solutions but misses a 3rd
        [CRootOf(7*_p**5 - 7*_p**3 + 1, 1)**15,
        CRootOf(7*_p**5 - 7*_p**3 + 1, 2)**15]
        >>> sol = solve(eq, check=False)
        >>> [abs(eq.subs(x,i).n(2)) for i in sol]
        [0.48, 0.e-110, 0.e-110, 0.052, 0.052]

        The first solution is negative so real_root must be used to see
        that it satisfies the expression:

        >>> abs(real_root(eq.subs(x, sol[0])).n(2))
        0.e-110

    If the roots of the equation are not real then more care will be
    necessary to find the roots, especially for higher order equations.
    Consider the following expression:

        >>> expr = root(x, 3) - root(x, 5)

    We will construct a known value for this expression at x = 3 by selecting
    the 1-th root for each radical:

        >>> expr1 = root(x, 3, 1) - root(x, 5, 1)
        >>> v = expr1.subs(x, -3)

    The solve function is unable to find any exact roots to this equation:

        >>> eq = Eq(expr, v); eq1 = Eq(expr1, v)
        >>> solve(eq, check=False), solve(eq1, check=False)
        ([], [])

    The function unrad, however, can be used to get a form of the equation for
    which numerical roots can be found:

        >>> from sympy.solvers.solvers import unrad
        >>> from sympy import nroots
        >>> e, (p, cov) = unrad(eq)
        >>> pvals = nroots(e)
        >>> inversion = solve(cov, x)[0]
        >>> xvals = [inversion.subs(p, i) for i in pvals]

    Although eq or eq1 could have been used to find xvals, the solution can
    only be verified with expr1:

        >>> z = expr - v
        >>> [xi.n(chop=1e-9) for xi in xvals if abs(z.subs(x, xi).n()) < 1e-9]
        []
        >>> z1 = expr1 - v
        >>> [xi.n(chop=1e-9) for xi in xvals if abs(z1.subs(x, xi).n()) < 1e-9]
        [-3.0]

    See Also
    ========

        - rsolve() for solving recurrence relationships
        - dsolve() for solving differential equations

    c         S  s(   t  t t t |  ƒ r |  n |  g ƒ ƒ S(   N(   Rf   t   mapR   R   (   t   w(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _sympified_list  s    i    t   includec         3  s   |  ] } ˆ  | ƒ Vq d  S(   N(    (   Rb   R×   (   RØ   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>š  s    t   implicitR›   i   t   excludet   ImmutableDenseMatrixs   
                            Unanticipated argument of Eq when other arg
                            is True or False.
                        R   Rn   c         S  s   t  |  t ƒ S(   N(   Rh   R=   (   R×   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   <lambda>ß  t    c         S  s   |  j  t ƒ S(   N(   R¤   R.   (   R×   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   à  RÞ   c         s  s!   |  ] } | j  p | j Vq d  S(   N(   t   is_realt   is_imaginary(   Rb   Rr   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>ê  s    c         3  s+   |  ]! } | j  t t t t ƒ ˆ  Vq d  S(   N(   R‘   R7   R8   R9   R;   (   Rb   Rq   (   t   had(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>ï  s    c         s  s$   |  ] } t  | t t f ƒ Vq d  S(   N(   Rh   R¥   R+   (   Rb   R¼   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>õ  s    Ry   R×   s6   solving %s when the argument is not real or imaginary.c         3  s-   |  ]# } | j  t ˆ  ƒ t ˆ  ƒ ƒ Vq d  S(   N(   R³   R7   R8   (   Rb   R¼   (   Rr   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>  s    RÌ   t   rationalt   _denominatorsc           s<   |  j  r |  j ˆ Œ  St g  |  j D] } ˆ  | ƒ ^ q# ƒ S(   N(   t   is_PiecewiseR³   Rˆ   R£   (   Rw   t   a(   t   _has_piecewiseRn   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRæ   ‡  s    	c           s   ‡  f d †  |  j  ƒ  Dƒ S(   Nc           s(   i  |  ] \ } } | j  ˆ  ƒ | “ q S(    (   Ra   (   Rb   Rc   Rd   (   t   non_inverts(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys
   <dictcomp>ž  s   	 (   Rl   (   t   solution(   Rç   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _do_dict  s    s>   
                            no handling of %s was implementedc           s4   i  |  ]* \ } } | j  ˆ  ƒ ˆ  j | | ƒ “ q S(    (   Ra   R™   (   Rb   Rc   Rd   (   Rp   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys
   <dictcomp>Á  s   	c           s4   i  |  ]* \ } } | j  ˆ  ƒ ˆ  j | | ƒ “ q S(    (   Ra   R™   (   Rb   Rc   Rd   (   Rp   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys
   <dictcomp>Å  s   	c         s  s   |  ] } t  | t ƒ Vq d  S(   N(   Rh   R›   (   Rb   R¹   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>Ï  s    R½   t   exponentR—   s   Length should be 1sm   
                    	Warning: assumptions about variable '%s' are
                    not handled currently.s   Unrecognized solutionsi   
                	Warning: assumptions concerning following solution(s)
                can't be checked:s   
	s   , c         s  s   |  ] } t  | ƒ Vq d  S(   N(   t   str(   Rb   Rr   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>'  s    c           s3   h  |  ]) } t  g  ˆ  D] } | | ^ q ƒ ’ q S(    (   t   tuple(   Rb   Rr   t   ki(   Rc   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <setcomp>K  s   	 (k   R   Rh   R   R   R_   Rf   R	   R    Rœ   R™   Rš   Ry   t   unionR‡   R†   R,   R   R~   t   skipt   popR   R   Rg   R   R   R£   t   typet   __name__t   lhsRŸ   R¡   R¦   t	   is_Symbolt
   is_Booleant   NotImplementedErrorRW   R¤   R
   R^   RO   Rž   t   replacet	   is_Matrixt   extendt   Zerot   allt   as_real_imagR‘   R7   R8   R9   R;   Rˆ   R   R   RU   R$   R6   R³   Rß   Rj   Rk   t   ImaginaryUnitRa   t   xreplaceR›   t   zipR5   Rà   RX   t   sortedR   Ru   R­   R{   R|   R®   R¥   t   is_Addt   is_MulRv   R²   t   funcRl   R!   RC   R‚   RT   t   _solvet   _solve_systemR   Rì   R   RÕ   RÓ   R#   R)   R*   Re   R·   R—   RÑ   t   joint   sortRÒ   R   R§   (-   R   Rn   Rº   t   bare_ft   ordered_symbolsRÚ   R¼   RŠ   R‹   RÛ   Rw   Rq   Rå   R£   t   Lt   Rt   freeit   frR×   t   pieceRÄ   t   _argt   irfRŸ   t   symsett   newft   okRÆ   RÃ   Rd   t   floatsRè   Ré   R¹   t   rR½   R—   t   got_Nonet   no_Falset   symbRÂ   RÍ   t   a_Nonet   as_dictt   as_set(    (   Ræ   RØ   Rá   Rc   Rç   Rr   Rp   Rn   s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   solveÅ  sL   ÿ Ì	
	"7(
	"1%+	
			 	!.,"1I1#									
%1"= 8"%(G$

		$	1$c   =        sÀ  d } t  | ƒ d k r®d* ‰ |  j } | t | ƒ } t  | ƒ d k rq |  j | Œ  \ } } | j | j @} n  t  | ƒ d k r¿ | j ƒ  } y t |  | | ˆ   ‰ Wq¿ t k
 r» q¿ Xn  ˆ rþˆ  j d t	 ƒ rút
 ˆ t ƒ rxˆ D] } t ˆ | ƒ ˆ | <qí Wqút
 ˆ t ƒ r·t
 ˆ d t ƒ rix ˆ D]+ }	 x" |	 D] } t |	 | ƒ |	 | <qDWq7Wq÷t
 ˆ d t ƒ r¨g  ˆ D] }
 t d „  |
 Dƒ ƒ ^ qƒ‰ q÷t d ƒ ‚ qút
 ˆ t ƒ rëˆ \ } } | d „  | Dƒ f ‰ qút d ƒ ‚ n  ˆ Sg  } t g  ƒ } g  } xÊ | D]Â ‰ t |  d	 ˆ g ƒ\ } } | ˆ k rÉˆ  j d t	 ƒ rkt | ƒ } n  | j } | r¥t g  | D] } | | k ^ q„ƒ r¥qn  | j | ƒ | j i | | 6ƒ q| r| j ˆ ƒ qqW| sí| Sx¡ | D]™ ‰ y| t |  ˆ ˆ   ‰ xc ˆ D][ } | rPt g  | D] } | | j k ^ q,ƒ rPqn  | j ˆ ƒ | j i | ˆ 6ƒ qWWqôt k
 rŒqôqôXqôW| r›| St | |  ƒ ‚ n  | d ‰ ˆ  j d
 t	 ƒ ˆ  d
 <} } |  j rÐt ƒ  } xg |  j D]\ } | t t j t j t j g ƒ k r)t ƒ  } Pn  t | ˆ ˆ   ‰ | j t ˆ ƒ ƒ qòWt | ƒ } | r½ˆ  j d t |  | ƒ ƒ } g  | D]. ‰ t ‡  ‡ ‡ f d †  | Dƒ ƒ r†ˆ ^ q†} n  t } t ˆ  d <no|  j r?t ƒ  } xGt  |  j ƒ D]6\ } \ } } | j! rt d ƒ ‚ n  t | ˆ ˆ   } g  |  j |  D] \ } } | ^ q<| g } t" | Œ  } x½ | D]µ }  |  | k r‡qon  yO | j# ˆ |  ƒ } t$ | d d* ƒ }! |! d* k	 rÕ|! d d d d „  ƒ } n  Wn t k
 rìqon X| t k rÿqon  | j t% |  | f t j& t	 f ƒ ƒ qoWqòWt } t ˆ  d <n t |  d	 | ƒ\ }" } |" t j' k su| t j& k ryg  S|" j( rªˆ  j d t	 ƒ r£t | ƒ } n  | g St } d }# y/ t) |" ƒ }$ |$ d* k rät* d |" ƒ ‚ n  WnE t+ k
 r,t |" ƒ }% |% |" k rt |% ˆ ˆ   St* d ƒ ‚ n Xg  |$ j, D] }& |& j- ˆ ƒ r7|& ^ q7}' d „  }( t  |' ƒ d k rq
t t. g  |' D] }& |( |& ƒ ^ q€Œ  ƒ \ }) }* t |) ƒ }) t  |) ƒ d k sÙt d „  |* Dƒ ƒ r„	t d „  |) Dƒ ƒ }+ t g  |+ D] } t
 | t/ ƒ rù| ^ qùƒ }, |+ |, }- |- r–t  |+ j0 |, ƒ ƒ d k r–t1 |" ƒ j2 t3 ƒ }. |. |" k r–t ˆ  d
 <t |. ˆ ˆ   } | ˆ  d
 <q–n  | t k rh	|+ rh	t t4 |+ ƒ ƒ }+ |+ d }/ t5 d ƒ ‰ |" j# |/ ˆ ƒ }0 |0 j- ˆ ƒ sh	t |0 ˆ ˆ   }1 t ˆ |/ ˆ ˆ   d }2 t ƒ  } x' |1 D] } | j |2 j# ˆ | ƒ ƒ q-	Wt t4 | ƒ ƒ } qh	n  | t k rn
d |' }# qn
q?|) j ƒ  }3 t5 d ƒ ‰ t |3 ˆ ˆ ˆ   ‰ t
 |3 t6 t7 f ƒ r?d „  }4 |" j8 d „  |4 ƒ j# |3 ˆ ƒ }0 |0 j- ˆ ƒ sn
t |0 ˆ ˆ   ‰ t ƒ  } x8 ˆ D]0 } x' ˆ D] } | j | j# ˆ | ƒ ƒ q/
Wq"
Wt t4 | ƒ ƒ } qn
q?nÎt  |' ƒ d k r?t) |" |' d d t	 ƒ}$ ˆ  j d t ƒ s?d* ‰ |$ j9 ƒ  }5 t	 ˆ  d <‡  f d †  d+ Dƒ }6 t: |$ |6  ‰ t; ˆ j< ƒ  ƒ |5 k  rUy |$ j= ƒ  ‰ Wqgt k
 rQˆ  j d# t	 ƒ sRt t> d$ ƒ ƒ ‚ qRqgXn t ˆ j? ƒ  ƒ ‰ ˆ d* k	 r<|$ j@ }3 |3 ˆ k rðyK t5 d ƒ ‰ t |3 ˆ ˆ ˆ   }7 t t4 ‡ ‡ f d% †  |7 Dƒ ƒ ƒ ‰ Wqöt k
 rìd* ‰ qöXn t } ˆ d* k	 r9t  ˆ ƒ d k r-ˆ  j d t ƒ ˆ  d <n  ˆ } q9q<q?n  | t k rhˆ  j d& t	 ƒ rhy tA |" ˆ ƒ }3 Wn t* t f k
 rt }3 n X|3 re|3 \ }8 }9 |9 rò|9 \ ‰ }: t |: ˆ ˆ   d ‰ ‡ ‡ f d' †  t |8 ˆ ˆ   Dƒ }; n6 y t t |8 ˆ ˆ   ƒ }; Wn t k
 r'd* }; n X|; d* k	 rbt t4 |; ƒ ƒ } ˆ  j d t ƒ ˆ  d <qbqeqhn  | t k rÆˆ  j d d* ƒ y+ tB |" ˆ ˆ   ‰ ˆ d* k	 r®ˆ } n  WqÆtC k
 rÂqÆXn  | t k rôt d( jD |# | |  g ƒ ƒ ‚ n  ˆ  j d t	 ƒ r(t tE t | ƒ ƒ } t ˆ  d <n  | r{t |  | ƒ } g  | D]. ‰ t ‡  ‡ ‡ f d) †  | Dƒ ƒ rDˆ ^ qD} n  | r¼g  | D]+ }< tF |" i |< ˆ 6ˆ   t k	 rˆ|< ^ qˆ} n  | S(,   s°  Return a checked solution for f in terms of one or more of the
    symbols. A list should be returned except for the case when a linear
    undetermined-coefficients equation is encountered (in which case
    a dictionary is returned).

    If no method is implemented to solve the equation, a NotImplementedError
    will be raised. In the case that conversion of an expression to a Poly
    gives None a ValueError will be raised.s2   No algorithms are implemented to solve equation %si   R>   i    c         s  s   |  ] } t  | ƒ Vq d  S(   N(   R>   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>t  s    s   unrecognized args in listc         S  s&   h  |  ] } t  d  „  | Dƒ ƒ ’ q S(   c         s  s   |  ] } t  | ƒ Vq d  S(   N(   R>   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>y  s    (   Rì   (   Rb   t   j(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <setcomp>y  s   	 s   unrecognized solution typeRn   R½   Rã   c         3  s)   |  ] } t  | i ˆ ˆ 6ˆ   Vq d  S(   N(   R   (   Rb   RŒ   (   Rº   Rr   R¸   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>¶  s    s)   solve cannot represent interval solutionst   _eval_simpifyt   ratioi   t   measurec         S  s   d S(   Ni   (    (   t   x(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   Ñ  RÞ   RÞ   s   could not convert %s to Polys#   expression appears to be a constantc         S  s€   |  j  ƒ  \ } } | j r( | | j f S| j s; |  d f S| j ƒ  \ } } | j rv | t j k	 rv | | | j f S|  d f S(   s”   Return (b**e, q) for x = b**(p*e/q) where p/q is the leading
            Rational of the exponent of x, e.g. exp(-2*x/3) -> (exp(x), 3)
            i   (   t   as_base_expR´   t   qR  t   as_coeff_MulR	   R„   (   R!  t   bRw   t   ct   ee(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt
   _as_base_q  s    		
c         s  s   |  ] } | d  k Vq d S(   i   N(    (   Rb   R#  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>  s    c         s  s   |  ] } | j  r | Vq d  S(   N(   R²   (   Rb   R%  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>  s    t   ts   multiple generators %sc         S  s,   |  j  ƒ  \ } } t | ƒ } t | | ƒ S(   N(   R"  R   R   (   R‹   R%  Rw   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _expandU  s    c         S  s   |  j  p t |  t ƒ S(   N(   Rv   Rh   R.   (   R×   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   Z  RÞ   t	   compositet   tsolvec           s%   i  |  ] } ˆ  j  | t ƒ | “ q S(    (   R™   Rœ   (   Rb   Rc   (   Rº   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys
   <dictcomp>t  s   	 t   cubicst   quarticst   quinticst
   incompletes  
    Neither high-order multivariate polynomials
    nor sorting of EX-domain polynomials is supported.
    If you want to see any results, pass keyword incomplete=True to
    solve; to see numerical values of roots
    for univariate expressions, use nroots.
    c           s/   h  |  ]% } ˆ  D] } | j  ˆ | ƒ ’ q q S(    (   Ra   (   Rb   Rq   Rr   (   t   solnR)  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <setcomp>”  s   	 t   _unradc           s"   h  |  ] } ˆ  j  ˆ | ƒ ’ q S(    (   Ra   (   Rb   t   xi(   t   invt   isym(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <setcomp>´  s   	 s   
c         3  s)   |  ] } t  | i ˆ ˆ 6ˆ   Vq d  S(   N(   R   (   Rb   R   (   Rº   Rr   R¸   (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>Û  s   N(   R-  R.  R/  (G   R†   Rj   R‡   Ry   R¬   Rð   t   solve_undetermined_coeffsRö   R™   Rœ   Rh   R›   R>   Rf   Rì   RÑ   t   solve_linearRˆ   R~   Rk   R  R  R£   R	   R«   R©   Rª   t   updateR‚   Rû   Rš   Rä   Rg   R|   R)   Ra   Ri   RU   R¨   Rú   Rô   RO   Re   RR   t   gensR³   Rÿ   R<   t   intersectionRI   R¤   R2   R   R   R   R.   R÷   RQ   RL   t   sumt   valuest	   all_rootsRW   R§   t   gent   unradt   _tsolveRS   R  RÖ   R   (=   R   Rn   Rº   t   not_impl_msgRƒ   t   ext   indt   depRc   R   R  t   symt   solsRË   t   got_st   resultR3  Rd   t   vfreet   ssR¹   t	   checkdensR½   t   mR€   Rq   RÉ   t   condt
   candidatesRÃ   R&  R£   t	   candidateR  t   f_numR»   t   polyt   simplified_ft   gR9  R(  t   basest   qst   funcst   trigt   otherR  t   f1t   ftryt   cv_solst   cv_invt   uR*  t   degt   solverst   ivR‰   t   covt   ieqR   R  (    (   Rº   R4  R5  Rr   R1  R¸   R)  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR  N  sè   
	,	+.
		$			"	.			+	1)
"

			!	

	)
(
".c   -   	     s  |  s
 g  Sg  } t  ƒ  } g  } t } t } ˆ j d t ƒ } ˆ j d t ƒ }	 }
 x¶ t |  ƒ D]¨ \ } } | j t | | ƒ ƒ t | | Œ \ } } | | } | j ƒ  d } | rÊ | j	 | ƒ q` n  | j
 d t | Œ } | d  k	 rû | j	 | ƒ q` | j	 | ƒ q` W| sg  ‰ nNt d „  | Dƒ ƒ rKt | ƒ t | ƒ } } t | | d ƒ } x t | ƒ D]q \ } } xb | j ƒ  D]T \ } } y# | j d ƒ } | | | | f <Wqƒt k
 rÖ| | | | f <qƒXqƒWqjWˆ j d t ƒ rt | | ˆ Ž } n t | | ˆ Ž } | rB| r9t | j ƒ  ƒ ‰ qHg  ‰ qit } nt | ƒ t | ƒ k rÓd d	 l m } t  ƒ  j g  | D] } | j ^ qƒŒ  } t t | j | ƒ ƒ ƒ } t  ƒ  } g  } xç | | t | ƒ ƒ D]Ð } y¶ t | | Œ } | r–xš | D] ‰ t } xE ˆ D]= } | rt g  | D] } | | j k ^ q)ƒ rt } qqW| s | j | ƒ | j t  t t! | ˆ ƒ ƒ ƒ g ƒ q q Wn  WqÛt" k
 rªqÛXqÛW| rÄt | ƒ ‰ qit" d
 ƒ ‚ n– yP t | | Œ } | r"| ‰ g  | D]! ‰ t  t t! ˆ ˆ ƒ ƒ ƒ ^ qø} n  WnC t" k
 rh| j g  | D] } | j# ƒ  ^ q@ƒ g  ‰ d  } n X| rt$ | t  ƒ r–| g } q–n	 i  g } | rùt ‡ ‡ f d † ‰  t  ˆ ƒ ‰ t  | ƒ ‰ t% ƒ  } x$t | ‡  f d †  ƒ D]} g  }  g  }! t  ƒ  } t }" xã| D]¨‰ | j& ˆ ƒ }# |
 r„ˆ r„t' | | |# d t ƒ}$ |$ d  k	 r„|$ rn|  j	 ˆ ƒ q|! j	 ˆ ƒ qq„n  ˆ  |# d t ƒ}% |% s¶ˆ r²|  j	 ˆ ƒ n  Pn  xé |% D]á }& y t( |# |& ˆ  }' Wn t" k
 rïq½n Xx˜ |' D] }( | r1t g  | D] } | |( j k ^ qƒ r1q÷n  ˆ j) ƒ  }) x0 ˆ j* ƒ  D]" \ }* }+ |+ j& |& |( ƒ |) |* <qJW|( |) |& <|  j	 |) ƒ q÷Wt }" | j+ |& ƒ q½W|" st" d |# ƒ ‚ qqW|  } x* |! D]" }$ |$ | k rÌ| j, |$ ƒ qÌqÌWqëWn  t- | ƒ }, ˆ j d |, ƒ rZx3 | D]+ ‰ x" ˆ D] }* t. ˆ |* ƒ ˆ |* <q+WqWt ˆ d <n  |	 r›g  | D]+ ‰ t ‡ ‡ f d †  | Dƒ ƒ sgˆ ^ qg} n  |
 rã| rãg  | D]+ ‰ t ‡ ‡ f d †  |  Dƒ ƒ s¯ˆ ^ q¯} n  g  | D] ‰ ˆ rêˆ ^ qê} | r| r| d } n  | S(   Nt   manualR½   i    t	   extensionc         s  s   |  ] } | j  Vq d  S(   N(   t	   is_linear(   Rb   R‹   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>  s    i   t
   particulariÿÿÿÿ(   t   subsetss   no valid subset foundc           s:   |  j  ˆ ˆ  @} | r6 t | ƒ } | j d t ƒ n  | S(   NRÌ   (   R‡   Rf   R  R   (   Rw   R  R   (   t   legalt   solved_syms(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _ok_symsU  s
    c           s   t  ˆ  |  ƒ ƒ S(   N(   R†   (   RÃ   (   Rj  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   `  RÞ   R   R  s   could not solve %sR>   c         3  s!   |  ] } t  | ˆ ˆ   Vq d  S(   N(   R   (   Rb   R   (   Rº   R  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>¡  s    c         3  s'   |  ] } t  | ˆ ˆ   t k Vq d  S(   N(   R   Rš   (   Rb   Rw   (   Rº   R  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>¥  s    (/   Ry   Rš   R™   Rœ   Rg   R8  R‚   t   _invertR°   Rk   t   as_polyRj   Rû   R†   RK   t   termst   indexRe   Rð   t   minsolve_linear_systemt   solve_linear_systemRf   R§   t   sympy.utilities.iterablesRg  Rî   R‡   R   R:  R]   Rˆ   Rù   R›   Rÿ   Rö   Rž   Rh   R   Ra   R   R  t   copyRl   R~   t   removeR¥   R>   (-   t   exprsRn   Rº   t   polysR€   RË   RH  t   linearRc  RK  R½   R  RS  Rq   R   RQ  R¶   RL  t   matrixt   monomt   coeffRg  R‹   Rƒ   RG  t   symst   resRï   t   r1RJ  R]  R‰   t	   newresultt   bad_resultst   hitt   eq2R%  t   ok_symsRr   R1  R¹   t   rnewRc   Rd   t   default_simplify(    (   Rj  Rº   Rh  R  Ri  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR  ä  s   	
			(	"35&
				.
..i    c           s†  t  |  t ƒ rC | r. t t d | ƒ ƒ ‚ n  |  j } |  j }  n  d } |  | } | j ƒ  \ } } | s{ t j	 t j
 f S| j } | s“ | } n´ g  | D] }	 |	 j sš |	 ^ qš }
 |
 r8t |
 ƒ d k rÚ |
 d }
 n  t | ƒ d k rd | | d f } n d | t | ƒ f } t t d |
 | f ƒ ƒ ‚ n  | j | ƒ } | j | ƒ } | slt j	 t j
 f S| j } t t ƒ } xF | j t ƒ D]5 } | j | @} x | D] } | | j | ƒ q«Wq‘Wt } xzt | d t ƒD]f‰ t  | ˆ t ƒ rd „  | ˆ Dƒ | ˆ <n  | j | ˆ ƒ } | j ˆ ƒ ‰  ˆ  j } ˆ  rã| skt ‡  f d	 †  | Dƒ ƒ rãt } ˆ  t j k r„Pn  ˆ ˆ  j k rId
 ˆ  | j ˆ d ƒ ‰ | d k rËt | | ƒ } n  t ‡ ‡ f d †  | Dƒ ƒ sFg  ˆ j t ƒ D]$ } | j j  rú| | j! ƒ  f ^ qú} t" ˆ j | ƒ ƒ ‰ ˆ ˆ f SqIqãqãW| rct j	 t j
 f S| j r|t j	 t j	 f S| | f S(   s(   Return a tuple derived from f = lhs - rhs that is one of
    the following:

        (0, 1) meaning that ``f`` is independent of the symbols in
        ``symbols`` that aren't in ``exclude``, e.g::

            >>> from sympy.solvers.solvers import solve_linear
            >>> from sympy.abc import x, y, z
            >>> from sympy import cos, sin
            >>> eq = y*cos(x)**2 + y*sin(x)**2 - y  # = y*(1 - 1) = 0
            >>> solve_linear(eq)
            (0, 1)
            >>> eq = cos(x)**2 + sin(x)**2  # = 1
            >>> solve_linear(eq)
            (0, 1)
            >>> solve_linear(x, exclude=[x])
            (0, 1)

        (0, 0) meaning that there is no solution to the equation
        amongst the symbols given.

            (If the first element of the tuple is not zero then
            the function is guaranteed to be dependent on a symbol
            in ``symbols``.)

        (symbol, solution) where symbol appears linearly in the
        numerator of ``f``, is in ``symbols`` (if given) and is
        not in ``exclude`` (if given). No simplification is done
        to ``f`` other than a ``mul=True`` expansion, so the
        solution will correspond strictly to a unique solution.

        ``(n, d)`` where ``n`` and ``d`` are the numerator and
        denominator of ``f`` when the numerator was not linear
        in any symbol of interest; ``n`` will never be a symbol
        unless a solution for that symbol was found (in which case
        the second element is the solution, not the denominator).


    Examples
    ========

    >>> from sympy.core.power import Pow
    >>> from sympy.polys.polytools import cancel

    The variable ``x`` appears as a linear variable in each of the
    following:

    >>> solve_linear(x + y**2)
    (x, -y**2)
    >>> solve_linear(1/x - y**2)
    (x, y**(-2))

    When not linear in x or y then the numerator and denominator are returned.

    >>> solve_linear(x**2/y**2 - 3)
    (x**2 - 3*y**2, y**2)

    If the numerator of the expression is a symbol then (0, 0) is
    returned if the solution for that symbol would have set any
    denominator to 0:

    >>> eq = 1/(1/x - 2)
    >>> eq.as_numer_denom()
    (x, 1 - 2*x)
    >>> solve_linear(eq)
    (0, 0)

    But automatic rewriting may cause a symbol in the denominator to
    appear in the numerator so a solution will be returned:

    >>> (1/x)**-1
    x
    >>> solve_linear((1/x)**-1)
    (x, 0)

    Use an unevaluated expression to avoid this:

    >>> solve_linear(Pow(1/x, -1, evaluate=False))
    (0, 0)

    If ``x`` is allowed to cancel in the following expression, then it
    appears to be linear in ``x``, but this sort of cancellation is not
    done by ``solve_linear`` so the solution will always satisfy the
    original expression without causing a division by zero error.

    >>> eq = x**2*(1/x - z**2/x)
    >>> solve_linear(cancel(eq))
    (x, 0)
    >>> solve_linear(eq)
    (x**2*(1 - z**2), x)

    A list of symbols for which a solution is desired may be given:

    >>> solve_linear(x + y + z, symbols=[y])
    (y, -x - z)

    A list of symbols to ignore may also be given:

    >>> solve_linear(x + y + z, exclude=[x])
    (y, -x - z)

    (A solution for ``y`` is obtained because it is the first variable
    from the canonically sorted list of symbols that had a linear
    solution.)

    s<   
            If lhs is an Equality, rhs must be 0 but was %si   i    s   solve(%s, %s)s   solve(%s, *%s)sœ   
                solve_linear only handles symbols, not %s. To isolate
                non-symbols use solve, e.g. >>> %s <<<.
                             RÌ   c         S  s   i  |  ] } | j  ƒ  | “ q S(    (   t   doit(   Rb   t   der(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys
   <dictcomp>G  s   	 c         3  s   |  ] } ˆ  j  | ƒ Vq d  S(   N(   t   diff(   Rb   Rr   (   t	   dnewn_dxi(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>M  s    iÿÿÿÿc         3  s1   |  ]' } t  | i ˆ  ˆ 6d  t ƒt k Vq d S(   R   N(   R   Rœ   (   Rb   t   di(   t   viR3  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>U  s   N(#   Rh   R   Re   RW   RŸ   Ró   Rj   R°   R	   Rú   R„   R‡   Rô   R†   Rf   R:  t
   differenceR`   R‘   R   Rk   Rœ   R   R   Ra   R†  Rˆ   Rš   R¨   R‚   R   t   functionR­   R„  R   (   Ró   RŸ   Rn   RÛ   R€   R‰   R¶   R   Rƒ   Rr   t   badt   egt   dfreet   derivsR…  t   csymR&  t   all_zerot   newnRq   t   irep(    (   R‡  R‰  R3  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR7  ­  sv    k	
		"		)$	c           sŠ  | j  d t ƒ } t |  | | Ž } | sG t d „  | j ƒ  Dƒ ƒ rK | S| rZt |  | Œ } d „  } i  } | | | ƒ x× | rUt d „  | j ƒ  Dƒ d d „  ƒ} t | j d t ƒ‰ t | j ƒ d k rç t	 d ƒ | ˆ <n^ t
 | ƒ d ‰  ˆ  d k r;t ‡  ‡ f d	 †  | j ƒ  Dƒ ƒ r;t	 d ƒ | ˆ <n
 ˆ  | ˆ <| | | ƒ q W| Sd
 d l m }	 d
 d l m }
 t | ƒ } t |  d t | Œ} t g  | j ƒ  D] ‰ ˆ d k r«ˆ ^ q«ƒ } x³t | d d d
 ƒ D]›} |
 d | ƒ d } xh|	 t t | ƒ ƒ | ƒ D]K} t g  | D] } |  j | ƒ j ^ q)|  j d
 ƒ j g ƒ j } t | g  | D] } | | ^ qmŒ } | rt d „  | j ƒ  Dƒ ƒ rg  | D] } | | t	 d ƒ f ^ q°} x- | j ƒ  D] \ } } | j | ƒ | | <qßWxU | D]M } | | k r	| j | ƒ | k rCt	 d ƒ | | <qVt	 d ƒ | | <q	q	W| } PqqW| d k rxPn  | } qãW| Sd S(   sÿ   
    Find a particular solution to a linear system.

    In particular, try to find a solution with the minimal possible number
    of non-zero variables using a naive algorithm with exponential complexity.
    If ``quick=True``, a heuristic is used.
    t   quickc         s  s   |  ] } | d  k Vq d S(   i    N(    (   Rb   Rd   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>o  s    c         S  s}   g  } xX | j  ƒ  D]J \ } } | j |  ƒ | | <| | j s | j | ƒ | | |  | <q q Wx | D] } | | =qh Wd  S(   N(   Rl   Ra   R‡   Rk   (   t
   determinedRè   t   deleteRc   Rd   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR8  u  s    c         s  s   |  ] } | Vq d  S(   N(    (   Rb   Rc   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>‚  s    RÌ   c         S  s   t  |  j ƒ t |  ƒ f S(   N(   R†   R‡   R   (   R!  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   ƒ  RÞ   i   i    c         3  s'   |  ] } | j  ˆ ˆ  ƒ d  k Vq d S(   i    N(   Ra   (   Rb   Rd   (   RÂ   R!  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>‰  s    iÿÿÿÿ(   t   combinations(   t   debugs   minsolve: %sc         s  s   |  ] } | d  k Vq d S(   i    N(    (   Rb   Rd   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>¢  s    N(   R™   Rš   Rp  Rû   R<  t   maxR‡   R   R†   R	   R  t	   itertoolsR—  t   sympy.utilities.miscR˜  Ro  Rœ   R   Rj   Rf   RJ   t   colt   TRl   Ra   Rn  (   t   systemRn   Rº   R”  t   s0Rr   R8  R•  Rc   R—  R˜  t   Nt   bestsolt   n0R¶   t   thissolt   nonzerosRq   t   submRd   Ra   RE  (    (   RÂ   R!  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRo  d  s^    #			1
	1"A&#)
c           s´  | j  d t ƒ } |  j |  j d k o9 t | ƒ k n rú y¥ t |  d d … d d … f ƒ } t t | | |  d d … d f ƒ ƒ } | rÂ x- | j ƒ  D] \ } } t	 | ƒ | | <qŸ Wn  t
 d „  | j ƒ  Dƒ ƒ sâ | SWqú t k
 rö qú Xn  |  d d … d d … f ‰ t | ƒ } d ˆ j d ‰ }	 x½ˆ ˆ j k  rõˆ |	 k r”t ˆ ˆ d … |	 f ƒ rtd Sˆ d ˆ … d d … f ‰ Pn  ˆ ˆ ˆ f sUx~t ˆ d |	 ƒ D] } ˆ ˆ | f r¸Pq¸q¸Wˆ ˆ |	 f rˆ ˆ |	 f j sýd Sˆ j }
 ˆ j ˆ ƒ } d } ˆ d } xÊ | ˆ j k  rñˆ j | ƒ } | | k rbˆ j | ƒ n‚ | d  | d  k rä| d k r›| d j ƒ  \ } } n  | d j ƒ  \ } } t	 | | ƒ pÎt	 | | ƒ säˆ j | ƒ qän  | d 7} q(W|
 ˆ j k rd Sn  ˆ j ˆ ƒ ˆ s9t ƒ  Sq9| | | ˆ | ˆ <| | <ˆ j ˆ | ƒ n  t j ˆ ˆ ˆ f ‰ ˆ j ˆ ‡ f d †  ƒ x` t ˆ d ˆ j ƒ D]H } ˆ | ˆ f rœˆ | ˆ f ‰  ˆ j | ‡  ‡ ‡ f d †  ƒ qœqœWˆ d 7‰ q9Wt | ƒ ˆ j k r¶ˆ d i  } } x“ | d k r±ˆ | |	 f } x; t | d |	 ƒ D]& } | ˆ | | f | | | 8} qOW| r–t	 | ƒ | | | <n | | | | <| d 8} qW| St | ƒ ˆ j k r¬ˆ d i  } } xÉ | d k r§ˆ | |	 f } x; t | d ˆ ƒ D]& } | ˆ | | f | | | 8} qWx3 t ˆ |	 ƒ D]" } | ˆ | | f | | 8} qIW| rŒt	 | ƒ | | | <n | | | | <| d 8} qßW| Sg  Sd S(	   sê  
    Solve system of N linear equations with M variables, which means
    both under- and overdetermined systems are supported. The possible
    number of solutions is zero, one or infinite. Respectively, this
    procedure will return None or a dictionary with solutions. In the
    case of underdetermined systems, all arbitrary parameters are skipped.
    This may cause a situation in which an empty dictionary is returned.
    In that case, all symbols can be assigned arbitrary values.

    Input to this functions is a Nx(M+1) matrix, which means it has
    to be in augmented form. If you prefer to enter N equations and M
    unknowns then use `solve(Neqs, *Msymbols)` instead. Note: a local
    copy of the matrix is made by this routine so the matrix that is
    passed will not be modified.

    The algorithm used here is fraction-free Gaussian elimination,
    which results, after elimination, in an upper-triangular matrix.
    Then solutions are found using back-substitution. This approach
    is more efficient and compact than the Gauss-Jordan method.

    >>> from sympy import Matrix, solve_linear_system
    >>> from sympy.abc import x, y

    Solve the following system::

           x + 4 y ==  2
        -2 x +   y == 14

    >>> system = Matrix(( (1, 4, 2), (-2, 1, 14)))
    >>> solve_linear_system(system, x, y)
    {x: -6, y: 2}

    A degenerate system returns an empty dictionary.

    >>> system = Matrix(( (0,0,0), (0,0,0) ))
    >>> solve_linear_system(system, x, y)
    {}

    R>   i   Niÿÿÿÿc         s  s   |  ] } | j  Vq d  S(   N(   R|   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>æ  s    i    c           s   |  ˆ  S(   N(    (   R!  RÃ   (   t	   pivot_inv(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   :	  RÞ   c           s   t  |  ˆ ˆ | f ˆ  ƒ S(   N(   R>   (   R!  R  (   Ry  Rq   Rw  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   B	  RÞ   (   R™   Rœ   t   rowst   colsR†   t	   inv_quickR›   Rÿ   Rl   R>   Rû   R<  Re   Rf   Rˆ   Rj   R   R‡   t   rowt   row_delR¯   t   col_swapR	   R„   t   row_op(   Rž  Rn   Rº   t   do_simplifyR4  R   Rc   Rd   Rz  RL  t   nrowst   rowit   ipR  t   rowjRÃ   t   jpt	   solutionst   content(    (   Ry  Rq   Rw  R¦  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRp  ´  s¦    (,")		
 &$$ c           s“   t  |  t ƒ r" |  j |  j }  n  t |  ƒ j ƒ  d }  t t |  j ƒ  ˆ  d t	 ƒj
 ƒ  ƒ } t ‡  f d †  | Dƒ ƒ s‹ t | | | Ž Sd Sd S(   s#  Solve equation of a type p(x; a_1, ..., a_k) == q(x) where both
       p, q are univariate polynomials and f depends on k parameters.
       The result of this functions is a dictionary with symbolic
       values of those parameters with respect to coefficients in q.

       This functions accepts both Equations class instances and ordinary
       SymPy expressions. Specification of parameters and variable is
       obligatory for efficiency and simplicity reason.

       >>> from sympy import Eq
       >>> from sympy.abc import a, b, c, x
       >>> from sympy.solvers import solve_undetermined_coeffs

       >>> solve_undetermined_coeffs(Eq(2*a*x + a+b, x), [a, b], x)
       {a: 1/2, b: -1/2}

       >>> solve_undetermined_coeffs(Eq(a*c*x + a+b, x), [a, b], x)
       {a: 1/c, b: -1/c}

    i    R   c         3  s   |  ] } | j  ˆ  ƒ Vq d  S(   N(   R³   (   Rb   t   equ(   RE  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>˜	  s    N(   Rh   R   Ró   RŸ   RM   R°   Rf   R?   R   Rš   R<  Rˆ   R  Rj   (   R¶  t   coeffsRE  Rº   Rž  (    (   RE  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR6  z	  s    'c         C  sµ   |  j  |  j d k r% t d ƒ ‚ n  |  d |  j  … d |  j  … f } |  d d … |  j d d … f } | j | ƒ } i  } x/ t | j  ƒ D] } | | d f | | | <q W| S(   s/  
    Solves the augmented matrix system using LUsolve and returns a dictionary
    in which solutions are keyed to the symbols of syms *as ordered*.

    The matrix must be invertible.

    Examples
    ========

    >>> from sympy import Matrix
    >>> from sympy.abc import x, y, z
    >>> from sympy.solvers.solvers import solve_linear_system_LU

    >>> solve_linear_system_LU(Matrix([
    ... [1, 2, 0, 1],
    ... [3, 2, 2, 1],
    ... [2, 0, 0, 1]]), [x, y, z])
    {x: 1/2, y: 1/4, z: -1/2}

    See Also
    ========

    sympy.matrices.LUsolve

    i   s#   Rows should be equal to columns - 1Ni    (   R§  R¨  Re   t   LUsolveR   (   Rw  Rz  t   AR%  R1  R´  Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   solve_linear_system_LU¡	  s    "#c   
      C  sÒ   g  } t  } |  j } t |  d d ƒ } | d k rH t |  j ƒ  ƒ } n  x} t | ƒ D]o } g  } d } x- | D]% } | j | | | ƒ | | 7} qn Wt | Œ  }	 | j | rµ |	 n |	 ƒ | } qU Wt	 | Œ  S(   sF  Return the det(``M``) by using permutations to select factors.
    For size larger than 8 the number of permutations becomes prohibitively
    large, or if there are no symbols in the matrix, it is better to use the
    standard determinant routines, e.g. `M.det()`.

    See Also
    ========
    det_minor
    det_quick
    t   _mati    N(
   Rœ   R§  Ri   Rj   RZ   t   tolistRY   Rk   R   R
   (
   t   MR£   Rr   R¶   t   list_t   permt   fact   idxR  t   term(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   det_permÆ	  s     	c         C  sÃ   |  j  } | d k r5 |  d |  d |  d |  d	 St g  t | ƒ D]s } |  d | f r¯ d
 | d t g  t j t |  j d | ƒ ƒ ƒ D] } |  d | f | ^ q‹ Œ  n t j ^ qE ƒ Sd S(   s–   Return the ``det(M)`` computed from minors without
    introducing new nesting in products.

    See Also
    ========
    det_perm
    det_quick
    i   i    i   iÿÿÿÿN(   i    i    (   i   i   (   i   i    (   i    i   (   i   iÿÿÿÿ(	   R§  R;  R   R
   R…   t	   det_minort   minor_submatrixR	   Rú   (   R½  R¶   Rq   R   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÄ  ã	  s
    		 c         C  ss   t  d „  |  Dƒ ƒ rO |  j d k  rE t d „  |  Dƒ ƒ rE t |  ƒ St |  ƒ S| re |  j d | ƒ S|  j ƒ  Sd S(   s  Return ``det(M)`` assuming that either
    there are lots of zeros or the size of the matrix
    is small. If this assumption is not met, then the normal
    Matrix.det function will be used with method = ``method``.

    See Also
    ========
    det_minor
    det_perm
    c         s  s   |  ] } | j  t ƒ Vq d  S(   N(   R³   R   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr> 
  s    i   c         s  s   |  ] } | j  t ƒ Vq d  S(   N(   R³   R   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>
  s    t   methodN(   Rˆ   R§  Rû   RÃ  RÄ  t   det(   R½  RÆ  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt	   det_quickõ	  s
    %

c         C  s  d d l  m } t d „  |  Dƒ ƒ sT t d „  |  Dƒ ƒ sH d „  } q^ d „  } n
 |  j ƒ  S|  j } | |  ƒ } | t j k r‘ t d ƒ ‚ n  | | ƒ } d } xm t	 | ƒ D]_ } | } } xK t	 | ƒ D]= }	 | |  j
 | |	 ƒ ƒ }
 | |
 | | |	 | f <| } qÎ Wq° W| S(   sz   Return the inverse of ``M``, assuming that either
    there are lots of zeros or the size of the matrix
    is small.
    iÿÿÿÿ(   RK   c         s  s   |  ] } | j  Vq d  S(   N(   R{   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>
  s    c         s  s   |  ] } | j  Vq d  S(   N(   R{   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>
  s    c         S  s
   t  |  ƒ S(   N(   RÃ  (   RÃ   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   
  RÞ   c         S  s
   t  |  ƒ S(   N(   RÄ  (   RÃ   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   
  RÞ   s    Matrix det == 0; not invertible.(   t   sympy.matricesRK   Rû   Rˆ   R4  R§  R	   Rú   Re   R   RÅ  (   R½  RK   RÇ  R¶   R   t   rett   s1Rq   Rr   R  Rˆ  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR©  
  s&    
	c         C  s   t  |  ƒ t j t  |  ƒ f S(   N(   R4   R	   t   Pi(   R!  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   &
  RÞ   c         C  s!   t  |  ƒ d t j t  |  ƒ f S(   Ni   (   R3   R	   RÌ  (   R!  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRÝ   '
  RÞ   c   (   	     s´  d | k r g  | d <n  ˆ  | d k r- d S| d j ˆ  ƒ t ˆ  ˆ ƒ \ } } | ˆ k rf | g Sy| j r-t t | | ƒ ƒ } | j r¡ t | ˆ |  S| rÆt | d | j	 d t
 ƒ ƒ} | j t ƒ | j t ƒ k r*t | t ƒ rt | j d t | ƒ ˆ |  St | | ˆ |  SqÆn™| j rÀ| j j ri| | ˆ  k rit | | ˆ |  Sn  ˆ | j j k rt | j | d | j ˆ |  St d „  | j Dƒ ƒ r¿t ‚ n  | st | j ˆ |  } g  | D]' } | j j ˆ | ƒ d k rá| ^ qáS| j j ˆ ƒ s´| j d k rP| d k rLt | j ˆ |  Sg  S| j | j ƒ  d k rt | j | j ƒ  d ˆ |  } n8 t t t | j ƒ | j ƒ t t | ƒ ƒ ˆ |  } d „  }	 t t t | ƒ ƒ t t | j ƒ ƒ ƒ }
 t t |
 ƒ d ƒ }
 t |
 ƒ \ } } t | j | | | ƒ d k ržg  | D]* } |	 | j j ˆ | ƒ |
 ƒ sK| ^ qK} | j  t | j |
 ˆ |  ƒ n  t! t" t# | ƒ ƒ ƒ Sg  } | j t | j ƒ t | ƒ } | | | k ry | j  t | ˆ |  ƒ Wqt k
 rqXn  g  } | d k r| j  t | j ˆ |  ƒ | j  t | j d ˆ |  ƒ | j  t | j d ˆ |  ƒ nø| j$ rŽxìd „  t% t | j& ƒ ƒ Dƒ D]Ï } t' | j& | ƒ \ } } | sâq¸n  x¢ t% t | j( ƒ ƒ D]‹ } | | | j( k røt) | | ƒ } | j  t | j | ˆ |  ƒ | j  t | j | ˆ |  ƒ | j  t | j | ˆ |  ƒ qøqøWq¸Wnù | j* r‡| j j ƒ  \ } } | | j j+ ƒ  \ } } t, | ƒ j ƒ  \ } } g  t | j | ˆ |  D] } t, | ƒ ^ q÷} | j  g  t | j | ˆ |  D] } t, | ƒ ^ q/ƒ | | d k r‡| j  t | | | | | ˆ |  ƒ q‡n  | j  ‡  ‡ f d †  | Dƒ ƒ t! t" t# | ƒ ƒ ƒ Sn| j r
| j- r
t. t | ƒ ƒ } | j rÆt | t | ƒ ˆ |  Sn¼ | j/ rÆt0 | j ƒ d k rÆ| j1 t2 k rg  } x? t2 | j1 | ƒ D]* } | j  t | j d | ˆ |  ƒ qQWt! t" | ƒ ƒ S| j1 t3 k rÆt | j d | t | ƒ ˆ |  Sn  | j4 t ƒ } | | k rõt | | ˆ |  SWn t k
 r	n X| j5 d	 t
 ƒ rà
t6 ˆ  j7 ƒ  ˆ ƒ } t# ƒ  } x… | D]} } t | t ƒ set | t ƒ ru| j8 | ƒ qA| j rAt t9 | ƒ ƒ } | j r¾ˆ | j j k r¾| j8 | ƒ q¾qAqAW| j: | ƒ } t. t9 ˆ  ƒ ƒ j t; t! t< | d g t0 | ƒ ƒ ƒ ƒ ƒ } t9 t | d
 t
 ƒˆ  | ƒ ‰  t ˆ  ˆ ƒ \ } } | j ˆ ƒ rà
y– | j7 ƒ  } t6 | ˆ ƒ } t= | | ˆ | ƒ }  xZ t> |  ƒ D]L \ } } t | ƒ }! |! | k r“	ˆ  j ˆ |! ƒ j? d ƒ r“	|! |  | <q“	q“	W|  SWqÝ
t k
 rÙ
t0 | ƒ d k rÚ
yµ t@ | | | Œ }" |" d k r5
t ‚ n  |" \ } }# }$ tA | d	 <t | |$ ˆ |  }% |% r¾
t |# |$ |  } t! t" t# g  |% D]% } | D] } | j |$ | ƒ ^ q–
qŒ
ƒ ƒ ƒ SWqÖ
t k
 rÒ
qÖ
XqÚ
qÝ
Xqà
n  | j5 d t
 ƒ r°tA | d <t | | ƒ \ }& }' x0 |' jB ƒ  D] \ }$ } | ˆ k rPqqWˆ }$ |& j |$ ƒ r°yB t |& |$ |  } t! t" g  | D] } | j |' ƒ ^ qvƒ ƒ SWq­t k
 r©q­Xq°n  d S(   si  
    Helper for _solve that solves a transcendental equation with respect
    to the given symbol. Various equations containing powers and logarithms,
    can be solved.

    There is currently no guarantee that all solutions will be returned or
    that a real solution will be favored over a complex one.

    Either a list of potential solutions will be returned or None will be
    returned (in the case that no method was known to get a solution
    for the equation). All other errors (like the inability to cast an
    expression as a Poly) are unhandled.

    Examples
    ========

    >>> from sympy import log
    >>> from sympy.solvers.solvers import _tsolve as tsolve
    >>> from sympy.abc import x

    >>> tsolve(3**(2*x + 5) - 4, x)
    [-5/2 + log(2)/log(3), (-5*log(3)/2 + log(2) + I*pi)/log(3)]

    >>> tsolve(log(x) + 2*x, x)
    [LambertW(2)/2]

    t
   tsolve_sawR•   i    i   c         s  s   |  ] } | j  Vq d  S(   N(   t   is_Dummy(   Rb   R)  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>i
  s    c         S  s%   |  j  | ƒ p$ t |  ƒ t | ƒ k S(   N(   t   equalsRC   (   t   expr1t   expr2(    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   equal‚
  s    c         s  s!   |  ] } | d  k r | Vq d S(   i   N(    (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>¡
  s    c         3  s0   |  ]& } ˆ  j  ˆ | ƒ j d  ƒ r | Vq d S(   i    N(   Ra   RÏ  (   Rb   Rr   (   R‰   RE  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>³
  s    t	   bivariatet   deepi   N(C   Rj   Rk   Rk  R  RN   RB   R  R  RE   R™   Rœ   t   countR-   Rh   R£   R.   R@  Rv   R±   R‡   R}   Rˆ   Rö   Ra   R³   R"  RC   Rµ   R>   RA   RG   R   Rù   Rf   R   Ry   R´   R   R‹   R(   R#  R"   t   is_irrationalR°   RF   t   is_positiveR   R²   R†   R  t   multi_inversesR/   R¤   Rð   t   _filtered_gensRl  R~   R   RŠ  R›   Rÿ   t   _solve_lambertRg   RÏ  t   bivariate_typeRš   Rl   ((   R‰   RE  Rº   RŸ   Ró   R   t   sol_baseRr   R¹   RÒ  t   e_ratR¶   R   t   logformR½   Rw   R)  R  t   b_lt   e_lR%  Rq   t   llhsR1  R¤   RS  t	   up_or_logt   git   gisimpt   downt   eq_downRQ  RF  t   nst   gpuR‹   R]  t	   inversiont   posRÄ   (    (   R‰   RE  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR@  +
  s,   		!	"	2#&8	+!7#  #	&  .	29/ 	((		+ '	
:

0c          O  s  d | k r! t  t d ƒ ƒ ‚ n  d | k rW | j d ƒ } d d l } | | j _ n d } | j d t ƒ } t |  ƒ d k rú |  d } |  d	 } |  d
 } t	 | ƒ r…t	 | ƒ r…t | ƒ t | ƒ k r÷ t
 d t | ƒ t | ƒ f ƒ ‚ q÷ q…n‹ t |  ƒ d
 k rD|  d } d } |  d	 } t	 | ƒ r…t
 d ƒ ‚ q…nA t |  ƒ d
 k  rot
 d t |  ƒ ƒ ‚ n t
 d t |  ƒ ƒ ‚ | j d d g ƒ } t	 | ƒ rt | ƒ } x@ t | ƒ D]2 \ }	 }
 t |
 t ƒ r¿|
 j |
 j | |	 <q¿q¿Wt | ƒ j } n  t	 | ƒ r"t | ƒ } n  t | t ƒ st | t ƒ rS| j | j } n  | j } | d k r}| j ƒ  j ƒ  } n  t | ƒ d	 k o¨| | k p¨| d | k sÀt  t d ƒ ƒ ‚ n  t | | | ƒ } t t | | |  ƒ } | rþi | | 6g S| St | ƒ | j k r,t t d ƒ ƒ ‚ n  | j d t ƒ } | r[t d ƒ t | ƒ n  | j | ƒ } | r‡t d ƒ t | ƒ n  t | | j | ƒ } t | | | ƒ } t | | d | | } | rût t | g  | D] } t | ƒ ^ qÜƒ ƒ g St | ƒ S(   sß  
    Solve a nonlinear equation system numerically::

        nsolve(f, [args,] x0, modules=['mpmath'], **kwargs)

    f is a vector function of symbolic expressions representing the system.
    args are the variables. If there is only one variable, this argument can
    be omitted.
    x0 is a starting vector close to a solution.

    Use the modules keyword to specify which modules should be used to
    evaluate the function and the Jacobian matrix. Make sure to use a module
    that supports matrices. For more information on the syntax, please see the
    docstring of lambdify.

    If the keyword arguments contain 'dict'=True (default is False) nsolve
    will return a list (perhaps empty) of solution mappings. This might be
    especially useful if you want to use nsolve as a fallback to solve since
    using the dict argument for both methods produces return values of
    consistent type structure. Please note: to keep this consistency with
    solve, the solution will be returned in a list even though nsolve
    (currently at least) only finds one solution at a time.

    Overdetermined systems are supported.

    >>> from sympy import Symbol, nsolve
    >>> import sympy
    >>> import mpmath
    >>> mpmath.mp.dps = 15
    >>> x1 = Symbol('x1')
    >>> x2 = Symbol('x2')
    >>> f1 = 3 * x1**2 - 2 * x2**2 - 1
    >>> f2 = x1**2 - 2 * x1 + x2**2 + 2 * x2 - 8
    >>> print(nsolve((f1, f2), (x1, x2), (-1, 1)))
    Matrix([[-1.19287309935246], [1.27844411169911]])

    For one-dimensional functions the syntax is simplified:

    >>> from sympy import sin, nsolve
    >>> from sympy.abc import x
    >>> nsolve(sin(x), x, 2)
    3.14159265358979
    >>> nsolve(sin(x), 2)
    3.14159265358979

    To solve with higher precision than the default, use the prec argument.

    >>> from sympy import cos
    >>> nsolve(cos(x) - x, 1)
    0.739085133215161
    >>> nsolve(cos(x) - x, 1, prec=50)
    0.73908513321516064165531208767387340401341175890076
    >>> cos(_)
    0.73908513321516064165531208767387340401341175890076

    To solve for complex roots of real functions, a nonreal initial point
    must be specified:

    >>> from sympy import I
    >>> nsolve(x**2 + 2, I)
    1.4142135623731*I

    mpmath.findroot is used and you can find there more extensive
    documentation, especially concerning keyword parameters and
    available solvers. Note, however, that functions which are very
    steep near the root the verification of the solution may fail. In
    this case you should use the flag `verify=False` and
    independently verify the solution.

    >>> from sympy import cos, cosh
    >>> from sympy.abc import i
    >>> f = cos(x)*cosh(x) - 1
    >>> nsolve(f, 3.14*100)
    Traceback (most recent call last):
    ...
    ValueError: Could not find root within given tolerance. (1.39267e+230 > 2.1684e-19)
    >>> ans = nsolve(f, 3.14*100, verify=False); ans
    312.588469032184
    >>> f.subs(x, ans).n(2)
    2.1e+121
    >>> (f/f.diff(x)).subs(x, ans).n(2)
    7.4e-15

    One might safely skip the verification if bounds of the root are known
    and a bisection method is used:

    >>> bounds = lambda i: (3.14*i, 3.14*(i + 1))
    >>> nsolve(f, bounds(100), solver='bisect', verify=False)
    315.730061685774

    Alternatively, a function may be better behaved when the
    denominator is ignored. Since this is not always the case, however,
    the decision of what function to use is left to the discretion of
    the user.

    >>> eq = x**2/(1 - x)/(1 - 2*x)**2 - 100
    >>> nsolve(eq, 0.46)
    Traceback (most recent call last):
    ...
    ValueError: Could not find root within given tolerance. (10000 > 2.1684e-19)
    Try another starting point or tweak arguments.
    >>> nsolve(eq.as_numer_denom()[0], 0.46)
    0.46792545969349058
    RÆ  sò   
            Keyword "method" should not be used in this context.  When using
            some mpmath solvers directly, the keyword "method" is
            used, but when using nsolve (and findroot) the keyword to use is
            "solver".t   preciÿÿÿÿNR›   i   i    i   i   s0   nsolve expected exactly %i guess vectors, got %is"   nsolve expected 3 arguments, got 2s,   nsolve expected at least 2 arguments, got %is+   nsolve expected at most 3 arguments, got %it   modulest   mpmathsB   
                expected a one-dimensional and numerical functions9   
            need at least as many equations as variablest   verboses   f(x):s   J(x):t   J(   Re   RW   Rð   Rí  t   mpt   dpsRj   Rš   R†   R   RÑ   R™   Rf   Rg   Rh   R   Ró   RŸ   RJ   R  R‡   Rr  RV   R   R\   R¨  Rö   t   printt   jacobianR›   Rÿ   (   R£   t   kwargsRë  Rí  R  R   t   fargst   x0Rì  Rq   R¼   Rz  R!  Rî  Rï  R3  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   nsolve  sˆ    l


%

	.

/c         O  s  t  |  ƒ }  |  j r* |  j |  j Œ  }  n  |  j } | sB | } n  | t | ƒ @s_ |  t j f St | j d t	 ƒ ƒ } |  } t j } xxt
 r | } xq t
 r| j | Œ  \ } }	 | j râ | t j k rÏ Pn  |	 } | | 8} q˜ | t j k rõ Pn  |	 } | | } q˜ W| j rìi  }
 x? | j D]4 } | j | Œ  \ } } |
 j | g  ƒ j | ƒ q"Wt d „  |
 j ƒ  Dƒ ƒ rìg  } x[ |
 j ƒ  D]M \ } } t | ƒ d k rÁ| j t | Œ  | ƒ q‰| j | d | ƒ q‰Wt | Œ  } qìn  | j rÆ| rÆt | j ƒ d k rÆ| j | Œ  rÆt | j ƒ \ } } | j | Œ  \ } } | j | Œ  \ } } t d „  | | f Dƒ ƒ r| j ƒ  \ } } | j ƒ  \ } } | | k rÐt t | | ƒ ƒ } | | } qÃ| | } t | | ƒ } | | k rÃ| } | | } qÃqý| | k rýt | t ƒ rÃ| j | j k rÃt | j ƒ t | j ƒ k odd k n r„| j d | j d } qÀt | j ƒ t | j ƒ k r±t d ƒ ‚ qÀt d ƒ ‚ qÃqýn7 | j rýt d	 „  | j Dƒ ƒ rýt t | ƒ ƒ } n  | j r3t  | d
 ƒ rLt | j ƒ d k rL| j! ƒ  | ƒ } | j d } q3t | t" ƒ r—| j \ } } d t# | t$ | d | d ƒ | ƒ } q3| j | j k r3t | j ƒ t | j ƒ k oÒd k n rô| j d } | j d } q0t | j ƒ t | j ƒ k r!t d ƒ ‚ q0t d ƒ ‚ q3n  | rt| j% rt| j& j' rt| j& d k  rtd | } d | } n  | j% rí| j& j' r| sÐ| j& j' rít | ƒ d k rít | j( j t | ƒ @ƒ d k rí| d | j& } | j( } n  | | k r‰ Pq‰ q‰ W| | f S(   s  Return tuple (i, d) where ``i`` is independent of ``symbols`` and ``d``
    contains symbols. ``i`` and ``d`` are obtained after recursively using
    algebraic inversion until an uninvertible ``d`` remains. If there are no
    free symbols then ``d`` will be zero. Some (but not necessarily all)
    solutions to the expression ``i - d`` will be related to the solutions of
    the original expression.

    Examples
    ========

    >>> from sympy.solvers.solvers import _invert as invert
    >>> from sympy import sqrt, cos
    >>> from sympy.abc import x, y
    >>> invert(x - 3)
    (3, x)
    >>> invert(3)
    (3, 0)
    >>> invert(2*cos(x) - 1)
    (1/2, cos(x))
    >>> invert(sqrt(x) - 3)
    (3, sqrt(x))
    >>> invert(sqrt(x) + y, x)
    (-y, sqrt(x))
    >>> invert(sqrt(x) + y, y)
    (-sqrt(x), y)
    >>> invert(sqrt(x) + y, x, y)
    (0, sqrt(x) + y)

    If there is more than one symbol in a power's base and the exponent
    is not an Integer, then the principal root will be used for the
    inversion:

    >>> invert(sqrt(x + y) - 2)
    (4, x + y)
    >>> invert(sqrt(x + y) - 2)
    (4, x + y)

    If the exponent is an integer, setting ``integer_power`` to True
    will force the principal root to be selected:

    >>> invert(x**2 - 4, integer_power=True)
    (2, x)

    t   integer_powerc         s  s!   |  ] } t  | ƒ d  k Vq d S(   i   N(   R†   (   Rb   Rd   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>0  s    i   i    i   c         s  s   |  ] } t  | ƒ Vq d  S(   N(   Rx   (   Rb   Rq   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>@  s    s(   equal function with more than 1 arguments'   function with different numbers of argsc         s  s   |  ] } t  | ƒ Vq d  S(   N(   Rx   (   Rb   Rå   (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>Z  s    t   inverse()   R   R£   R  R‡   Ry   R	   Rú   R¥   R™   Rš   Rœ   R¬   R  R„   t
   setdefaultRk   Rˆ   R<  Rl   R†   R
   t   is_polynomialR   R"  R@   RB   Rh   R   Rö   Re   R  R²   t   hasattrRù  R;   R5   R:   Rv   R.   R±   R}   (   R‰   Rn   Rô  Rƒ   t   dointpowRó   RŸ   RÀ   t   indepRD  Rm  Rå   Rq   R   R£   R%  t   ait   adt   bit   bdt   a_baset   a_expt   b_baset   b_expt   ratt   _lhst   yR!  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyRk  Ø  s´    -								%
!."	$-.*

	4c   G   
     s|  d } t  d t d t ƒ ‰ ‡ ‡ f d †  } ‡ f d †  } d „  ‰ ‡ ‡ f d †  ‰ | j d ˆ ƒ ‰ g  t t  d	 g  d
 t d d ƒ j ƒ  ƒ D] \ } } | j | | ƒ ^ q‘ \ ‰ } }	 t t |  d t d t ƒƒ }  |  j	 ƒ  \ }  }
 t
 |  d t ƒ}  |  j rd Sn  t ˆ ƒ p"|  j ‰ |  j ƒ  } g  | j D] } ˆ | t ƒ rV| ^ q;} | rjd Sn  t ‡ f d †  | Dƒ ƒ rd Sn  t ‡ f d †  | Dƒ ƒ r°d Sn  ‡ ‡ f d †  } | | ƒ \ } } } | råd Sn  t d d t ƒ} t ƒ  } x" | D] } | j ˆ | j @ƒ qW| ˆ k r`| ‰ g  | D] } | j ˆ @rW| ^ q>} n  t  t t | t t t | ƒ ƒ ƒ ƒ ƒ ƒ } i g  f  6‰ t j | j ƒ  ƒ } x† | D]~ } ˆ | t ƒ rt | j ƒ  j ƒ j | ƒ } t t g  | D] } | | ^ qöƒ ƒ } n f  } ˆ j | g  ƒ j | ƒ q¶Wt ˆ j f  ƒ Œ  } g  ˆ j ƒ  D] } t ˆ | Œ  ^ qZ‰ t t  t t! ˆ ƒ ƒ ƒ ƒ ‰ t } t" |  ƒ } t ˆ ƒ d k oÏˆ d j# oÎ| d k ròˆ d | | | }  t } n¢t ˆ ƒ d k oˆ d j# r't ˆ d j$ ƒ ‰ n  t | ƒ d k r<| j ƒ  } t ˆ ƒ d k r“| j } d „  | Dƒ | @}  |  r„| }  n  t! |  ƒ }  n ˆ }  t |  ƒ d }  y| t% | | | |  ˆ  }! |! rÖt& ‚ n  | j ƒ  j' | | | ƒ j' |  |! d ƒ }  | | | | | ƒ | |  ˆ ƒ SWn t& k
 r8n Xn+ g  | D] } ˆ | ƒ d k ra| ^ qC} t ˆ ƒ d k r¾| r¤ˆ d | ˆ d | }  t } nt( | d ƒ j) r»ˆ \ }" }# | j* d t ƒ rê|" |# f \ }# }" n  | |" j ƒ  ƒ }$ \ }% }& }' | |# j ƒ  ƒ }( \ }) }* }+ xt d ƒ D]}, |, rh|( |$ f \ }$ }( |# |" f \ }" }# n  |( \ }) }- }+ t+ |) Œ  }) |) |+ }. | |+ |. }/ xˆ D]}  yÕ t% |/ |  ˆ  }0 |0 rÍt& ‚ n  |" j' |  |0 d ƒ | |# |) | }1 t, |1 | ƒ }2 |2 rb|2 \ }  }3 |3 rR|3 \ }4 }5 | |4 |/ j' | t% |5 | ˆ  d ƒ ƒ n | | |/ ƒ n |1 }  | | |/ ƒ t } PWn& t& k
 r¥|, r¢t& d ƒ ‚ n  n Xq¢W| r´Pn  q5Wn  n¶t ˆ ƒ d k rtg  ˆ D] } | | j ƒ  ƒ ^ q×‰ d ‰ d ‰  d }6 ˆ d |6 d k rJˆ j ˆ j d ƒ ƒ ˆ j ˆ j d ƒ ƒ nC ˆ d |6 d k rˆ j ˆ j d ƒ ƒ ˆ j ˆ j d ƒ ƒ n  ˆ d |6 ˆ d |6 k o´d k n rqˆ d ˆ  ˆ d ˆ  k r	ˆ d ˆ d f \ ˆ d <ˆ d <ˆ d ˆ d f \ ˆ d <ˆ d <n  ˆ d ˆ  ˆ d ˆ  k rg	ˆ d d ˆ d ˆ d | d }  t } nˆ d |6 d k  rng  d D] } t | ƒ ^ q‚	\ }7 } }/ }
 }8 }9 |/ |
 |8 d |7 d d |8 d |9 |7 d | d d |8 d |7 d |/ d d |8 d |7 d |/ d |
 d |8 d |7 d |/ |
 d d |8 d |7 d |
 d d |8 |9 d |7 d | d d  |8 |9 |7 d | d |/ d d! |8 |9 |7 d | d |/ d |
 d! |8 |9 |7 d | d |/ |
 d d  |8 |9 |7 d | d |
 d d |8 |7 d |/ d d" |8 |7 d |/ d |
 d# |8 |7 d |/ d$ |
 d d% |8 |7 d |/ d |
 d d# |8 |7 d |/ d |
 d$ d" |8 |7 d |/ |
 d d |8 |7 d |
 d |9 d | d d |9 d | d |/ d d |9 d | d |/ d |
 d |9 d | d |/ |
 d d |9 d | d |
 d d |9 | d |/ d d" |9 | d |/ d |
 d# |9 | d |/ d$ |
 d d% |9 | d |/ d |
 d d# |9 | d |/ d |
 d$ d" |9 | d |/ |
 d d |9 | d |
 d |/ d d |/ d& |
 d' |/ d( |
 d d) |/ d |
 d d* |/ d |
 d$ d* |/ d$ |
 d d) |/ d |
 d d' |/ d |
 d( d |/ |
 d& |
 d }: ‡  ‡ ‡ ‡ f d+ †  }; |; d ƒ \ }< }= |; d ƒ \ }> }? ˆ d }@ | }A |: j- t  t |7 |8 | |9 |/ |
 f |< |= |> |? |@ |A f ƒ ƒ ƒ }  t } n  n  n  | r”t( | d ƒ j) oµ| o£t ˆ ƒ d$ k pµt ˆ ƒ d$ k  r‘d, „  }B t ˆ ƒ d$ k r
ˆ \ }" }# }C }D |B |" |# ƒ |B |C |D ƒ }  t } n„ t ˆ ƒ d k rPˆ \ }" }# }C |B |# |C ƒ |B |" | ƒ }  t } n> t ˆ ƒ d k rŽˆ \ }" }# |" d |B |# | ƒ }  t } n  n  n  | r¦t" |  ƒ n | }E |	 d 7}	 | pü| t k	 oüt ˆ ƒ | k oü|E t k	 oü|E | k oü|	 d k rt& d- ƒ ‚ n  | j t  d	 ˆ d
 t ˆ ƒ d |	 ƒ ƒ t, |  ˆ | Ž }F |F r]|F \ }  ‰ n  | |  ˆ ƒ \ }  ‰ |  ˆ f S(.   sá	   Remove radicals with symbolic arguments and return (eq, cov),
    None or raise an error:

    None is returned if there are no radicals to remove.

    NotImplementedError is raised if there are radicals and they cannot be
    removed or if the relationship between the original symbols and the
    change of variable needed to rewrite the system as a polynomial cannot
    be solved.

    Otherwise the tuple, ``(eq, cov)``, is returned where::

        ``eq``, ``cov``
            ``eq`` is an equation without radicals (in the symbol(s) of
            interest) whose solutions are a superset of the solutions to the
            original expression. ``eq`` might be re-written in terms of a new
            variable; the relationship to the original variables is given by
            ``cov`` which is a list containing ``v`` and ``v**p - b`` where
            ``p`` is the power needed to clear the radical and ``b`` is the
            radical now expressed as a polynomial in the symbols of interest.
            For example, for sqrt(2 - x) the tuple would be
            ``(c, c**2 - 2 + x)``. The solutions of ``eq`` will contain
            solutions to the original equation (if there are any).

    ``syms``
        an iterable of symbols which, if provided, will limit the focus of
        radical removal: only radicals with one or more of the symbols of
        interest will be cleared. All free symbols are used if ``syms`` is not
        set.

    ``flags`` are used internally for communication during recursive calls.
    Two options are also recognized::

        ``take``, when defined, is interpreted as a single-argument function
        that returns True if a given Pow should be handled.

    Radicals can be removed from an expression if::

        *   all bases of the radicals are the same; a change of variables is
            done in this case.
        *   if all radicals appear in one term of the expression
        *   there are only 4 terms with sqrt() factors or there are less than
            four terms having sqrt() factors
        *   there are only two terms with radicals

    Examples
    ========

    >>> from sympy.solvers.solvers import unrad
    >>> from sympy.abc import x
    >>> from sympy import sqrt, Rational, root, real_roots, solve

    >>> unrad(sqrt(x)*x**Rational(1, 3) + 2)
    (x**5 - 64, [])
    >>> unrad(sqrt(x) + root(x + 1, 3))
    (x**3 - x**2 - 2*x - 1, [])
    >>> eq = sqrt(x) + root(x, 3) - 2
    >>> unrad(eq)
    (_p**3 + _p**2 - 2, [_p, _p**6 - x])

    s3   cannot get an analytical solution for the inversionR½   R>   c           sv   ˆ  re ˆ  \ } } t  | |  ƒ j |  ƒ d k r\ |  | j | t | |  ˆ  d ƒ g ˆ  (qr t ‚ n |  | g ˆ  (d  S(   Ni   i   i    (   i   i   (   RO   RQ   Ra   R  Rö   (   R‹   Rw   t   oldpt   olde(   Ra  t   uflags(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _covÒ  s    ,	c           sf  | rX | \ } } i t  | j ƒ | 6} |  j | ƒ }  | j | ƒ | j | ƒ g } n  t t |  j ƒ  d d t ƒd t ƒ}  |  j rù g  } xX |  j D]M } | j	 r® q™ n  | j
 rÙ ˆ  | t ƒ rÙ | j | j ƒ q™ | j | ƒ q™ Wt | Œ  }  n  |  j } t | ƒ d k rF|  j | j ƒ  t |  ƒ ƒ j ƒ  r\|  }  q\n |  j ƒ  r\|  }  n  |  | f S(   Ni    R”   t   cleari   (   R   t   nameRþ   R   R   R°   Rœ   R  R£   R­   Rv   Rk   R}   R   R‡   R†   Ry  Rð   RQ   t   could_extract_minus_sign(   R‰   Ra  R‹   Rw   t   repR£   R   Rƒ   (   t   _take(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR%   Ý  s,    !(			%
c         S  s1   |  j  ƒ  d j ƒ  d } | j s* t j S| j S(   Ni   i    (   R"  R$  R´   R	   R„   R#  (   t   powR&  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _Qý  s    	c           s˜   x‘ t  j |  ƒ D]€ } | j p% | j s. q n  | j ƒ  \ } } | j ˆ Œ  sU q n  | rt ˆ  | ƒ d k rt q n  | j } | j ˆ ƒ r t Sq Wt	 S(   Ni   (
   R   R…   Rô   Rv   R"  R³   R‡   R:  Rœ   Rš   (   R   t   take_int_powR  R%  Rw   Rƒ   (   R  Rz  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR    s    	R  Ra  R¶   t   rpti    t   radicalR  R”   Nc         3  s!   |  ] } ˆ  | ƒ d  k Vq d S(   i   N(    (   Rb   RS  (   R  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>'  s    c         3  s(   |  ] } | j  ƒ  d  j ˆ  Œ  Vq d S(   i   N(   R"  R³   (   Rb   RS  (   Rz  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <genexpr>*  s    c           s•   d } t  ƒ  } t  ƒ  } xm |  j D]b } ˆ | t ƒ s= q" n  ˆ  | ƒ } | d k r" | j | ƒ t | | ƒ } | j | j ƒ q" q" W| | | f S(   Ni   (   Ry   R9  Rš   R~   R    R}   (   RQ  t   lcmt   radsRT  RS  R#  (   R  R  (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _rads_bases_lcm-  s    		R‹   t   nonnegativei   i   c         S  s   h  |  ] } | j  r | ’ q S(    (   Rô   (   Rb   RS  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pys	   <setcomp>l  s   	 t   _reverses&   no successful change of variable foundi   i   t   abcdABi	   i   i   i?   i   i-   i   i<   i   i$   i   iT   i~   c           s:   t  ˆ |  ˆ Œ  } t ˆ |  | ƒ t  ˆ |  ˆ  Œ  f S(   N(   R   RM   (   Rq   R%  (   t   BASESt   RADt   infot   rterms(    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _t×  s    c         S  s   |  d | d d |  | S(   Ni   (    (   Rå   R%  (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   _norm2æ  s    s   Cannot remove all radicals(.   R›   Rš   Rú  R   Rj   Rl   RB   R   Rœ   R°   R   R­   Ry   R‡   Rl  R9  Rû   Rˆ   R   R8  Rf   Rÿ   R   R†   R
   R…   Rž   R:  Rì   Rk   Rð   R§   R¢   R   RH   R  R£   R  Rö   Ra   R-   R±   R™   R   R?  Rþ   (G   R‰   Rz  Rº   t
   _inv_errorR  R%   Rc   Rd   t   nwasR  R   RQ  RS  R9  R  R  RT  R  t   covsymt   newsymsR  t   dradR£   R)  t   commonRq   RÌ   t   othersR  t   depthR%  Rƒ   R!  R4  t   r0R|  t   i0t   _rads0t   _bases0t   lcm0t   i1t   _rads1t   _bases1t   lcm1t   reverseRÃ   t   t1R&  R¹   t   neweqt   tmpt   newcovt   newpt   newct   LCMRå   R¹  R¾   t   zzR"  t   aat   AAt   bbt   BBt   cct   ddR#  t   r2t   r3t	   new_deptht   neq(    (	   R  R  R  R  Ra  R   R!  Rz  R  s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyR?    sj   > 	R	+	)-,),				,+	
	%,"%&	1ÿ ÿ ÿ ÿ '!$			
((   RÛ  RÚ  RÙ  (    t   __doc__t
   __future__R    R   t   sympyR   t   sympy.core.compatibilityR   R   R   R   R   t   sympy.core.sympifyR   t
   sympy.coreR	   R
   R   R   R   R   R   R   R   t   sympy.core.exprtoolsR   t   sympy.core.functionR   R   R   R   R   R   R   R   R   R   R   R   t   sympy.integrals.integralsR   t   sympy.core.numbersR    R!   R"   t   sympy.core.relationalR#   R$   R%   t   sympy.core.logicR&   R'   t   sympy.core.powerR(   t   sympy.logic.boolalgR)   R*   R+   t   sympy.core.basicR,   t   sympy.functionsR-   R.   R/   R0   R1   R2   R3   R4   R5   R6   R7   R8   R9   R:   R;   t(   sympy.functions.elementary.trigonometricR<   R=   t   sympy.simplifyR>   R?   R@   RA   RB   RC   RD   RE   RF   RG   t   sympy.simplify.sqrtdenestRH   t   sympy.simplify.fuRI   RÉ  RJ   RK   t   sympy.polysRL   RM   RN   RO   RP   RQ   t   sympy.polys.polyerrorsRR   RS   t$   sympy.functions.elementary.piecewiseRT   RU   t   sympy.utilities.lambdifyRV   R›  RW   Rq  RX   RY   RZ   t   sympy.utilities.decoratorR[   Rí  R\   t   sympy.solvers.polysysR]   t   sympy.solvers.inequalitiesR^   t   typesR_   t   collectionsR`   R·   Ru   Rx   R‚   Rz   Rj   R   RÎ   RÕ   R  R  R  R7  Ro  Rp  R6  Rº  RÃ  RÄ  RÈ  R©  RØ  R@  R÷  Rk  R?  t   sympy.solvers.bivariateRÛ  RÚ  RÙ  (    (    (    s4   lib/python2.7/site-packages/sympy/solvers/solvers.pyt   <module>   s‚   (@RdF.	)			4¿	7	ÿ ÿ ÿ Œ	ÿ —	É·	P	Æ	'	%			
	æÇ	¸	ÿ y