
    qKgUS                     6   d dl mZmZ d dlZd dlmZmZmZ d dlm	Z
 d dlmZmZ d dlmZ d dlmZ  G d d      Z G d	 d
      Z G d d      Zd Zd Zej.                  j1                  d e edd       edd      ge      df edd edd      ge      df e ed       ed      dge      dff      d        Zej.                  j1                  d eg de      df eddddgge      dff      d         Z G d! d"      Zej.                  j1                  d#e
j:                  d$fe
j<                  d%fe
j>                  d&fe
j@                  d'fe
jB                  d(fe
jD                  d)ff      d*        Z# G d+ d,      Z$ G d- d.      Z%d/Z& G d0 d1      Z'y)2    )naninfN)arrayarangeprintoptions)assert_equalassert_)Fraction)Decimalc                      e Zd Z ej                  dd      d        Zej                  j                  dg ddfg dd	f ed
      dff      d        Z	ej                  j                  dg ddfg ddf ed
      dff      d        Z
ej                  j                  dg ddfg ddf ed
      dff      d        Zej                  j                  dg ddfg ddf ed
      dff      d        Zej                  j                  dg ddfg ddf ed
      dff      d        Zej                  j                  dg ddfg ddf ed
      dff      d         Zd! Zy")#TestStrUnicodeSuperSubscriptsclassTscopeautousec                 .    t        j                  d       y Nunicodepolyset_default_printstyleselfs    h/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numpy/polynomial/tests/test_printing.pyuse_unicodez)TestStrUnicodeSuperSubscripts.use_unicode   s    ##I.    inptgt            1.0 + 2.0·x + 3.0·x²r   r#   r&   u#   -1.0 + 0.0·x + 3.0·x² - 1.0·x³   u   0.0 + 1.0·x + 2.0·x² + 3.0·x³ + 4.0·x⁴ + 5.0·x⁵ + 6.0·x⁶ + 7.0·x⁷ +
