o 6a= @sbddlZddlmZmZmZddlmZddlm Z m Z ddl m Z ddl mZGdddZGdd d ZGd d d Zd d ZddZejdee dde ddgeddfedde ddgeddfeededdgeddffddZejdegdedd feddddggedd!ffd"d#ZGd$d%d%ZGd&d'd'ZGd(d)d)ZdS)*N)arrayarange printoptions) assert_equalassert_)Fraction)Decimalc@ZeZdZejdddddZejdgddfgd d fed d ffd dZ ejdgddfgd dfed dffddZ ejdgddfgd dfed dffddZ ejdgddfgd dfed dffddZ ejdgddfgd dfed d ffd!d"Z ejdgdd#fgd d$fed d%ffd&d'Zd(S))TestStrUnicodeSuperSubscriptsclassTscopeautousecCtddSNunicodepolyset_default_printstyleselfrF/usr/lib/python3/dist-packages/numpy/polynomial/tests/test_printing.py use_unicode z)TestStrUnicodeSuperSubscripts.use_unicodeinptgt1.0 + 2.0·x¹ + 3.0·x²rr!r$u%-1.0 + 0.0·x¹ + 3.0·x² - 1.0·x³ u0.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¹¹cCtt|}t||dSNstrr Polynomialrrrrresrrrtest_polynomial_strz1TestStrUnicodeSuperSubscripts.test_polynomial_str!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)u0.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)cCr&r'r)r Chebyshevrr+rrrtest_chebyshev_strr.z0TestStrUnicodeSuperSubscripts.test_chebyshev_stru!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)u0.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)cCr&r'r)rLegendrerr+rrrtest_legendre_str'r.z/TestStrUnicodeSuperSubscripts.test_legendre_stru!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)u0.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)cCr&r'r)rHermiterr+rrrtest_hermite_str2r.z.TestStrUnicodeSuperSubscripts.test_hermite_stru#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)u0.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)cCr&r'r)rHermiteErr+rrrtest_hermiteE_str= z/TestStrUnicodeSuperSubscripts.test_hermiteE_stru!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)u0.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)cCr&r'r)rLaguerrerr+rrrtest_laguerre_strIr.z/TestStrUnicodeSuperSubscripts.test_laguerre_strN)__name__ __module__ __qualname__pytestfixturermark parametrizerr-r2r5r8r;r?rrrrr sN                         r c@r )) TestStrAsciir Tr cCrNasciirrrrr use_asciiWrzTestStrAscii.use_asciirr1.0 + 2.0 x**1 + 3.0 x**2r#z%-1.0 + 0.0 x**1 + 3.0 x**2 - 1.0 x**3r%z0.0 + 1.0 x**1 + 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**11cCr&r'r(r+rrrr-[r.z TestStrAscii.test_polynomial_str1.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)cCr&r'r0r+rrrr2fr<zTestStrAscii.test_chebyshev_strz1.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)cCr&r'r3r+rrrr5rr<zTestStrAscii.test_legendre_strz1.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)cCr&r'r6r+rrrr8~r<zTestStrAscii.test_hermite_strz1.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)cCr&r'r9r+rrrr;r<zTestStrAscii.test_hermiteE_strz1.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)cCr&r'r=r+rrrr?r<zTestStrAscii.test_laguerre_strN)r@rArBrCrDrJrErFrr-r2r5r8r;r?rrrrrGUsN                         rGc@sXeZdZejdddddZddZdd Zd d Zd d Z ej ddddZ dS)TestLinebreakingr Tr cCrrHrrrrrrJrzTestLinebreaking.use_asciicC2tgd}ttt|dtt|ddS)N)[rOrOrJzJ123456789.0 + 123456789.0 x**1 + 123456789.0 x**2 + 1234.0 x**3 + 1.0 x**4rr*rlenr)rprrrtest_single_line_one_less z*TestLinebreaking.test_single_line_one_lesscCrN)N)rOrOrOrP KzK123456789.0 + 123456789.0 x**1 + 123456789.0 x**2 + 1234.0 x**3 + 10.0 x**4rRrTrrrtest_num_chars_is_linewidthrWz,TestLinebreaking.test_num_chars_is_linewidthcCs<tgd}ttt|dddtt|ddS)N)rOrOrOr%rrO rrQz[123456789.0 + 123456789.0 x**1 + 123456789.0 x**2 + 12.0 x**3 + 1.0 x**4 + 123456789.0 x**5)rr*rrSr)splitrTrrr6test_first_linebreak_multiline_one_less_than_linewidthszGTestLinebreaking.test_first_linebreak_multiline_one_less_than_linewidthcCs tgd}tt|ddS)N)rOrOrO{rrOz\123456789.0 + 123456789.0 x**1 + 123456789.0 x**2 + 123.0 x**3 + 1.0 x**4 + 123456789.0 x**5)rr*rr)rTrrr+test_first_linebreak_multiline_on_linewidths zrzTestRepr.test_chebyshev_strcCr)Nrrz4Legendre([0., 1.], domain=[-1, 1], window=[-1, 1]))rrr4rrrrrtest_legendre_reprCrzTestRepr.test_legendre_reprcCr)Nrrz3Hermite([0., 1.], domain=[-1, 1], window=[-1, 1]))rrr7rrrrrtest_hermite_reprHrzTestRepr.test_hermite_reprcCr)Nrrz4HermiteE([0., 1.], domain=[-1, 1], window=[-1, 1]))rrr:rrrrrtest_hermiteE_reprMrzTestRepr.test_hermiteE_reprcCr)Nrrz0Laguerre([0., 1.], domain=[0, 1], window=[0, 1]))rrr>rrrrrtest_laguerre_reprRrzTestRepr.test_laguerre_reprN) r@rArBr-r2rrrrrrrrr8s rc@s0eZdZdZddZddZddZdd Zd S) TestLatexReprz#Test the latex repr used by JupytercCs dd|_z|W|`S|`w)NcSst|Sr')r))xrrr_sz(TestLatexRepr.as_latex..)_repr_latex_scalar _repr_latex_)robjrrras_latex[s  zTestLatexRepr.as_latexcCstgd}t||dtjgdddgd}t||dtjgdddgd}t||d tjgdd dgd}t||d dS) Nrz%$x \mapsto 1.0 + 2.0\,x + 3.0\,x^{2}$rdomainzK$x \mapsto 1.0 + 2.0\,\left(1.0 + x\right) + 3.0\,\left(1.0 + x\right)^{2}$gg?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}$)rr*rrrTrrrtest_simple_polynomiales     z$TestLatexRepr.test_simple_polynomialcCsHtgd}t||dtjgdddgd}t||ddS)Nrz?$x \mapsto 1.0\,{T}_{0}(x) + 2.0\,{T}_{1}(x) + 3.0\,{T}_{2}(x)$r$rrzZ$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)$)rr1rrrTrrrtest_basis_funczs  zTestLatexRepr.test_basis_funccCs"tgd}t||ddS)NrzB$x \mapsto 1.0\,{He}_{0}(x) + 2.0\,{He}_{1}(x) + 3.0\,{He}_{2}(x)$)rr:rrrTrrrtest_multichar_basis_funcs z'TestLatexRepr.test_multichar_basis_funcN)r@rArB__doc__rrrrrrrrrXs   r)rC numpy.corerrrnumpy.polynomial polynomialr numpy.testingrr fractionsrdecimalrr rGrMrkrrrErFrnrxrzr{rrrrrrs>   JNB