U
    9%er                     @   s  d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	 d dl
mZ d dlmZ d dlmZmZ d dlmZ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 d dl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.m/Z/m0Z0m1Z1m2Z2 edZ3edZ4dd Z5dd Z6dd Z7dd Z8dd Z9dd Z:dd  Z;d!d" Z<d#d$ Z=d%d& Z>d'd( Z?d)d* Z@d+d, ZAd-d. ZBd/d0 ZCd1d2 ZDd3d4 ZEd5d6 ZFd7d8 ZGd9d: ZHe!d;d< ZId=S )>    )randint)Function)Mul)IRationaloo)Eq)S)Dummysymbols)explog)tanh)sqrt)sin)Poly)ratsimp)checkodesol)slow)riccati_normalriccati_inverse_normalriccati_reducedmatch_riccatiinverse_transform_polylimit_at_infcheck_necessary_conds
val_at_infconstruct_c_case_1construct_c_case_2construct_c_case_3construct_d_case_4construct_d_case_5construct_d_case_6rational_laurent_seriessolve_riccatifxc                 C   s   t t|  | td| S )N   )r   r   maxint r*   c/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/sympy/solvers/ode/tests/test_riccati.pyrand_rational   s    r,   c                    s    t  fddt|d D | S )Nc                    s   g | ]}t  qS r*   )r,   ).0_r(   r*   r+   
<listcomp>"   s     zrand_poly.<locals>.<listcomp>r'   )r   range)r&   degreer)   r*   r(   r+   	rand_poly!   s    r2   c                 C   sP   t d|}t d|}t| ||}t| ||}|td| krHt| ||}q,|| S )Nr'   r   )r   r2   r   )r&   r1   r)   ZdegnumZdegdennumdenr*   r*   r+   rand_rational_function%   s    

r5   c           
      C   s   | }| |}t|dd}t|dd}|dkr<t|dd}q&t|||  ||d   }t|  |||  ||d   }t||}	t||	dkst||||fS )Nr'      r      )Tr   )diffr5   r   r   r   AssertionError)
Zratfuncr&   ZyfyZypq1q2q0eqsolr*   r*   r+   find_riccati_ode/   s    
"
r@   c                  C   sv  t t d  t d d d t  t t d  t d  t t d d tdd   d  ddt    fdt  d dt  d  ddt   t d  dt  dt  dt  d  dt  d  ddt   tdt d dd  ddt    fd	dt d  d  d
dt  dt  d  dt  dt  d dt d  d   dt  d tddt  dddt  d d  ddt  d    tddt  dd  ft dt  d dt  d  t d dt  d  t d  dt  d  dt  d tddt  d dd  dt  d dt d  dt  d d  dt d  dt  d    dt d    fg} | D ]B\}}}}|t|t ||ksHt|t|t || ks$tq$dt  d dt d  dt   d  dt  t  d dt   dt d  ddt   t  d dt d     t  d d  dt  d   dt  d	dt   t  d dt d     t  d  dt  d t  d  dt  dt d  dt   d    dt   fddt d   dt  t  d dt   dt d  ddt   t  d dt d     t  d d  dt  d   dt  d	dt   t  d dt d     t  d  dt   tdt  d dddt d    fg} | D ]F\}}}}}|t|t ||ksPt|t|t ||| ks*tq*dS )ar  
    This function tests the transformation of the
    solution of a Riccati ODE to the solution of
    its corresponding normal Riccati ODE.

    Each test case 4 values -

    1. w - The solution to be transformed
    2. b1 - The coefficient of f(x) in the ODE.
    3. b2 - The coefficient of f(x)**2 in the ODE.
    4. y - The solution to the normal Riccati ODE.
    r'   r7      r6      Fevaluater            	      N)r&   r	   r   r   r9   r   cancel)testswb1b2r:   bpr*   r*   r+   test_riccati_transformation?   sx    
<HBP
 "H^	HZrU   c                  C   s  t tttd  tt t  tt td   t ttt td  td  td d  ddtd    fdt dt d  t tt td t td  t  dtd  dt t d td   d  dt d d   tdt d dd	dt d   t td  t tt d