8.0·x⁸ + 9.0·x⁹ + 10.0·x¹⁰ + 11.0·x¹¹c                 \    t        j                  |      }t        |      }t        ||       y N)r   
Polynomialstrr   )r   r   r   press        r   test_polynomial_strz1TestStrUnicodeSuperSubscripts.test_polynomial_str   s%     OOC !fS#r   !   1.0 + 2.0·T₁(x) + 3.0·T₂(x)u1   -1.0 + 0.0·T₁(x) + 3.0·T₂(x) - 1.0·T₃(x)u   0.0 + 1.0·T₁(x) + 2.0·T₂(x) + 3.0·T₃(x) + 4.0·T₄(x) + 5.0·T₅(x) +
6.0·T₆(x) + 7.0·T₇(x) + 8.0·T₈(x) + 9.0·T₉(x) + 10.0·T₁₀(x) + 11.0·T₁₁(x)c                 X    t        t        j                  |            }t        ||       y r)   r+   r   	Chebyshevr   r   r   r   r-   s       r   test_chebyshev_strz0TestStrUnicodeSuperSubscripts.test_chebyshev_str   s!     $..%&S#r   u!   1.0 + 2.0·P₁(x) + 3.0·P₂(x)u1   -1.0 + 0.0·P₁(x) + 3.0·P₂(x) - 1.0·P₃(x)u   0.0 + 1.0·P₁(x) + 2.0·P₂(x) + 3.0·P₃(x) + 4.0·P₄(x) + 5.0·P₅(x) +
6.0·P₆(x) + 7.0·P₇(x) + 8.0·P₈(x) + 9.0·P₉(x) + 10.0·P₁₀(x) + 11.0·P₁₁(x)c                 X    t        t        j                  |            }t        ||       y r)   r+   r   Legendrer   r3   s       r   test_legendre_strz/TestStrUnicodeSuperSubscripts.test_legendre_str)   !     $--$%S#r   u!   1.0 + 2.0·H₁(x) + 3.0·H₂(x)u1   -1.0 + 0.0·H₁(x) + 3.0·H₂(x) - 1.0·H₃(x)u   0.0 + 1.0·H₁(x) + 2.0·H₂(x) + 3.0·H₃(x) + 4.0·H₄(x) + 5.0·H₅(x) +
6.0·H₆(x) + 7.0·H₇(x) + 8.0·H₈(x) + 9.0·H₉(x) + 10.0·H₁₀(x) + 11.0·H₁₁(x)c                 X    t        t        j                  |            }t        ||       y r)   r+   r   Hermiter   r3   s       r   test_hermite_strz.TestStrUnicodeSuperSubscripts.test_hermite_str4   s!     $,,s#$S#r   u#   1.0 + 2.0·He₁(x) + 3.0·He₂(x)u4   -1.0 + 0.0·He₁(x) + 3.0·He₂(x) - 1.0·He₃(x)u   0.0 + 1.0·He₁(x) + 2.0·He₂(x) + 3.0·He₃(x) + 4.0·He₄(x) + 5.0·He₅(x) +
6.0·He₆(x) + 7.0·He₇(x) + 8.0·He₈(x) + 9.0·He₉(x) + 10.0·He₁₀(x) +
11.0·He₁₁(x)c                 X    t        t        j                  |            }t        ||       y r)   r+   r   HermiteEr   r3   s       r   test_hermiteE_strz/TestStrUnicodeSuperSubscripts.test_hermiteE_str?   !     $--$%S#r   u!   1.0 + 2.0·L₁(x) + 3.0·L₂(x)u1   -1.0 + 0.0·L₁(x) + 3.0·L₂(x) - 1.0·L₃(x)u   0.0 + 1.0·L₁(x) + 2.0·L₂(x) + 3.0·L₃(x) + 4.0·L₄(x) + 5.0·L₅(x) +
6.0·L₆(x) + 7.0·L₇(x) + 8.0·L₈(x) + 9.0·L₉(x) + 10.0·L₁₀(x) + 11.0·L₁₁(x)c                 X    t        t        j                  |            }t        ||       y r)   r+   r   Laguerrer   r3   s       r   test_laguerre_strz/TestStrUnicodeSuperSubscripts.test_laguerre_strK   r9   r   c                     t        t        j                  ddg            }d}t        ||       t        t        j                  ddgddg            }d}t        ||       y )Nr   r!   u   0.0 + 1.0·xr"   domainu   0.0 + 1.0·(-3.0 + 2.0x)r+   r   r*   r   r   r-   r   s      r   test_polynomial_str_domainsz9TestStrUnicodeSuperSubscripts.test_polynomial_str_domainsV   sT    $//1a&)*S#$//1a&!Q89(S#r   N)__name__
__module____qualname__pytestfixturer   markparametrizer   r.   r4   r8   r=   rA   rF   rL    r   r   r   r      s   V^^'40/ 1/ [[^	-.	>?	 $ 	&. 
 [[^	78	LM	 K 	M.  [[^	78	LM	 K 	M.  [[^	78	LM	 K 	M.  [[^	9:	OP	 * 	,.  [[^	78	LM	 K 	M. r   r   c                      e Zd Z ej                  dd      d        Zej                  j                  dg ddfg dd	f ed
      dff      d        Z	ej                  j                  dg ddfg ddf ed
      dff      d        Z
ej                  j                  dg ddfg ddf ed
      dff      d        Zej                  j                  dg ddfg ddf ed
      dff      d        Zej                  j                  dg ddfg ddf ed
      dff      d        Zej                  j                  dg ddfg ddf ed
      dff      d         Zd! Zy")#TestStrAsciir   Tr   c                 .    t        j                  d       y Nasciir   r   s    r   	use_asciizTestStrAscii.use_asciia       ##G,r   r   r    1.0 + 2.0 x + 3.0 x**2r%   z"-1.0 + 0.0 x + 3.0 x**2 - 1.0 x**3r'   z}0.0 + 1.0 x + 2.0 x**2 + 3.0 x**3 + 4.0 x**4 + 5.0 x**5 + 6.0 x**6 +
7.0 x**7 + 8.0 x**8 + 9.0 x**9 + 10.0 x**10 + 11.0 x**11c                 X    t        t        j                  |            }t        ||       y r)   rJ   r3   s       r   r.   z TestStrAscii.test_polynomial_stre   s!     $//#&'S#r   1.0 + 2.0 T_1(x) + 3.0 T_2(x)z+-1.0 + 0.0 T_1(x) + 3.0 T_2(x) - 1.0 T_3(x)z0.0 + 1.0 T_1(x) + 2.0 T_2(x) + 3.0 T_3(x) + 4.0 T_4(x) + 5.0 T_5(x) +
6.0 T_6(x) + 7.0 T_7(x) + 8.0 T_8(x) + 9.0 T_9(x) + 10.0 T_10(x) +
11.0 T_11(x)c                 X    t        t        j                  |            }t        ||       y r)   r1   r3   s       r   r4   zTestStrAscii.test_chebyshev_strp   s!     $..%&S#r   z1.0 + 2.0 P_1(x) + 3.0 P_2(x)z+-1.0 + 0.0 P_1(x) + 3.0 P_2(x) - 1.0 P_3(x)z0.0 + 1.0 P_1(x) + 2.0 P_2(x) + 3.0 P_3(x) + 4.0 P_4(x) + 5.0 P_5(x) +
6.0 P_6(x) + 7.0 P_7(x) + 8.0 P_8(x) + 9.0 P_9(x) + 10.0 P_10(x) +
11.0 P_11(x)c                 X    t        t        j                  |            }t        ||       y r)   r6   r3   s       r   r8   zTestStrAscii.test_legendre_str|   rB   r   z1.0 + 2.0 H_1(x) + 3.0 H_2(x)z+-1.0 + 0.0 H_1(x) + 3.0 H_2(x) - 1.0 H_3(x)z0.0 + 1.0 H_1(x) + 2.0 H_2(x) + 3.0 H_3(x) + 4.0 H_4(x) + 5.0 H_5(x) +
6.0 H_6(x) + 7.0 H_7(x) + 8.0 H_8(x) + 9.0 H_9(x) + 10.0 H_10(x) +
11.0 H_11(x)c                 X    t        t        j                  |            }t        ||       y r)   r;   r3   s       r   r=   zTestStrAscii.test_hermite_str   s!     $,,s#$S#r   z1.0 + 2.0 He_1(x) + 3.0 He_2(x)z.-1.0 + 0.0 He_1(x) + 3.0 He_2(x) - 1.0 He_3(x)z0.0 + 1.0 He_1(x) + 2.0 He_2(x) + 3.0 He_3(x) + 4.0 He_4(x) +
5.0 He_5(x) + 6.0 He_6(x) + 7.0 He_7(x) + 8.0 He_8(x) + 9.0 He_9(x) +
10.0 He_10(x) + 11.0 He_11(x)c                 X    t        t        j                  |            }t        ||       y r)   r?   r3   s       r   rA   zTestStrAscii.test_hermiteE_str   rB   r   z1.0 + 2.0 L_1(x) + 3.0 L_2(x)z+-1.0 + 0.0 L_1(x) + 3.0 L_2(x) - 1.0 L_3(x)z0.0 + 1.0 L_1(x) + 2.0 L_2(x) + 3.0 L_3(x) + 4.0 L_4(x) + 5.0 L_5(x) +
6.0 L_6(x) + 7.0 L_7(x) + 8.0 L_8(x) + 9.0 L_9(x) + 10.0 L_10(x) +
11.0 L_11(x)c                 X    t        t        j                  |            }t        ||       y r)   rD   r3   s       r   rF   zTestStrAscii.test_laguerre_str   rB   r   c                     t        t        j                  ddg            }d}t        ||       t        t        j                  ddgddg            }d}t        ||       y )Nr   r!   z0.0 + 1.0 xr"   rH   z0.0 + 1.0 (-3.0 + 2.0x)rJ   rK   s      r   rL   z(TestStrAscii.test_polynomial_str_domains   sT    $//1a&)*S#$//1a&!Q89'S#r   N)rM   rN   rO   rP   rQ   rZ   rR   rS   r   r.   r4   r8   r=   rA   rF   rL   rT   r   r   rV   rV   _   s   V^^'40- 1- [[^	,-	=>	 ; 	=.  [[^	34	FG	 % 	'.  [[^	34	FG	 % 	'.  [[^	34	FG	 % 	'.  [[^	56	IJ	 6 	8.  [[^	34	FG	 % 	'. r   rV   c                       e Zd Z ej                  dd      d        Zd Zd Zd Zd Z	ej                  j                  d	d
      d        Zy)TestLinebreakingr   Tr   c                 .    t        j                  d       y rX   r   r   s    r   rZ   zTestLinebreaking.use_ascii   r[   r   c                     t        j                  g d      }t        t        t	        |            d       t        t	        |      d       y )N)Na ri   ri   ri   {   J   zJ12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 123.0 x**4r   r*   r   lenr+   r   r,   s     r   test_single_line_one_lessz*TestLinebreaking.test_single_line_one_less   s6    OOIJSQ["%SV+	r   c                     t        j                  g d      }t        t        t	        |            d       t        t	        |      d       y )N)ri   ri   ri   ri   i  K   zK12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 +
1234.0 x**4rl   rn   s     r   test_num_chars_is_linewidthz,TestLinebreaking.test_num_chars_is_linewidth   s6    OOJKSQ["%SV-	r   c                     t        j                  g d      }t        t        t	        |      j                  d      d         d       t        t	        |      d       y )N)ri   ri   ri   ri   r!   ri   
r   rk   zZ12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.0 x**3 + 1.0 x**4 +
12345678.0 x**5)r   r*   r   rm   r+   splitrn   s     r   6test_first_linebreak_multiline_one_less_than_linewidthzGTestLinebreaking.test_first_linebreak_multiline_one_less_than_linewidth   sI    OOE 	SQd+A./4SV<	r   c                 \    t        j                  g d      }t        t        |      d       y )N)ri   ri   ri   g=
)gAr!   ri   z[12345678.0 + 12345678.0 x + 12345678.0 x**2 + 12345678.12 x**3 +
1.0 x**4 + 12345678.0 x**5)r   r*   r   r+   rn   s     r   +test_first_linebreak_multiline_on_linewidthz<TestLinebreaking.test_first_linebreak_multiline_on_linewidth   s(    OOH 	SV=	r   )lwr   ))rq   z0.0 + 10.0 x + 200.0 x**2 + 3000.0 x**3 + 40000.0 x**4 + 500000.0 x**5 +
600000.0 x**6 + 70000.0 x**7 + 8000.0 x**8 + 900.0 x**9)-   z0.0 + 10.0 x + 200.0 x**2 + 3000.0 x**3 +
40000.0 x**4 + 500000.0 x**5 +
600000.0 x**6 + 70000.0 x**7 + 8000.0 x**8 +
900.0 x**9)   z0.0 + 10.0 x + 200.0 x**2 + 3000.0 x**3 + 40000.0 x**4 + 500000.0 x**5 + 600000.0 x**6 + 70000.0 x**7 + 8000.0 x**8 + 900.0 x**9c                    t        j                  g d      }t        |      5  t        t	        |      |       t	        |      j                  d      D ]  }t        t        |      |k          	 d d d        y # 1 sw Y   y xY w)N)
r   
      i  i@  i  i'	 ip i@  i  )	linewidthrt   )r   r*   r   r   r+   ru   r	   rm   )r   ry   r   r,   lines        r   test_linewidth_printoptionz+TestLinebreaking.test_linewidth_printoption   s`     OOG
 B'Q%AT*D	B' + (''s   AA::BN)rM   rN   rO   rP   rQ   rZ   ro   rr   rv   rx   rR   rS   r   rT   r   r   rf   rf      s_    V^^'40- 1-	 [[] 
