
    H/PhUS                     n   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                            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                            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                            d#e
j        d$fe
j        d%fe
j        d&fe
j         d'fe
j!        d(fe
j"        d)ff          d*             Z# G d+ d,          Z$ G d- d.          Z%d/Z& G d0 d1          Z'dS )2    )naninfN)arrayarangeprintoptions)assert_equalassert_)Fraction)Decimalc                      e Zd Z ej        dd          d             Zej                            dg ddfg dd	f ed
          dff          d             Z	ej                            dg ddfg ddf ed
          dff          d             Z
ej                            dg ddfg ddf ed
          dff          d             Zej                            dg ddfg ddf ed
          dff          d             Zej                            dg ddfg ddf ed
          dff          d             Zej                            dg ddfg ddf ed
          dff          d              Zd! Zd"S )#TestStrUnicodeSuperSubscriptsclassTscopeautousec                 .    t          j        d           d S Nunicodepolyset_default_printstyleselfs    d/var/www/html/test/jupyter/venv/lib/python3.11/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                 l    t          j        |          }t          |          }t          ||           d S N)r   
Polynomialstrr   )r   r   r   press        r   test_polynomial_strz1TestStrUnicodeSuperSubscripts.test_polynomial_str   s4     OC  !ff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                 h    t          t          j        |                    }t          ||           d S r)   r+   r   	Chebyshevr   r   r   r   r-   s       r   test_chebyshev_strz0TestStrUnicodeSuperSubscripts.test_chebyshev_str   s1     $.%%&&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                 h    t          t          j        |                    }t          ||           d S r)   r+   r   Legendrer   r3   s       r   test_legendre_strz/TestStrUnicodeSuperSubscripts.test_legendre_str)   1     $-$$%%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                 h    t          t          j        |                    }t          ||           d S r)   r+   r   Hermiter   r3   s       r   test_hermite_strz.TestStrUnicodeSuperSubscripts.test_hermite_str4   s1     $,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                 h    t          t          j        |                    }t          ||           d S r)   r+   r   HermiteEr   r3   s       r   test_hermiteE_strz/TestStrUnicodeSuperSubscripts.test_hermiteE_str?   1     $-$$%%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                 h    t          t          j        |                    }t          ||           d S 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          ||           d S )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   sq    $/1a&))**S#$/1a&!Q8889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00/ / 10/ [^	-.	>?	 $ 	&.    
 [^	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                            dg ddfg dd	f ed
          dff          d             Z	ej                            dg ddfg ddf ed
          dff          d             Z
ej                            dg ddfg ddf ed
          dff          d             Zej                            dg ddfg ddf ed
          dff          d             Zej                            dg ddfg ddf ed
          dff          d             Zej                            dg ddfg ddf ed
          dff          d              Zd! Zd"S )#TestStrAsciir   Tr   c                 .    t          j        d           d S 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                 h    t          t          j        |                    }t          ||           d S r)   rJ   r3   s       r   r.   z TestStrAscii.test_polynomial_stre   s1     $/#&&''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                 h    t          t          j        |                    }t          ||           d S r)   r1   r3   s       r   r4   zTestStrAscii.test_chebyshev_strp   s1     $.%%&&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                 h    t          t          j        |                    }t          ||           d S 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                 h    t          t          j        |                    }t          ||           d S r)   r;   r3   s       r   r=   zTestStrAscii.test_hermite_str   s1     $,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                 h    t          t          j        |                    }t          ||           d S 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                 h    t          t          j        |                    }t          ||           d S 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          ||           d S )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   sq    $/1a&))**S#$/1a&!Q8889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00- - 10- [^	,-	=>	 ; 	=.     [^	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
                            d	d
          d             ZdS )TestLinebreakingr   Tr   c                 .    t          j        d           d S rX   r   r   s    r   rZ   zTestLinebreaking.use_ascii   r[   r   c                     t          j        g d          }t          t          t	          |                    d           t          t	          |          d           d S )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   s]    OIIIJJSQ[["%%%SVV+	 	 	 	 	r   c                     t          j        g d          }t          t          t	          |                    d           t          t	          |          d           d S )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   s]    OJJJKKSQ[["%%%SVV-	 	 	 	 	r   c                     t          j        g d          }t          t          t	          |                              d          d                   d           t          t	          |          d           d S )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   sv    OEEE  	SQd++A.//444SVV<	 	 	 	 	r   c                 l    t          j        g d          }t          t          |          d           d S )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   sG    OHHH  	SVV=	 	 	 	 	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                 J   t          j        g d          }t          |          5  t          t	          |          |           t	          |                              d          D ]"}t          t          |          |k                #	 d d d            d S # 1 swxY w Y   d S )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     OGGG
 
 B''' 	( 	(Q%%%AT** ( (D		B''''(	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(s   A#BBBN)rM   rN   rO   rP   rQ   rZ   ro   rr   rv   rx   rR   rS   r   rT   r   r   rf   rf      s        V^'4000- - 10-    	 	 	   [] 