td t  tt d    ft td t tt td t t t tdd    dt d d  ddt d d   dt d dt d d   t td  t tt ddt d   ft ttt td t  t td t tt ddtd    fdtd  t d  td dt  d  t tt t td t  t td t tt dtd  td dt  d  dt td dt  d   dtd dt  d   t  ddtd    fdt dt d  t tt td t t t  dft tt tt dt  t td  t td td d   dfg} | D ] \}}|t|t tksrtqrdS )z
    This function tests the transformation of a
    Riccati ODE to its normal Riccati ODE.

    Each test case 2 values -

    1. eq - A Riccati ODE.
    2. normal_eq - The normal Riccati ODE of eq.
    r7   r6   rG   rL   rK   r'   FrD   rF   N)r%   r&   r8   r   r	   r   r9   )rP   r>   Z	normal_eqr*   r*   r+   test_riccati_reduced   sf    0<8> 

:@
(FB4@(rW   c                  C   s  t ttdtd  dtd   dt  d dtd  d	td   d
td   dt  d   d t td dt d   tdd t t t tdd dt d    ddtd  dtd  dtd   dtd   dt  d  dtd  dtd  dtd   dtd   dt  d   dt dtd  dtd   dtd   dt  d   d ddtd  d	td   d
td   dt  d   tdddt  ddd t d  ddt d  ft ttdt d  td d t td   dt d d t t dt d   td!d  d"td  d#t  d$ d%td  d&td     dd't d td!d  ddtd  dtd     d(d)td  dt    d"d%t d&   tdd*t d ddd t d  td d ft ttd+td,  d-td   d.td   d/td   d0t  d1 d)td  d&td,   d2td   d3td   d4td   d1t    td5d   ttdd  t t td tdd    td d t td  dt   dd+td  d)td,  d&td   d2td   d3td   d4t  d1  d-td  d)td,  d&td   d2td   d3td   d4t  d1   d.td  d)td,  d&td   d2td   d3td   d4t  d1   d6t d7td,  dtd   d8td   d9td   d:t  d)   td5d   d7dtd  dtd,   d;td   d<td   d=td   d7t    d>dtd,  dtd   d;td   d<td   d=t  d7   tdddt  ddtd  tdd t ddd t  ft ttttdd  ttdd  d   td t t  tt td  ttdd    dd?d?d?ft ttttd  ttt t  ttt td   dd?d?d?ft ttttt	t  t t td t td   dd?d?d?fdtd  t ttd dt t tt  dt t  dd?d?d?ft tttd  td t t  td td  t td   dd?d?d?ft ttt td  td d td d  t t  ddt d   t td  dd?d?d?fg	} | D ]H\}}}}}t
|t t\}}||kst|r|||g|kstqd@S )Aa  
    This function tests if an ODE is Riccati or not.

    Each test case has 5 values -

    1. eq - The Riccati ODE.
    2. match - Boolean indicating if eq is a Riccati ODE.
    3. b0 -
    4. b1 - Coefficient of f(x) in eq.
    5. b2 - Coefficient of f(x)**2 in eq.
    i  r6   ir  r7   N   \      rG   i  iN     H   r'   T-      i   ^      rI   b      Q   ;  i  <      rF   rL   FrD   rK   
   i	  i     iD     rH   /   $   rN   i0  rB   i  iw  il     l   i  i7  ih     i$  rJ         x   5   ?   (      r   N)r%   r&   r8   r	   r   r   r   r   r   r   r   r9   )rP   r>   resZb0rR   rS   matchfuncsr*   r*   r+   test_match_riccati   sl   8

.D.


 :

> 
:.


@8.(






@   <   8   <   @   @
   Prz   c               
   C   sX  t dtd  dtd   dt  d tt dtd  td  d	td   d
td
   dtd   dtd	   d
td   dtd   dtd   d	t  d td
ft dtt dtd  dtd   dtd   dt  d tdft dtd  dtd   dt  d tt dtd  dtd   dt  d tdft dtd  dtd
   dtd   dtd	   dtd   td  td  dt  tt dtd  t tdft d	td  dtd	   dtd   dtd   td  dt  d tt dtd  dtd   dtd   dt  d tdfg} | D ]"\}}}t||t|ks0tq0dS )a  
    This function tests the valuation of rational
    function at oo.

    Each test case has 3 values -

    1. num - Numerator of rational function.
    2. den - Denominator of rational function.
    3. val_inf - Valuation of rational function at oo
    rh   r6   rI   r7      rL   irK   rB   rA   rG      r'         rM   rC   rJ   r   irN   N)r   r&   r   r9   )rP   r3   r4   valr*   r*   r+   test_val_at_inf  s.    (x4((XH4r   c                   C   sf   t ddddgdkstt ddddgdks0tt ddddgdksHtt dddd	d