- 
(
(r   rf   c                     t        j                  g d      } t        j                  g d      }t        j                  d       t	        t        |       d       t	        t        |      d       t        j                  d       t	        t        |       d       t	        t        |      d       t        j                  t              5  t        j                  d       d d d        y # 1 sw Y   y xY w)	Nr    rY   r\   r^   r   r$   r/   invalid_input)	r   r*   r2   r   r   r+   rP   raises
ValueError)r,   cs     r   test_set_default_printoptionsr      s    	"Ay!A(Q12Q89	*Q23Q<=	z	"##O4 
#	"	"s   C%%C.c                  z   g d} t        j                  |       }t        j                  t        | t                    }t        j                  d       t        t        |      d       t        t        |      d       t        j                  d       t        t        |      d       t        t        |      d       y	)
z%Test both numpy and built-in complex.)y              ?y      ?      ?y              @y      @        dtyper   u*   1j + (1+1j)·x - (2-2j)·x² + (3+0j)·x³u+   1j + (1+1j)·x + (-2+2j)·x² + (3+0j)·x³rY   z)1j + (1+1j) x - (2-2j) x**2 + (3+0j) x**3z*1j + (1+1j) x + (-2+2j) x**2 + (3+0j) x**3N)r   r*   r   objectr   r   r+   )coefsp1p2s      r   test_complex_coefficientsr     s    %E		B	uF3	4B	*RFGRGH(REFRFGr   )r   r   r!   r"   r#      r   u   1/2 + 3/4·x      u   1 + 2·x + 5/7·x²z1.00z2.2u   1.00 + 2.2·x + 3·x²c                     t        j                  |       }t        j                  d       t        t	        |      |       y r   r   r*   r   r   r+   r   r   r,   s      r    test_numeric_object_coefficientsr     s.     	A	*Qr   )r!   r"   fu   1 + 2·x + f·x²u   1 + 2·x + [3, 4]·x²c                     t        j                  |       }t        j                  d       t        t	        |      |       y)zK
    Test coef fallback for object arrays of non-numeric coefficients.
    r   Nr   r   s      r   #test_nonnumeric_object_coefficientsr   $  s.     	A	*Qr   c                   $    e Zd Zd Zd Zd Zd Zy)
