o
    *ήcr                     @   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*   K/tmp/pip-target-vg8gfxp4/lib/python/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>"       zrand_poly.<locals>.<listcomp>r'   )r   range)r&   degreer)   r*   r(   r+   	rand_poly!   s    r3   c                 C   s\   t d|}t d|}t| ||}t| ||}|td| kr*t| ||}|td| ks|| S )Nr'   r   )r   r3   r   )r&   r2   r)   degnumdegdennumdenr*   r*   r+   rand_rational_function%   s   

r8   c           
      C   s   | }| |}t|dd}t|dd}|dkr!t|dd}|dkst|||  ||d   }t|  |||  ||d   }t||}	t||	dksNJ ||||fS )Nr'      r      )Tr   )diffr8   r   r   r   )
ratfuncr&   yfyypq1q2q0eqsolr*   r*   r+   find_riccati_ode/   s   
"
rE   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 ]!\}}}}|t|t ||ks$J |t|t || ks2J 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 ]#\}}}}}|t|t ||ks(J |t|t ||| ks7J 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'   r:      r9      Fevaluater            	      N)r&   r	   r   r   r   cancel)testswb1b2r>   bpr*   r*   r+   test_riccati_transformation?   sz   
<HBP
 "H^	HZ"rZ   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sJ qd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.
    r:   r9   rL   rQ   rP   r'   FrI   rK   N)r%   r&   r;   r   r	   r   )rU   rC   	normal_eqr*   r*   r+   test_riccati_reduced   sf   0<8>


:@
(FB4@(r]   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 ]$\}}}}}t
|t t\}}||ksJ |r|||g|ksJ 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  r9   ir  r:   N   \      rL   i  iN     H   r'   T-      i   ^      rN   b      Q   ;  i  <      rK   rQ   FrI   rP   
   i	  i     iD     rM   /   $   rS   i0  rG   i  iw  il     l   i  i7  ih     i$  rO         x   5   ?   (      r   N)r%   r&   r;   r	   r   r   r   r   r   r   r   )rU   rC   resb0rW   rX   matchfuncsr*   r*   r+   test_match_riccati   sL  8

.D.


 :

> 
:.