gdksbtdS )zt
    This function tests the necessary conditions for
    a Riccati ODE to have a rational particular solution.
    rV   r'   r7   rG   Fr6   rL   rI   rJ   TN)r   r9   r*   r*   r*   r+   test_necessary_condsF  s    r   c               	   C   s>  dt d  dt d   dt   d dt  d  dt d  d	t d
   dt d   dt d   dt   d dt d  dt d   dt   d  dt d  dt d
   dt d   dt d   dt   d dt d
  dt d   dt d   dt   d  dt d  dt d   dt d   dt d
   dt d   dt   d dt d  dt   d  dt d  dt d   dt d
   dt d   dt   d dt d  dt d   dt d   dt d
   dt d   dt d   dt   d  g} | D ]N}dd | D \}}t||t \}}|t dt   || kstqdS )zi
    This function tests the substitution x -> 1/x
    in rational functions represented using Poly.
    r~   r6   rI   r7   rL      r[   rB   ru   rG   P      rf      K   rJ   irl   rA   rg   ra   d      rh   r]   rK   c                 S   s   g | ]}t |tqS r*   )r   r&   )r-   er*   r*   r+   r/   g  s     z/test_inverse_transform_poly.<locals>.<listcomp>r'   N)r&   Zas_numer_denomr   subsrO   r9   )fnsr%   r3   r4   r*   r*   r+   test_inverse_transform_polyU  s     .^j^t
r   c               
   C   s  t dtd  dt  d tt dtd  dtd   dt  d tdft dtd	  dtd   d
td   dt  d tt dtd  dtd   dt  d ttft dtd  dtd   dtd   dtd   dtd	   dtd   dtd   dt  d tt dtd  dtd   dtd   dtd	   dtd   d td   d!t  d" tt ft d!td  d#td   d$td   d$td	   d%td   d&td   d't  d( tt d)td  dtd   d*td   d*td	   d+td   d,td   d-t  d. ttd/d ft d0td	  d1td   d.td   d2t  d3 tt d4td	  dtd   d5td   dt  d ttd0d4 fg} | D ]"\}}}t||t|kstqd6S )7a   
    This function tests the limit at oo of a
    rational function.

    Each test case has 3 values -

    1. num - Numerator of rational function.
    2. den - Denominator of rational function.
    3. limit_at_inf - Limit of rational function at oo
    r7   ra       r6   r\   r     rG   i  ix  i  i'    i  i!rI   rA   i  rL   re   rB   iX  H  i  iv  i  i  |  T     i  r_      i  rf   r   r]   rr   r~   i  i  i   i	  i
  i  r'      i  i  Z   i_  i  N)r   r&   r   r	   r   r9   )rP   r3   r4   Zlimr*   r*   r+   test_limit_at_infl  s:    (4(TXXX
44
r   c                  C   s  t dtd  dtd   dt  d tddt dtd  d	td
   dtd   dtd   dtd   dtd   tddtdtdd tdt d  gtdd tdt d  ggft dtd  dtd   dt  d tddt dtd  dtd   dtd   dtd   dt  d tddtd
d tdd tdd  gtdd tdd  ggft dt d tddt dtd  ddtd  td   ddtd  td   ddtd  t  dtd  d	 tdd tdtd d tdd ttddtd d d!d"d#td d$  d d  gtdd ttddtd d d!d"d#td d$  d d  ggfg} | D ]&\}}}}t||t||kstqd%S )&ab  
    This function tests the Case 1 in the step
    to calculate coefficients of c-vectors.

    Each test case has 4 values -

    1. num - Numerator of the rational function a(x).
    2. den - Denominator of the rational function a(x).
    3. pole - Pole of a(x) for which c-vector is being
       calculated.
    4. c - The c-vector for the pole.
    rV   r6   r7   rG   rB   T	extensionrI      rA   rK   rJ   rL   r   r'   i  i  i0  i0     i  i  ie  i  1   ij iz  r   r   r|   zQQ<sqrt(3)>domainFrD      ,   N)r   r&   r	   r   r   r   r   r9   )rP   r3   r4   polecr*   r*   r+   test_construct_c_case_1  s6    ,P:,D
2P
 BBr   c                  C   s  t dtddt td d td  tddddt dt  d gtdt  d ggft dtd  dtd	   d