TestFormatc                     t        j                  d       t        j                  g d      }t        t	        |d      d       y )NrY   r!   r"   r   r&   r   u"   1.0 + 2.0·x + 0.0·x² - 1.0·x³r   r   r*   r   formatrn   s     r   test_format_unicodezTestFormat.test_format_unicode2  s0    ##G,OOM*VAy)+OPr   c                     t        j                  d       t        j                  g d      }t        t	        |d      d       y )Nr   r   rY   z!1.0 + 2.0 x + 0.0 x**2 - 1.0 x**3r   rn   s     r   test_format_asciizTestFormat.test_format_ascii7  s3    ##I.OOM*1g C	
r   c                     t        j                  d       t        j                  g d      }t        t	        |      d       t        | d       y )NrY   r    r\   r   rn   s     r   test_empty_formatstrzTestFormat.test_empty_formatstr>  s:    ##G,OOI&VAY 89s56r   c                     t        j                  g d      }t        j                  t              5  t        |d       d d d        y # 1 sw Y   y xY w)Nr   z.2f)r   r*   rP   r   r   r   rn   s     r   test_bad_formatstrzTestFormat.test_bad_formatstrD  s2    OOM*]]:&1e '&&s   AAN)rM   rN   rO   r   r   r   r   rT   r   r   r   r   1  s    Q