- 
 
( (
 
( ( (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            d S # 1 swxY w Y   d S )	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yyy!!A(((Q1222Q8999	***Q2333Q<===	z	"	" 5 5#O4445 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s   "DDDc                     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           d	S )
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33	4	4B	***RFGGGRGHHH(((REFFFRFGGGG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	          |          |           d S 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	          |          |           dS )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dS )
TestFormatc                     t          j        d           t          j        g d          }t          t	          |d          d           d S )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  sG    #G,,,OMMM**VAy))+OPPPPPr   c                     t          j        d           t          j        g d          }t          t	          |d          d           d S )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  sR    #I...OMMM**1g C	
 	
 	
 	
 	
r   c                     t          j        d           t          j        g d          }t          t	          |          d           t          | d           d S )NrY   r    r\   r   rn   s     r   test_empty_formatstrzTestFormat.test_empty_formatstr>  sV    #G,,,OIII&&VAYY 8999V566666r   c                     t          j        g d          }t          j        t                    5  t          |d           d d d            d S # 1 swxY w Y   d S )Nr   z.2f)r   r*   rP   r   r   r   rn   s     r   test_bad_formatstrzTestFormat.test_bad_formatstrD  s    OMMM**]:&& 	 	1e	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAN)rM   rN   rO   r   r   r   r   rT   r   r   r   r   1  sS        Q Q Q

 
 
7 7 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                 H     | g dd          }t          |d|           d S )Nr    zsymbolr   )r   )r   r   r,   s      r   test_symbolr   J  s6     	YYYs###AA%%%%%r   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TestReprc                 p    t          t          j        ddg                    }d}t          ||           d S )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                 p    t          t          j        ddg                    }d}t          ||           d S )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                 p    t          t          j        ddg                    }d}t          ||           d S )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                 p    t          t          j        ddg                    }d}t          ||           d S )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                 p    t          t          j        ddg                    }d}t          ||           d S )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                 p    t          t          j        ddg                    }d}t          ||           d S )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  sn                      r   r   c                   F    e Zd ZdZed             Zd Zd Zd Zd Z	d Z
dS )	TestLatexReprz#Test the latex repr used by Jupyterc                 P    dd| _         	 |                                 | ` S # | ` w xY w)NFc                      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  sB    
 "@!?!?	'##%%&&&&&&&s   ! %c                    t          j        g d          }t          |                     |          d           t          j        g dddg          }t          |                     |          d           t          j        g dddg          }t          |                     |          d	           t          j        g dd