@8.(






@<8<@@
Pr   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s(J qd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
    rn   r9   rN   r:      rQ   irP   rG   rF   rL      r'         rR   rH   rO   r   irS   N)r   r&   r   )rU   r6   r7   valr*   r*   r+   test_val_at_inf  s0   (x4((XH4r   c                   C   s\   t dg ddksJ t dg ddksJ t dg ddks!J t dg dd	ks,J d
S )zt
    This function tests the necessary conditions for
    a Riccati ODE to have a rational particular solution.
    r[   )r'   r:   rL   Fr'   r:   )r9   r'   rQ   )r'   r:   rN   rO   TN)r   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 ]&}dd | D \}}t||t \}}|t dt   || ksJ qdS )zi
    This function tests the substitution x -> 1/x
    in rational functions represented using Poly.
    r   r9   rN   r:   rQ      ra   rG   r{   rL   P      rl      K   rO   irr   rF   rm   rg   d      rn   rc   rP   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&   as_numer_denomr   subsrT   )fnsr%   r6   r7   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saJ qQd6S )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
    r:   rg       r9   rb   r     rL   i  ix  i  i'    i  i!rN   rF   i  rQ   rk   rG   iX  H  i  iv  i  i  |  T     i  re      i  rl   r   rc   rx   r   i  i  i   i	  i
  i  r'      i  i  Z   i_  i  N)r   r&   r   r	   r   )rU   r6   r7   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sWJ qEd%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.
    r[   r9   r:   rL   rG   T	extensionrN      rF   rP   rO   rQ   r   r'   i  i  i0  i0     i  i  ie  i  1   ij iz  r   r   r   zQQ<sqrt(3)>domainFrI      ,   N)r   r&   r	   r   r   r   r   )rU   r6   r7   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sJ 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   r:   rK   r9   rG   rO   rL   rF   Y   rh   rP   rl   iW  rS   r   i  7   i 8     irQ   rd   B   6      i$ r|   i  ro   ir      N)r   r&   r   r	   r   r   )rU   r6   r7   r   mulr   r*   r*   r+   test_construct_c_case_2  sT   $0$  ::  44	$BB4:,r   c                   C   s   t  dggks	J dS )z`
    This function tests the Case 3 in the step
    to calculate coefficients of c-vectors.
    r'   N)r   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 ]\}}}}t||tt|d}t||d |ksJ qd&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.
    rG   r:   rL   r9   Tr   rP   rn   rd   r[      r`   r   rQ   rF   rO   rR   ru   rS   i  r   irr   iIB  i 
  ir'   )      rm   ;   i   ir   rH   r   rN   N)r   r&   r   r	   r   r#   r   r    )rU   r6   r7   r   dserr*   r*   r+   test_construct_d_case_4  sn   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 ]\}}}t||ttdd}t||ksJ 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.
    r:   r9   Tr   rP   rG   r'   rt   rL   ZZr   rF   rS   rd   rH   r   N)r   r&   r   r#   r   r!   )rU   r6   r7   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sJ 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.
    rS   r:   rG   r   r   rL   rn   r'   r9   rQ   rP   r   rH   r   rO   rN   ri   rF   rd   r   .   "   *   N)r   r&   r	   r   r"   )rU   r6   r7   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sJ 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 calcuated.
    r:   r9   rP   Tr   r'   rQ   rF   ir   )r'   r   rK   rS   r[   rM   @   i  i  rL   r   i?  i  i  rN   i iKi  i  l    `B l   -R i0 i}' )r   r:   rK   r'   rG   rM   rO   r   r[   rK   FrI   )rL   r9   r:   r'   r   rK   rn   r   r   r   ru   )r9   r:   r'   r   rK   rS   i  i  i i) l   ?PT l   @qs lF41l   @4lJ!tz l    Zdjm )r   rK   rS   r[   rM   r   G   r   r   )r   rS   rH   rK   r[   rM   N)r   r&   r	   r   r   r   r#   )rU   r6   r7   x0r   nr   r*   r*   r+   test_rational_laurent_series  sf   
 8
P
264,	4 D"/ r   c                    s   t | tr| j| j } t| tt\}}ttttg|R  }td  fdd|D }t	dd t
| |D s:J t	fddt||D sJJ 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-   rD   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/     r0   c                    s   g | ]
\}}| | qS r*   )dummy_eq)r-   s1s2)r   r*   r+   r/     s    N)
isinstancer   lhsrhsr   r%   r&   r$   r
   allr   zip)rC   solser   r.   r   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|||  qdFS )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
    C0r:   r   rL   rS   r'   r9   r   rg   rF   rP   rQ   rG   rl   rf   rb   r      9   :   rN   rO   r{   rc   rm   r   r   rn        i  i  ri   r   r   0   rK   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   r[   N)	r
   r   r%   r&   r;   r   r	   r   r   r   rU   rC   rD   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|||  qkd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'   r9   r:   rO   rP   i  i/ i i- rN   rL      i*  i  r   r   rQ   N)r
   r   r%   r&   r;   r   r   r*   r*   r+   test_solve_riccati_slowX  s    HD"r   N)Jsympy.core.randomr   sympy.core.functionr   sympy.core.mulr   sympy.core.numbersr   r   r   sympy.core.relationalr   sympy.core.singletonr	   sympy.core.symbolr
   r   &sympy.functions.elementary.exponentialr   r   %sympy.functions.elementary.hyperbolicr   (sympy.functions.elementary.miscellaneousr   (sympy.functions.elementary.trigonometricr   sympy.polys.polytoolsr   sympy.simplify.ratsimpr   sympy.solvers.ode.subscheckr   sympy.testing.pytestr   sympy.solvers.ode.riccatir   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r,   r3   r8   rE   rZ   r]   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r*   r*   r*   r+   <module>   sP    H
B6c,.&>?! C}