td   d tddt dt d d td d  tddtdd dtd d gtd d ggft td td  d	t  tddt td d	 td d  tdddd	d
td tdd d	td d
   d dtd d
 gdtd tdd d	td d
   d dtd d
 ggft dtd  td	  d tddt d	t d d	 td  tddtd d	 d	dtd td d tdd   d tdd gdtd tdd tdd   d td d ggft td d tddt dt d d td d  tddtdd ddtd td d tdd   d dtd d tdd  gd!td tdd tdd   d dtd d td d  ggft td d tddt ttd d tddtddtd"tdd
 dtd"   d# td
d
 td"gtd" tdd
 dtd"   d# td
 d
 td" ggfg} | D ]*\}}}}}t||t|||kstqd$S )%a  
    This function tests the Case 2 in the step
    to calculate coefficients of c-vectors.

    Each test case has 5 values -

    1. num - Numerator of the rational function a(x).
    2. den - Denominator of the rational function a(x).
    3. pole - Pole of a(x) for which c-vector is being
       calculated.
    4. mul - The multiplicity of the pole.
    5. c - The c-vector for the pole.
    r'   Tr   r7   rF   r6   rB   rJ   rG   rA   Y   rb   rK   rf   iW  rN   r   i  7   i 8     irL   r^   B   6      i$ rv   i  ri   ir      N)r   r&   r   r	   r   r   r9   )rP   r3   r4   r   mulr   r*   r*   r+   test_construct_c_case_2  s^     $0$
    ::   44	$
 BB 4:,r   c                   C   s   t  dggkstdS )z`
    This function tests the Case 3 in the step
    to calculate coefficients of c-vectors.
    r'   N)r   r9   r*   r*   r*   r+   test_construct_c_case_3  s    r   c                  C   s  t td  dtd   dtd   dt  d tddt dtd  dtd   dt  d tddddt d	 td d
t tdd td   d gdt d	 t d dt tdd td   d ggft td  dtd   dtd   dtd   dtd   dt  d tddt td dtd   dtd   t d tddddt tt dt  d gdt t tdt  d ggft dtd  td  td  dtd   td  dt  d tddt dtd  dt  d tddddtd t d dtd t d tdt d td t tdd dtd t d   d gdtd t d dtd t d td t d tdt tdd dtd t d   d ggft d
td  dtd   dtd   td  d tddt dt d tddddt d dt d td t td d  t  gd!t d d"t d t d ttd d  t  ggft td  td  td  td  t tddt td tdddd#t d dt t tt d$dt   d gdt d dt tt td$dt   d ggft td  td  dtd   dtd   td  td  dt  d tddt dt d tddddtd t d dtd t d tdt d tdt d td t td d% dtd t d   d gd
td t d d
td t d td t d td t d tdt td d% dtd t d   d ggfg} | D ]8\}}}}t||tt|d}t||d |ks^tq^d&S )'a9  
    This function tests the Case 4 in the step
    to calculate coefficients of the d-vector.

    Each test case has 4 values -

    1. num - Numerator of the rational function a(x).
    2. den - Denominator of the rational function a(x).
    3. mul - Multiplicity of oo as a pole.
    4. d - The d-vector.
    rB   r7   rG   r6   Tr   rK   rh   r^   rV      rZ   r   rL   rA   rJ   rM   ro   rN   i  r   irl   iIB  i 
  ir'   )      rg   ;   i   ir   rC   r}   rI   N)	r   r&   r   r	   r   r#   r   r    r9   )rP   r3   r4   r   dserr*   r*   r+   test_construct_d_case_4  sl    6,02N06D H4.	822	.XNXD0.r   c               	   C   s  t dtd  td  t d tddt dtd  dtd   dt  d tddtdd td d gtd d tdd ggft dtd  td	  td  td  dt  d td
dt dtd  dtd	   dtd   dtd   dt  d td
dtdd dtd d gtd d dtd d ggft td t d td
dt dtd  dt  d td
dtdd dtd d gtd d dtd d ggfg} | D ]0\}}}t||ttdd}t||kstqdS )a  
    This function tests the Case 5 in the step
    to calculate coefficients of the d-vector.

    Each test case has 3 values -

    1. num - Numerator of the rational function a(x).
    2. den - Denominator of the rational function a(x).
    3. d - The d-vector.
    r7   r6   Tr   rK   rB   r'   rn   rG   ZZr   rA   rN   r^   rC   r   N)r   r&   r   r#   r   r!   r9   )rP   r3   r4   r   r   r*   r*   r+   test_construct_d_case_5E  s     $,28D8 8r   c                  C   s  t dtd  d tddt dtd  dtd   dt  d tddtdd td  gtdd td  ggft dtd	  dtd   dt  d tddt td
 td  dtd   dtd	   dtd   dt  d tdddgdggft dtd	  td  dt  d tddt d
td  dtd   dtd
   dtd   dtd   dtd	   dtd   dt  d tdddgdggfg} | D ]"\}}}t||t|kstqdS )a  
    This function tests the Case 6 in the step
    to calculate coefficients of the d-vector.

    Each test case has 3 values -

    1. num - Numerator of the rational function a(x).
    2. den - Denominator of the rational function a(x).
    3. d - The d-vector.
    rN   r7   rB   r   r   rG   rh   r'   r6   rL   rK   r   rC   r|   rJ   rI   rc   rA   r^   r   .   "   *   N)r   r&   r	   r   r"   r9   )rP   r3   r4   r   r*   r*   r+   test_construct_d_case_6f  s,    ,*,H
(T 
r   c                  C   s  t td dt  d tddt td t tddtddddd	dd
dd
dft dtd  dt  d tddt dtd  dtd   dtd   dt  d tddtdd ddtdd tdd tdd tdd dft dtddt td dtd d td   dtd d  td   d!dtd  td   ddtd  t  d tddtddddtd d"dtd  td#d"dtd  d$d%d#td  d"dtd  d#td d  td#d"dtd  d$d%d#td d  d"dtd  d#td d  d&ft td dtd   dtd   d't  d( tddt td d tddtdddd)ddd*d+d,ft dtd  dtd   dt  d tddt dtd  td  dtd   dt  d tddtdd d)dtd-d. td/d0 td1d2 td3d4 td5d6 d7ft d8td  dt  d tddt dtd  dtd   dtd   dtd   dt  d tddtd)dd)d)td9 d: d)d#td;d d<fg} | D ].\}}}}}}|t||t|||kstqd=S )>a  
    This function tests the computation of coefficients
    of Laurent series of a rational function.

    Each test case has 5 values -

    1. num - Numerator of the rational function.
    2. den - Denominator of the rational function.
    3. x0 - Point about which Laurent series is to
       be calculated.
    4. mul - Multiplicity of x0 if x0 is a pole of
       the rational function (0 otherwise).
    5. n - Number of terms upto which the series
       is to be calculated.
    r7   r6   rK   Tr   r'   rL   rA   ir}   )r'   r   rF   rN   rV   rH   @   i  i  rG   r   i?  i  i  rI   i iKi  i  l    `B l   -R i0 i}' )r   r7   rF   r'   rB   rH   rJ   r   rV   rF   FrD   )rG   r6   r7   r'   r   rF   rh   r{   r   r~   ro   )r6   r7   r'   r   rF   rN   i  i  i i) l   ?PT l   @qs lF41l   @4lJ!tz l    Zdjm )r   rF   rN   rV   rH   r   G   r   r|   )r   rN   rC   rF   rV   rH   N)r   r&   r	   r   r   r   r#   r9   )rP   r3   r4   Zx0r   nr   r*   r*   r+   test_rational_laurent_series  s       8
  