dg          }t          |                     |          d           d S )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   OIII&&T]]1%%4	6 	6 	6 OIIIr1g666T]]1%%Z	\ 	\ 	\ OIIItSk:::T]]1%%T	V 	V 	V OIIIr1g666T]]1%%`	b 	b 	b 	b 	br   c                     t          j        g d          }t          |                     |          d           t          j        g dddg          }t          |                     |          d           d S )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  s    N999%%T]]1%%N	P 	P 	P N999b!W555T]]1%%i	k 	k 	k 	k 	kr   c                 x    t          j        g d          }t          |                     |          d           d S )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  sG    M)))$$T]]1%%Q	S 	S 	S 	S 	Sr   c                    t          j        g dd          }t          |                     |          d           t          j        g dddgd          }t          |                     |          d           t          j        g dd	d
gd          }t          |                     |          d           t          j        g dddgd          }t          |                     |          d           d S )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   OIIIc222T]]1%%4	6 	6 	6 OIIIr1gcBBBMM!-	
 	
 	
 OIIItSk#FFFMM!*	
 	
 	
 OIIIr1gcBBBMM!0	
 	
 	
 	
 	
r   c                     t          t          dd          t          d          g          }t          j        |          }t	          |                     |          d           d S )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  sT    x1~~x{{344OE""T]]1%%'ABBBBBr   N)rM   rN   rO   __doc__staticmethodr   r   r   r   r   r   rT   r   r   r   r     s        --' ' \'b b b*k k kS S S
"
 "
 "
HC C C C 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                   f    e Zd ZdZ ej        dd          d             Zd Zd Zd Z	d	 Z
d
 ZdS )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           d S 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            d S # 1 swxY w Y   d S )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  s    O<<<==SVV 7 	8 	8 	8 A&&& 	7 	7Q "6 7 7 7	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   A//A36A3c                    t          j        g d          }t          |                                d           t	          d          5  t          |                                d           d d d            d S # 1 swxY w Y   d S )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  s    O<<<==Q^^%%/	0 	0 	0
 A&&& 	L 	L))KL L L	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	Ls   	#A99A= A=c                    t          j        dg          }t          t          |          d           t	          d          5  t          t          |          d           d d d            n# 1 swxY w Y   t	          dd          5  t          t          |          d           d d d            d S # 1 swxY w Y   d S )	Nr   z0.5fixed)	floatmodez
0.50000000r   )r   r   z0.5000r   rn   s     r   
test_fixedzTestPrintOptions.test_fixed  s4   OSE""SVVU###G,,, 	/ 	/Q...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ Gq999 	+ 	+Q***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s$   A--A14A1	B44B8;B8c           	      @   t          t                    D ]\  }}t          |          5  t          j        d t          |dz  dz             D                       }t          |                              dd          |k    sJ 	 d d d            n# 1 swxY w Y   d S )Nr   c                      g | ]}d d| z  z  S )gރB?r}   rT   ).0is     r   
<listcomp>z7TestPrintOptions.test_switch_to_exp.<locals>.<listcomp>  s3     %= %= %=)* &0QB%6 %= %= %=r   r"   r#   rt    )	enumerateSWITCH_TO_EXPr   r   r*   ranger+   replace)r   r   sr,   s       r   test_switch_to_expz#TestPrintOptions.test_switch_to_exp  s    m,, 	6 	6DAq*** 6 6O %= %=.3AqDFmm%= %= %= > >1vv~~dC00A555556 6 6 6 6 6 6 6 6 6 6 6 6 6 6	6 	6s   ABB	B	c                 X   t          j        t          t          g          }t	          |          dk    sJ |                                dk    sJ t          dd          5  t	          |          dk    sJ |                                dk    sJ 	 d d d            d S # 1 swxY w Y   d S )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    OS#J''1vv&&&&~~#LLLLLu555 	: 	:q66]****>>##9: : : : :	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s   !0BB#&B#N)rM   rN   rO   r   rP   rQ   rZ   r   r   r   r   r   rT   r   r   r   r     s          V^'4000- - 10-7 7 7
L 
L 
L+ + +6 6 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 3 3 3 3 3 3 3 3       / / / / / / / /            Q Q Q Q Q Q Q QfT T T T T T T Tl?( ?( ?( ?( ?( ?( ?( ?(D
5 
5 
5H H H )
UHHQNNHHQNN+6::: UAq((1a..!000 UGGFOOWWU^^Q/v>>> 
, 
 
 
 
 )
U;;;f%%%':;
UAq1a&>(((*BC,   	        2 	_/0	^89	\67	]9:	]78	]78+  & & &
/ / / / / / / /dXC XC XC XC XC XC XC XCt38: 8: 8: 8: 8: 8: 8: 8: 8: 8:r   