7r   r   )r   r   u   1.0 + 2.0·z + 3.0·z²u!   1.0 + 2.0·T₁(z) + 3.0·T₂(z)u!   1.0 + 2.0·H₁(z) + 3.0·H₂(z)u#   1.0 + 2.0·He₁(z) + 3.0·He₂(z)u!   1.0 + 2.0·L₁(z) + 3.0·L₂(z)u!   1.0 + 2.0·P₁(z) + 3.0·P₂(z)c                 8     | g dd      }t        |d|       y )Nr    zsymbolr   )r   )r   r   r,   s      r   test_symbolr   J  s     	Ys#AAg;%r   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestReprc                 `    t        t        j                  ddg            }d}t        ||       y )Nr   r!   zFPolynomial([0., 1.], domain=[-1.,  1.], window=[-1.,  1.], symbol='x'))reprr   r*   r   rK   s      r   test_polynomial_reprzTestRepr.test_polynomial_reprX  s/    4??Aq6*+ 	 	S#r   c                 `    t        t        j                  ddg            }d}t        ||       y )Nr   r!   zEChebyshev([0., 1.], domain=[-1.,  1.], window=[-1.,  1.], symbol='x'))r   r   r2   r   rK   s      r   test_chebyshev_reprzTestRepr.test_chebyshev_repr`  s/    4>>1a&)* 	 	S#r   c                 `    t        t        j                  ddg            }d}t        ||       y )Nr   r!   zDLegendre([0., 1.], domain=[-1.,  1.], window=[-1.,  1.], symbol='x'))r   r   r7   r   rK   s      r   test_legendre_reprzTestRepr.test_legendre_reprh  /    4==!Q() 	 	S#r   c                 `    t        t        j                  ddg            }d}t        ||       y )Nr   r!   zCHermite([0., 1.], domain=[-1.,  1.], window=[-1.,  1.], symbol='x'))r   r   r<   r   rK   s      r   test_hermite_reprzTestRepr.test_hermite_reprp  s/    4<<A'( 	 	S#r   c                 `    t        t        j                  ddg            }d}t        ||       y )Nr   r!   zDHermiteE([0., 1.], domain=[-1.,  1.], window=[-1.,  1.], symbol='x'))r   r   r@   r   rK   s      r   test_hermiteE_reprzTestRepr.test_hermiteE_reprx  r   r   c                 `    t        t        j                  ddg            }d}t        ||       y )Nr   r!   z@Laguerre([0., 1.], domain=[0., 1.], window=[0., 1.], symbol='x'))r   r   rE   r   rK   s      r   test_laguerre_reprzTestRepr.test_laguerre_repr  r   r   N)	rM   rN   rO   r   r   r   r   r   r   rT   r   r   r   r   W  s     r   r   c                   >    e Zd ZdZed        Zd Zd Zd Zd Z	d Z
y)	TestLatexReprz#Test the latex repr used by Jupyterc                 H    dd| _         	 | j                         | ` S # | ` w xY w)Nc                     t        |       S r)   )r+   )xparenss     r   <lambda>z(TestLatexRepr.as_latex.<locals>.<lambda>  s    Qr   )F)_repr_latex_scalar_repr_latex_)objs    r   as_latexzTestLatexRepr.as_latex  s+    
 "@	'##%&&s    !c                    t        j                  g d      }t        | j                  |      d       t        j                  g dddg      }t        | j                  |      d       t        j                  g dddg      }t        | j                  |      d	       t        j                  g dd