P   2 4  	,4
  
 
 D  "/r   c                    s   t | tr| j| j } t| tt\}}ttttf| }td  fdd|D }t	dd t
| |D srtt	fddt||D stdS )z
    Helper function to check if actual solution
    matches expected solution if actual solution
    contains dummy symbols.
    C1c                    s   g | ]}|  qS r*   )r   )r-   r?   r   	dummy_symr*   r+   r/     s     z#check_dummy_sol.<locals>.<listcomp>c                 S   s   g | ]}|d  qS )r   r*   )r-   r&   r*   r*   r+   r/     s     c                    s   g | ]\}}| | qS r*   )Zdummy_eq)r-   s1s2)r   r*   r+   r/     s     N)
isinstancer   lhsrhsr   r%   r&   r$   r
   allr   r9   zip)r>   Zsolser   r.   ry   Zsolsr*   r   r+   check_dummy_sol  s    
r   c                  C   s0  t d} ttttttd  d dttttdttttd gfttd ttt dtt t  dtd   tttd|  t | t td   gfdtd  ttt tdtt ttt d   ttd tt  ttt| dtd   | t  gfttttttd  dtd td    tttdtd t  gftd dt dt  tt  ttd  ttt ttt| t td  dt  | td   ttttgftd ttt td  tdttd  ttt   tt ttt| td  t | td   ttttd gfttd  ttt dtd  d	t  d
 td d dt d d    tttd|  t d|   dtd   dtd   dtd   dtd   dt  d d|  td  d|  t  d|   dtd   dtd   dtd   dtd   dtd   dt   tttdt d dtd  dt  d  gfttd ttt dtd  dtd   dtd   dtd   d
