ó
¡¼™\c           @  s=  d  Z  d d l m Z m Z d d l m Z d d l m Z d d l m	 Z	 d d l
 m Z d d l m Z m Z m Z m Z d d l m Z m Z m Z m Z m Z m Z d	 „  Z d
 „  Z d d „ Z d „  Z d d „ Z d e d „ Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% e d „ Z& d „  Z' d S(   sô  
Algorithms for solving the Risch differential equation.

Given a differential field K of characteristic 0 that is a simple
monomial extension of a base field k and f, g in K, the Risch
Differential Equation problem is to decide if there exist y in K such
that Dy + f*y == g and to find one if there are some.  If t is a
monomial over k and the coefficients of f and g are in k(t), then y is
in k(t), and the outline of the algorithm here is given as:

1. Compute the normal part n of the denominator of y.  The problem is
then reduced to finding y' in k<t>, where y == y'/n.
2. Compute the special part s of the denominator of y.   The problem is
then reduced to finding y'' in k[t], where y == y''/(n*s)
3. Bound the degree of y''.
4. Reduce the equation Dy + f*y == g to a similar equation with f, g in
k[t].
5. Find the solutions in k[t] of bounded degree of the reduced equation.

See Chapter 6 of "Symbolic Integration I: Transcendental Functions" by
Manuel Bronstein.  See also the docstring of risch.py.
iÿÿÿÿ(   t   print_functiont   division(   t   mul(   t   oo(   t   reduce(   t   Dummy(   t   Polyt   gcdt   ZZt   cancel(   t   gcdex_diophantinet   frac_int
   derivationt   splitfactort   NonElementaryIntegralExceptiont   DecrementLevelc         C  s  |  j  r t S| t | | ƒ k r= |  j | ƒ j ƒ  d d Sg  } | } |  j | ƒ } d } xC | j  r£ | j | | f ƒ | | } | d 9} |  j | ƒ } qa Wd } t d | ƒ } x_ t | ƒ d k r| j ƒ  }	 | |	 d }
 |  j |
 ƒ } | j  r¼ | |	 d 7} |
 } q¼ q¼ W| S(   s8  
    Computes the order of a at p, with respect to t.

    For a, p in k[t], the order of a at p is defined as nu_p(a) = max({n
    in Z+ such that p**n|a}), where a != 0.  If a == 0, nu_p(a) = +oo.

    To compute the order at a rational function, a/b, use the fact that
    nu_p(a/b) == nu_p(a) - nu_p(b).
    i    i   i   (	   t   is_zeroR   R   t   as_polyt   ETt   remt   appendt   lent   pop(   t   at   pt   tt
   power_listt   p1t   rt   tracks_powert   nt   productt   finalt   productf(    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   order_at'   s.    
	

	c         C  s'   |  j  r t S| j | ƒ |  j | ƒ S(   s¤   
    Computes the order of a/d at oo (infinity), with respect to t.

    For f in k(t), the order or f at oo is defined as deg(d) - deg(a), where
    f == a/d.
    (   R   R   t   degree(   R   t   dR   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   order_at_ooO   s    	c      
   C  s  | p t  d ƒ } t | | ƒ \ } } t | | j | j ƒ ƒ } | j | ƒ } | j t | | ƒ ƒ } t | j | ƒ j | j ƒ | j | j ƒ |  j | j ƒ ƒ \ }	 }
 |  t | | j ƒ t	 | | ƒ j | j ƒ j
 | j | j ƒ ƒ } t | | ƒ } | j | ƒ s,t d | j ƒ |  | f f Sg  | j ƒ  D]$ } | t k r9| d k r9| ^ q9} t t g  | D]2 } t |  t | | j ƒ t	 | | ƒ | ƒ ^ qpt d | j ƒ ƒ } t	 | | ƒ } | |  | | } | | } | j | d t ƒ\ } } | | | f f S(   sg  
    Weak normalization.

    Given a derivation D on k[t] and f == a/d in k(t), return q in k[t]
    such that f - Dq/q is weakly normalized with respect to t.

    f in k(t) is said to be "weakly normalized" with respect to t if
    residue_p(f) is not a positive integer for any normal irreducible p
    in k[t] such that f is in R_p (Definition 6.1.1).  If f has an
    elementary integral, this is equivalent to no logarithm of
    integral(f) whose argument depends on t has a positive integer
    coefficient, where the arguments of the logarithms not in k(t) are
    in k[t].

    Returns (q, f - Dq/q)
    t   zi   i    t   include(   R   R   R   t   diffR   t   quoR
   R   R   R   t	   resultantt   hast
   real_rootsR   R   R   R	   t   True(   R   R$   t   DER&   t   dnt   dst   gt
   d_sqf_partt   d1t   a1t   bR   t   it   NR   t   qt   dqt   snt   sd(    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   weak_normalizer[   s(    */7B
c         C  s  t  | | ƒ \ } } t  | | ƒ \ } } | j | ƒ }	 | j | j | j ƒ ƒ j |	 j |	 j | j ƒ ƒ ƒ }
 | |
 } | |
 } | j | ƒ d r¢ t ‚ n  | | } | j | d t ƒ\ } } | |  | t	 |
 | ƒ | } | j | d t ƒ\ } } | | | f | | f |
 f S(   s÷  
    Normal part of the denominator.

    Given a derivation D on k[t] and f, g in k(t) with f weakly
    normalized with respect to t, either raise NonElementaryIntegralException,
    in which case the equation Dy + f*y == g has no solution in k(t), or the
    quadruplet (a, b, c, h) such that a, h in k[t], b, c in k<t>, and for any
    solution y in k(t) of Dy + f*y == g, q = y*h in k<t> satisfies
    a*Dq + b*q == c.

    This constitutes step 1 in the outline given in the rde.py docstring.
    i   R'   (
   R   R   R(   R   R)   t   divR   R	   R-   R   (   t   fat   fdt   gat   gdR.   R/   R0   t   ent   esR   t   hR   t   ct   cat   cdt   bat   bd(    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   normal_denom‹   s    9

	
t   autoc      
   C  sp  d d l  m } | d k r( | j } n  | d k rL t | j | j ƒ } nŽ | d k rx t | j d d | j ƒ } nb | d k rÊ | j ƒ  j | ƒ }	 | j ƒ  j | ƒ }
 |  |	 |
 t d | j ƒ f St d
 | ƒ ‚ t | | | j ƒ t | | | j ƒ } t | | | j ƒ t | | | j ƒ } t	 d | t	 d | ƒ ƒ } | sÌ| d k r7| j
 j t | j | j ƒ ƒ } t | ƒ ­ t | j d ƒ | j d ƒ |  j d ƒ | j ƒ \ } } t | | j ƒ \ } } | | | | | | ƒ } | d k	 r.| \ } } } | d k r.t	 | | ƒ } q.n  Wd QXqÌ| d k rÌ| j
 j t | j d d | j ƒ ƒ } t | ƒ Lt t | j t d ƒ ƒ | j t d ƒ ƒ |  j t d ƒ ƒ ƒ | j ƒ \ } } t t | j t d ƒ ƒ | j t d ƒ ƒ |  j t d ƒ ƒ ƒ | j ƒ \ } } t | | j ƒ \ } } t d | | | ƒ rÀ| | t d ƒ | | | | | | | | ƒ } | d k	 rÀ| \ } } } | d k r½t	 | | ƒ } q½qÀn  Wd QXqÌn  t d | | | ƒ } | | } | | } |  | } | | j | ƒ t | | j ƒ |  t | | ƒ j | ƒ | }	 | | | j | ƒ }
 | } | |	 |
 | f S(   së  
    Special part of the denominator.

    case is one of {'exp', 'tan', 'primitive'} for the hyperexponential,
    hypertangent, and primitive cases, respectively.  For the
    hyperexponential (resp. hypertangent) case, given a derivation D on
    k[t] and a in k[t], b, c, in k<t> with Dt/t in k (resp. Dt/(t**2 + 1) in
    k, sqrt(-1) not in k), a != 0, and gcd(a, t) == 1 (resp.
    gcd(a, t**2 + 1) == 1), return the quadruplet (A, B, C, 1/h) such that
    A, B, C, h in k[t] and for any solution q in k<t> of a*Dq + b*q == c,
    r = qh in k[t] satisfies A*Dr + B*r == C.

    For case == 'primitive', k<t> == k[t], so it returns (a, b, c, 1) in
    this case.

    This constitutes step 2 of the outline given in the rde.py docstring.
    iÿÿÿÿ(   t   parametric_log_derivRK   t   expt   tani   i   t	   primitivet   bases@   case must be one of {'exp', 'tan', 'primitive', 'base'}, not %s.i    N(   RO   RP   (   t   sympy.integrals.prdeRL   t   caseR   R   t   to_fieldR)   t
   ValueErrorR"   t   minR$   R   R   t   evalt   Nonet   imt   sqrtt   ret   recognize_log_derivativet   maxR   (   R   RH   RI   RF   RG   R.   RR   RL   R   t   Bt   Ct   nbt   ncR   t   dcoefft   alphaat   alphadt   etaat   etadt   At   Qt   mR&   t   betaat   betadR7   t   pNt   pnRD   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   special_denom­   s^     
((!<)TT2$

Ac      
   C  s4  d d l  m } m } m } | d k r4 | j } n  |  j | j ƒ }	 | j | j ƒ }
 | rŒ t g  | D] } | j | j ƒ ^ qh ƒ } n | j | j ƒ } t | j	 | j ƒ j
 ƒ  j ƒ  |  j	 | j ƒ j
 ƒ  j ƒ  ƒ } | d k r@t d | t |
 |	 d ƒ ƒ } |
 |	 d k r0| j r0t d | | |
 ƒ } q0nð| d k rŒ|
 |	 k rnt d | |
 ƒ } n t d | |	 d ƒ } t | j | j | j d ƒ \ } } | j } t | ƒ Çt | | j ƒ \ } } |
 |	 d k rby. | | | | | f g | ƒ \ \ } } } Wn t k
 r*qƒXt | ƒ d k rLt d ƒ ‚ n  t | | d ƒ } n!|
 |	 k rƒ| | | | ƒ } | d	 k	 rƒ| \ } } | d k r€|  t | | ƒ j	 | ƒ | | j	 | ƒ j
 ƒ  | j ƒ  |  j
 ƒ  } t | | j ƒ \ } } y. | | | | | f g | ƒ \ \ } } } Wn t k
 rEq}Xt | ƒ d k rgt d ƒ ‚ n  t | | d ƒ } q€qƒn  Wd	 QXn¤| d
 k rƒt d | t |
 |	 ƒ ƒ } |	 |
 k r0t | j j t | j | j ƒ ƒ | j | j d ƒ \ } } t | ƒ q t | | j ƒ \ } } | | | | | | ƒ } | d	 k	 rw| \ }  } } |  d k rwt | | ƒ } qwn  Wd	 QXq0n­ | d k r | j j | j ƒ } | j j
 ƒ  } t | | ƒ } t d | t |	 | d |
 ƒ ƒ } |
 |	 | d k r0| j r0t d | | |
 ƒ } q0n t d | ƒ ‚ | S(   s$  
    Bound on polynomial solutions.

    Given a derivation D on k[t] and a, b, c in k[t] with a != 0, return
    n in ZZ such that deg(q) <= n for any solution q in k[t] of
    a*Dq + b*q == c, when parametric=False, or deg(q) <= n for any solution
    c1, ..., cm in Const(k) and q in k[t] of a*Dq + b*q == Sum(ci*gi, (i, 1, m))
    when parametric=True.

    For parametric=False, cQ is c, a Poly; for parametric=True, cQ is Q ==
    [q1, ..., qm], a list of Polys.

    This constitutes step 3 of the outline given in the rde.py docstring.
    iÿÿÿÿ(   RL   t   limited_integratet!   is_log_deriv_k_t_radical_in_fieldRK   RP   i    i   RO   s   Length of m should be 1NRM   RN   t   other_nonlinearsS   case must be one of {'exp', 'tan', 'primitive', 'other_nonlinear', 'base'}, not %s.(   RN   Rp   (   RQ   RL   Rn   Ro   RR   R#   R   R\   R	   R   t   LCt   as_exprt
   is_IntegerR   R$   t   Tt   levelR   R   R   RT   RW   R   R)   R   (   R   R5   t   cQR.   RR   t
   parametricRL   Rn   Ro   t   dat   dbR6   t   dct   alphaR   Rd   Re   t   t1Rb   Rc   t   zat   zdRh   Rf   t   aaR&   t   betaRi   Rj   t   deltat   lam(    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   bound_degreeÿ   sˆ    ." &	/	%%>!$
c         C  s˜  t  d | j ƒ } t  d | j ƒ } t  d | j ƒ } x[t r“| j r[ | | d | | f S| d k  t k rv t ‚ n  |  j | ƒ } | j | ƒ j s  t ‚ n  |  j | ƒ | j | ƒ | j | ƒ }  } } |  j | j ƒ d k r$| j	 ƒ  j |  ƒ } | j	 ƒ  j |  ƒ } | | | | | f St
 | |  | ƒ \ }	 }
 | t |  | ƒ 7} |
 t |	 | ƒ } | |  j | j ƒ 8} | | |	 7} | |  9} q9 Wd S(   sw  
    Rothstein's Special Polynomial Differential Equation algorithm.

    Given a derivation D on k[t], an integer n and a, b, c in k[t] with
    a != 0, either raise NonElementaryIntegralException, in which case the
    equation a*Dq + b*q == c has no solution of degree at most n in
    k[t], or return the tuple (B, C, m, alpha, beta) such that B, C,
    alpha, beta in k[t], m in ZZ, and any solution q in k[t] of degree
    at most n of a*Dq + b*q == c must be of the form
    q == alpha*h + beta, where h in k[t], deg(h) <= m, and Dh + B*h == C.

    This constitutes step 4 of the outline given in the rde.py docstring.
    i    i   N(   R   R   R-   R   R   R   R   R)   R#   RS   R
   R   (   R   R5   RE   R   R.   t   zeroR{   R€   R1   R   R&   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   spdep  s,    				/c         C  sç   t  d | j ƒ } xÎ | j sâ | j | j ƒ |  j | j ƒ } d | k oW | k n se t ‚ n  t  | j | j ƒ j ƒ  |  j | j ƒ j ƒ  | j | | j d t ƒ} | | } | d } | t | | ƒ |  | } q W| S(   s´  
    Poly Risch Differential Equation - No cancellation: deg(b) large enough.

    Given a derivation D on k[t], n either an integer or +oo, and b, c
    in k[t] with b != 0 and either D == d/dt or
    deg(b) > max(0, deg(D) - 1), either raise NonElementaryIntegralException, in
    which case the equation Dq + b*q == c has no solution of degree at
    most n in k[t], or a solution q in k[t] of this equation with
    deg(q) < n.
    i    t   expandi   (	   R   R   R   R#   R   R   Rq   t   FalseR   (   R5   RE   R   R.   R8   Rh   R   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   no_cancel_b_largeœ  s    "	B	

c         C  sÙ  t  d | j ƒ } xÀ| j sÔ| d k r3 d } n) | j | j ƒ | j j | j ƒ d } d | k os | k n s t ‚ n  | d k râ t  | j | j ƒ j ƒ  | | j j | j ƒ j ƒ  | j | | j d t ƒ} nÀ |  j | j ƒ | j | j ƒ k rt ‚ n  |  j | j ƒ d k rb| |  j | j	 | j
 d ƒ | j | j	 | j
 d ƒ f St  | j | j ƒ j ƒ  |  j | j ƒ j ƒ  | j d t ƒ} | | } | d } | t | | ƒ |  | } q W| S(   sl  
    Poly Risch Differential Equation - No cancellation: deg(b) small enough.

    Given a derivation D on k[t], n either an integer or +oo, and b, c
    in k[t] with deg(b) < deg(D) - 1 and either D == d/dt or
    deg(D) >= 2, either raise NonElementaryIntegralException, in which case the
    equation Dq + b*q == c has no solution of degree at most n in k[t],
    or a solution q in k[t] of this equation with deg(q) <= n, or the
    tuple (h, b0, c0) such that h in k[t], b0, c0, in k, and for any
    solution q in k[t] of degree at most n of Dq + bq == c, y == q - h
    is a solution in k of Dy + b0*y == c0.
    i    i   R†   (   R   R   R   R#   R$   R   R   Rq   R‡   Rt   Ru   R   (   R5   RE   R   R.   R8   Rh   R   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   no_cancel_b_small·  s*    	)	@$	7	

c   
      C  s   t  d | j ƒ } t |  j | j ƒ j ƒ  | j j | j ƒ j ƒ  ƒ } | j re | j re | } n d } xŽ| j sût	 | | j
 | j ƒ | j j
 | j ƒ d ƒ } d | k oÀ | k n sÎ t ‚ n  t | | j j | j ƒ j ƒ  |  j | j ƒ j ƒ  ƒ } | j r| | | f S| d k rgt  | j | j ƒ j ƒ  | | j | | j d t ƒ}	 nb | j
 | j ƒ | j j
 | j ƒ d k r›t ‚ n. | j | j ƒ j ƒ  |  j | j ƒ j ƒ  }	 | |	 } | d } | t |	 | ƒ |  |	 } qn W| S(   sx  
    Poly Risch Differential Equation - No cancellation: deg(b) == deg(D) - 1

    Given a derivation D on k[t] with deg(D) >= 2, n either an integer
    or +oo, and b, c in k[t] with deg(b) == deg(D) - 1, either raise
    NonElementaryIntegralException, in which case the equation Dq + b*q == c has
    no solution of degree at most n in k[t], or a solution q in k[t] of
    this equation with deg(q) <= n, or the tuple (h, m, C) such that h
    in k[t], m in ZZ, and C in k[t], and for any solution q in k[t] of
    degree at most n of Dq + b*q == c, y == q - h is a solution in k[t]
    of degree at most m of Dy + b*y == C.
    i    iÿÿÿÿi   R†   (   R   R   R	   R   Rq   R$   Rs   t   is_positiveR   R\   R#   R   R‡   R   (
   R5   RE   R   R.   R8   t   lct   MRh   t   uR   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   no_cancel_equalã  s*    8	2	;	<+	.

c         C  s¯  d d l  m } t | ƒ e t |  | j ƒ \ } } | | | | ƒ } | d k	 r} | \ } } | d k r} t d ƒ ‚ q} n  Wd QX| j r | S| | j | j ƒ k  r± t	 ‚ n  t
 d | j ƒ }	 xå | j sª| j | j ƒ }
 | |
 k  rö t	 ‚ n  t | ƒ A t | j ƒ  | j ƒ \ } } t | | | | | ƒ \ } } Wd QXt
 | j ƒ  | j ƒ  | j |
 | j d t ƒ} |	 | 7}	 |
 d } | |  | t | | ƒ 8} qÆ W|	 S(   s†  
    Poly Risch Differential Equation - Cancellation: Primitive case.

    Given a derivation D on k[t], n either an integer or +oo, b in k, and
    c in k[t] with Dt in k and b != 0, either raise
    NonElementaryIntegralException, in which case the equation Dq + b*q == c
    has no solution of degree at most n in k[t], or a solution q in k[t] of
    this equation with deg(q) <= n.
    iÿÿÿÿ(   Ro   i   s7   is_deriv_in_field() is required to  solve this problem.Ni    R†   (   RQ   Ro   R   R   R   RW   t   NotImplementedErrorR   R#   R   R   Rq   t   rischDERr   R‡   R   (   R5   RE   R   R.   Ro   RH   RI   Rf   R&   R8   Rh   t   a2at   a2dt   saR;   t   stm(    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   cancel_primitive  s2    
			$3

c         C  sG  d d l  m } | j j t | j | j ƒ ƒ j ƒ  } t | ƒ † t | | j ƒ \ } } t |  | j ƒ \ } }	 | | |	 | | | ƒ }
 |
 d k	 rÅ |
 \ } } } | d k rÅ t
 d ƒ ‚ qÅ n  Wd QX| j rØ | S| | j | j ƒ k  rù t ‚ n  t d | j ƒ } x5| j sB| j | j ƒ } | | k  r>t ‚ n  |  j ƒ  } t | ƒ … t | | j ƒ \ } } | | | | t | | j ƒ } | | } t | j ƒ  | j ƒ \ } } t | | | | | ƒ \ } } Wd QXt | j ƒ  | j ƒ  | j | | j d t ƒ} | | 7} | d } | |  | t | | ƒ 8} qW| S(   s  
    Poly Risch Differential Equation - Cancellation: Hyperexponential case.

    Given a derivation D on k[t], n either an integer or +oo, b in k, and
    c in k[t] with Dt/t in k and b != 0, either raise
    NonElementaryIntegralException, in which case the equation Dq + b*q == c
    has no solution of degree at most n in k[t], or a solution q in k[t] of
    this equation with deg(q) <= n.
    iÿÿÿÿ(   RL   i   s6   is_deriv_in_field() is required to solve this problem.Ni    R†   (   RQ   RL   R$   R)   R   R   Rr   R   R   RW   R   R   R#   R   Rq   R   R‡   R   (   R5   RE   R   R.   RL   t   etaRd   Re   RH   RI   Rf   R   Rh   R&   R8   R4   t   a1at   a1dR‘   R’   R“   R;   R”   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt
   cancel_exp>  s>    
'			"
$3

c      	   C  s¦  d d l  m } m } |  j r | j d k sc |  j | j ƒ t d | j j | j ƒ d ƒ k r | r| | |  | | | ƒ St	 |  | | | ƒ S|  j sÃ |  j | j ƒ | j j | j ƒ d k  r×| j d k sí | j j | j ƒ d k r×| r| |  | | | ƒ St
 |  | | | ƒ } t | t ƒ r.| S| \ } }	 }
 t | ƒ  |	 j | j ƒ |
 j | j ƒ }	 }
 |	 d	 k rŠt d ƒ ‚ n  |
 d	 k r¥t d ƒ ‚ n  t |	 |
 | | ƒ j | j ƒ } Wd	 QX| | SnË| j j | j ƒ d k rë|  j | j ƒ | j j | j ƒ d k rë| |  j | j ƒ j ƒ  | j j | j ƒ j ƒ  k rë|  j | j ƒ j ƒ  j st d
 ƒ ‚ n  | r”t d ƒ ‚ n  t |  | | | ƒ } t | t ƒ r¼| S| \ } } } t |  | | | ƒ } | | Sn· |  j rt d ƒ ‚ n~ | j d k r:| r't d ƒ ‚ n  t |  | | | ƒ S| j d k rq| r^t d ƒ ‚ n  t |  | | | ƒ St d t ƒ ‚ | r–t d ƒ ‚ n  t d ƒ ‚ d	 S(   s  
    Solve a Polynomial Risch Differential Equation with degree bound n.

    This constitutes step 4 of the outline given in the rde.py docstring.

    For parametric=False, cQ is c, a Poly; for parametric=True, cQ is Q ==
    [q1, ..., qm], a list of Polys.
    iÿÿÿÿ(   t   prde_no_cancel_b_larget   prde_no_cancel_b_smallRP   i    i   i   s   b0 should be a non-Null values   c0 should be a non-Null valueNs   Result should be a numbers0   prde_no_cancel_b_equal() is not yet implemented.sW   Remaining cases for Poly (P)RDE are not yet implemented (is_deriv_in_field() required).RM   sI   Parametric RDE cancellation hyperexponential case is not yet implemented.RO   sB   Parametric RDE cancellation primitive case is not yet implemented.sB   Other Poly (P)RDE cancellation cases are not yet implemented (%s).s2   Remaining cases for Poly PRDE not yet implemented.s1   Remaining cases for Poly RDE not yet implemented.(   RQ   Rš   R›   R   RR   R#   R   R\   R$   Rˆ   R‰   t
   isinstanceR   R   R   RW   RT   t   solve_poly_rdeRq   t	   is_numbert	   TypeErrorR   RŽ   R™   R•   (   R5   Rv   R   R.   Rw   Rš   R›   t   RRD   t   b0t   c0t   yRh   R^   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyR   x  sb    	44*%'F8	
c         C  s  t  |  | | ƒ \ } \ }  } t |  | | | | ƒ \ } \ } } \ }	 }
 } t | | | |	 |
 | ƒ \ } } } } y t | | | | ƒ } Wn t k
 r§ t } n Xt | | | | | ƒ \ } } } } } | j rá | } n t | | | | ƒ } | | | | | f S(   sê  
    Solve a Risch Differential Equation: Dy + f*y == g.

    See the outline in the docstring of rde.py for more information
    about the procedure used.  Either raise NonElementaryIntegralException, in
    which case there is no solution y in the given differential field,
    or return y in k(t) satisfying Dy + f*y == g, or raise
    NotImplementedError, in which case, the algorithms necessary to
    solve the given Risch Differential Equation have not yet been
    implemented.
    (	   R<   RJ   Rm   Rƒ   R   R   R…   R   R   (   R>   R?   R@   RA   R.   t   _R   RH   RI   RF   RG   t   hnRf   R]   R^   t   hsR   Rh   R{   R€   R£   (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyR   Õ  s    0'
'		N((   t   __doc__t
   __future__R    R   t   operatorR   t
   sympy.coreR   t   sympy.core.compatibilityR   t   sympy.core.symbolR   t   sympy.polysR   R   R   R	   t   sympy.integrals.rischR
   R   R   R   R   R   R"   R%   RW   R<   RJ   Rm   R‡   Rƒ   R…   Rˆ   R‰   RŽ   R•   R™   R   R   (    (    (    s2   lib/python2.7/site-packages/sympy/integrals/rde.pyt   <module>   s*   ".	(	0	"Rq	,		,	,	/	:]