dg      }t        | j                  |      d       y )Nr    z%$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$r   rH   zK$x \mapsto 1.0 + 2.0\,\left(1.0 + x\right) + 3.0\,\left(1.0 + x\right)^{2}$            ?zE$x \mapsto 1.0 + 2.0\,\left(2.0x\right) + 3.0\,\left(2.0x\right)^{2}$r&   zQ$x \mapsto 1.0 + 2.0\,\left(1.0 + 2.0x\right) + 3.0\,\left(1.0 + 2.0x\right)^{2}$r   r*   r   r   rn   s     r   test_simple_polynomialz$TestLatexRepr.test_simple_polynomial  s    OOI&T]]1%4	6 OOIr1g6T]]1%Z	\ OOItSk:T]]1%T	V OOIr1g6T]]1%`	br   c                     t        j                  g d      }t        | j                  |      d       t        j                  g dddg      }t        | j                  |      d       y )Nr    z?$x \mapsto 1.0\,{T}_{0}(x) + 2.0\,{T}_{1}(x) + 3.0\,{T}_{2}(x)$r&   r   rH   zZ$x \mapsto 1.0\,{T}_{0}(1.0 + 2.0x) + 2.0\,{T}_{1}(1.0 + 2.0x) + 3.0\,{T}_{2}(1.0 + 2.0x)$)r   r2   r   r   rn   s     r   test_basis_funczTestLatexRepr.test_basis_func  sT    NN9%T]]1%N	P NN9b!W5T]]1%i	kr   c                 h    t        j                  g d      }t        | j                  |      d       y )Nr    zB$x \mapsto 1.0\,{He}_{0}(x) + 2.0\,{He}_{1}(x) + 3.0\,{He}_{2}(x)$)r   r@   r   r   rn   s     r   test_multichar_basis_funcz'TestLatexRepr.test_multichar_basis_func  s'    MM)$T]]1%Q	Sr   c                    t        j                  g dd      }t        | j                  |      d       t        j                  g dddgd      }t        | j                  |      d       t        j                  g dd	d
gd      }t        | j                  |      d       t        j                  g dddgd      }t        | j                  |      d       y )Nr    r   r   z%$z \mapsto 1.0 + 2.0\,z + 3.0\,z^{2}$r   r   )rI   r   zK$z \mapsto 1.0 + 2.0\,\left(1.0 + z\right) + 3.0\,\left(1.0 + z\right)^{2}$r   r   zE$z \mapsto 1.0 + 2.0\,\left(2.0z\right) + 3.0\,\left(2.0z\right)^{2}$r&   zQ$z \mapsto 1.0 + 2.0\,\left(1.0 + 2.0z\right) + 3.0\,\left(1.0 + 2.0z\right)^{2}$r   rn   s     r   test_symbol_basiczTestLatexRepr.test_symbol_basic  s    OOIc2T]]1%4	6 OOIr1gcBMM!-	
 OOItSk#FMM!*	
 OOIr1gcBMM!0	
r   c                     t        t        dd      t        d      g      }t        j                  |      }t	        | j                  |      d       y )Nr!   r"   z$x \mapsto 1/2 + 1\,x$)r   r
   r   r*   r   r   )r   r   r,   s      r   r   z.TestLatexRepr.test_numeric_object_coefficients  s=    x1~x{34OOE"T]]1%'ABr   N)rM   rN   rO   __doc__staticmethodr   r   r   r   r   r   rT   r   r   r   r     s5    -' 'b*kS
"
HCr   r   )z"1.0 + (1.0e-01) x + (1.0e-02) x**2z"1.2 + (1.2e-01) x + (1.2e-02) x**2z11.23 + 0.12 x + (1.23e-02) x**2 + (1.23e-03) x**3z51.235 + 0.123 x + (1.235e-02) x**2 + (1.235e-03) x**3zG1.2346 + 0.1235 x + 0.0123 x**2 + (1.2346e-03) x**3 + (1.2346e-04) x**4zL1.23457 + 0.12346 x + 0.01235 x**2 + (1.23457e-03) x**3 + (1.23457e-04) x**4za1.234568 + 0.123457 x + 0.012346 x**2 + 0.001235 x**3 + (1.234568e-04) x**4 + (1.234568e-05) x**5zg1.2345679 + 0.1234568 x + 0.0123457 x**2 + 0.0012346 x**3 + (1.2345679e-04) x**4 + (1.2345679e-05) x**5c                   b    e Zd ZdZ ej
                  dd      d        Zd Zd Zd Z	d	 Z
d
 Zy)TestPrintOptionsz
    Test the output is properly configured via printoptions.
    The exponential notation is enabled automatically when the values 
    are too small or too large.
    r   Tr   c                 .    t        j                  d       y rX   r   r   s    r   rZ   zTestPrintOptions.use_ascii  r[   r   c                     t        j                  g d      }t        t        |      d       t	        d      5  t        t        |      d       d d d        y # 1 sw Y   y xY w)Nr   g$I$I?gI$Ir?kAgm۶mAzC0.5 + 0.14285714 x + 14285714.28571429 x**2 + (1.42857143e+08) x**3r#   	precisionz40.5 + 0.143 x + 14285714.286 x**2 + (1.429e+08) x**3r   r*   r   r+   r   rn   s     r   test_strzTestPrintOptions.test_str  sM    OO<=SV 7 	8 A&Q "6 7 '&&s   AA!c                     t        j                  g d      }t        |j                         d       t	        d      5  t        |j                         d       d d d        y # 1 sw Y   y xY w)Nr   zp$x \mapsto \text{0.5} + \text{0.14285714}\,x + \text{14285714.28571429}\,x^{2} + \text{(1.42857143e+08)}\,x^{3}$r#   r   za$x \mapsto \text{0.5} + \text{0.143}\,x + \text{14285714.286}\,x^{2} + \text{(1.429e+08)}\,x^{3}$)r   r*   r   r   r   rn   s     r   
test_latexzTestPrintOptions.test_latex  sU    OO<=Q^^%/	0
 A&)KL '&&s   A""A+c                 4   t        j                  dg      }t        t        |      d       t	        d      5  t        t        |      d       d d d        t	        dd      5  t        t        |      d       d d d        y # 1 sw Y   5xY w# 1 sw Y   y xY w)	Nr   z0.5fixed)	floatmodez
0.50000000r   )r   r   z0.5000r   rn   s     r   
test_fixedzTestPrintOptions.test_fixed  so    OOSE"SVU#G,Q. - Gq9Q* :9 -, :9s   B#BBBc           
      2   t        t              D ]t  \  }}t        |      5  t        j                  t        |dz  dz         D cg c]  }dd| z  z   c}      }t        |      j                  dd      |k(  sJ 	 d d d        v y c c}w # 1 sw Y   xY w)Nr   r"   r#   gރB?r}   rt    )	enumerateSWITCH_TO_EXPr   r   r*   ranger+   replace)r   isr,   s       r   test_switch_to_expz#TestPrintOptions.test_switch_to_exp  s    m,DAq*OO.3AqDFm%=.; &0QB%6.;%= >1v~~dC0A555 +* -%= +*s   #BB'BBB	c                    t        j                  t        t        g      }t	        |      dk(  sJ |j                         dk(  sJ t        dd      5  t	        |      dk(  sJ |j                         dk(  sJ 	 d d d        y # 1 sw Y   y xY w)Nznan + inf xz&$x \mapsto \text{nan} + \text{inf}\,x$NANINF)nanstrinfstrzNAN + INF xz&$x \mapsto \text{NAN} + \text{INF}\,x$)r   r*   r   r   r+   r   r   rn   s     r   test_non_finitez TestPrintOptions.test_non_finite!  s    OOS#J'1v&&&~~#LLLLu5q6]***>>#9: : : 655s   &BBN)rM   rN   rO   r   rP   rQ   rZ   r   r   r   r   r   rT   r   r   r   r     sB     V^^'40- 1-7
L+6:r   r   )(mathr   r   rP   numpy._corer   r   r   numpy.polynomial
polynomialr   numpy.testingr   r	   	fractionsr
   decimalr   r   rV   rf   r   r   rR   rS   r   r   r   r   r*   r2   r<   r@   rE   r7   r   r   r   r   r   rT   r   r   <module>r      s     3 3  /  Q QfT Tl?( ?(D
5H )
HQNHQN+6: Aq(1a.!0 GFOWU^Q/v> 
, 

 )
;f%':;
Aq1a&>(*BC, 	 2 	__/0	^^89	\\67	]]9:	]]78	]]78+ &&
/ /dXC XCt38: 8:r   