td   d	t  d dtd    tttdtd  dtd   td  dtd   dt  d dtd  dtd    gftttttd  dtd   dtd   dtd   dt  d td dtd   dtd   dtd   dtd   dtd
   d td   dtd   dtd   dtd   dtd   dt  d  ttd  tt tttdtd dtd   dtd   d	td   dtd   dt  d  gfttttttt dt  dt d ttd  dt d   dtd  d
t  d! d"td  dtd   d   tdd  tttddt  dt d  gfttttd#td  d$t  d dtd  dtd   dt  d  dttd  dt d   tttdt d dt d  gftttdtd  d ttd  t  dtd  t d tt ttd    dtd  dt  d ttd d    ttt|  td  td  dt  | t |  td  td  td  t  tttd%td  gftttdt ttd d  t  tttt |  ttd   | td   tttt gfttttttt tdd dt   td tdd  ttd  dt d tdd    tdd  d&td  d't  d( d"td  dtd     tttdt t tttdtd)  d*td+   d,td   d-td   d.td   d/td   d0td   d1td
   d2td   d3td   d4td   d5td   d6td   d7t  d8 dtd)  d9td+   d:td   d;td   d<td   d/td   d=td   d>td
   d?td   d@td   dAtd   dBtd   dBtd   dCt   gfttttdDtd  dDtd   t d tdd  ttd   d tttdt gfttttdEtd  d dt d  td tdd  ttd   d dt tt t  dt  tttdEt d d gfg}|D ]\}}t|||  qdFS )Ga  
    This function tests the computation of rational
    particular solutions for a Riccati ODE.

    Each test case has 2 values -

    1. eq - Riccati ODE to be solved.
    2. sol - Expected solution to the equation.

    Some examples have been taken from the paper - "Statistical Investigation of
    First-Order Algebraic ODEs and their Rational General Solutions" by
    Georg Grasegger, N. Thieu Vo, Franz Winkler

    https://www3.risc.jku.at/publications/download/risc_5197/RISCReport15-19.pdf
    C0r7   r   rG   rN   r'   r6   r~   ra   rA   rK   rL   rB   rf   r`   r\   r      9   :   rI   rJ   ru   r]   rg   r|   r   rh        i  i  rc   r   r   0   rF   i  r   r   r   r   r{   r   r   i0H  i iF i4" i< ii2ҍi"0	iimi^   r   i  i<Z  i8X i4 iLB i i|Mi:i r   rV   N)	r
   r   r%   r&   r8   r   r	   r   r   r   rP   r>   r?   r*   r*   r+   test_solve_riccati  s\   "$4&N"08:F6@J:



F

H
FN




R	D2
"H"J&F(:J
.J







F





LHer   c                  C   s   t d} ttttdt tt td  ddt  ttd  dt d   dtd  dtd   d	t  d
 dtd  dtd   dtd   dt  d   d tttdt d dt d  gfg}|D ]\}}t|||  qdS )z
    This function tests the computation of rational
    particular solutions for a Riccati ODE.

    Each test case has 2 values -

    1. eq - Riccati ODE to be solved.
    2. sol - Expected solution to the equation.
    r   r'   r6   r7   rJ   rK   i  i/ i i- rI   rG      i*  i  r   r   rL   N)r
   r   r%   r&   r8   r   r   r*   r*   r+   test_solve_riccati_slowX  s    HD"r   N)JZsympy.core.randomr   Zsympy.core.functionr   Zsympy.core.mulr   Zsympy.core.numbersr   r   r   Zsympy.core.relationalr   Zsympy.core.singletonr	   Zsympy.core.symbolr
   r   Z&sympy.functions.elementary.exponentialr   r   Z%sympy.functions.elementary.hyperbolicr   Z(sympy.functions.elementary.miscellaneousr   Z(sympy.functions.elementary.trigonometricr   Zsympy.polys.polytoolsr   Zsympy.simplify.ratsimpr   Zsympy.solvers.ode.subscheckr   Zsympy.testing.pytestr   Zsympy.solvers.ode.riccatir   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r,   r2   r5   r@   rU   rW   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r*   r*   r*   r+   <module>   sN   H
B6c,.&>?! C}