#NEWLINE# def test_latex_functions( ) : #NEWLINE# #INDENT# assert ( latex ( exp ( x ) ) == 'e^{x}' ) #NEWLINE# assert ( latex ( ( exp ( 1 ) + exp ( 2 ) ) ) == 'e + e^{2}' ) #NEWLINE# f = Function ( 'f' ) #NEWLINE# assert ( latex ( f ( x ) ) == 'f{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( f ) == 'f' ) #NEWLINE# g = Function ( 'g' ) #NEWLINE# assert ( latex ( g ( x , y ) ) == 'g{\\left (x,y \\right )}' ) #NEWLINE# assert ( latex ( g ) == 'g' ) #NEWLINE# h = Function ( 'h' ) #NEWLINE# assert ( latex ( h ( x , y , z ) ) == 'h{\\left (x,y,z \\right )}' ) #NEWLINE# assert ( latex ( h ) == 'h' ) #NEWLINE# Li = Function ( 'Li' ) #NEWLINE# assert ( latex ( Li ) == '\\operatorname{Li}' ) #NEWLINE# assert ( latex ( Li ( x ) ) == '\\operatorname{Li}{\\left (x \\right )}' ) #NEWLINE# beta = Function ( 'beta' ) #NEWLINE# assert ( latex ( beta ( x ) ) == '\\beta{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( beta ) == '\\beta' ) #NEWLINE# a1 = Function ( 'a_1' ) #NEWLINE# assert ( latex ( a1 ) == '\\operatorname{a_{1}}' ) #NEWLINE# assert ( latex ( a1 ( x ) ) == '\\operatorname{a_{1}}{\\left (x \\right )}' ) #NEWLINE# omega1 = Function ( 'omega1' ) #NEWLINE# assert ( latex ( omega1 ) == '\\omega_{1}' ) #NEWLINE# assert ( latex ( omega1 ( x ) ) == '\\omega_{1}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( sin ( x ) ) == '\\sin{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( sin ( x ) , fold_func_brackets = True ) == '\\sin {x}' ) #NEWLINE# assert ( latex ( sin ( ( 2 * ( x ** 2 ) ) ) , fold_func_brackets = True ) == '\\sin {2 x^{2}}' ) #NEWLINE# assert ( latex ( sin ( ( x ** 2 ) ) , fold_func_brackets = True ) == '\\sin {x^{2}}' ) #NEWLINE# assert ( latex ( ( asin ( x ) ** 2 ) ) == '\\operatorname{asin}^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( asin ( x ) ** 2 ) , inv_trig_style = 'full' ) == '\\arcsin^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( asin ( x ) ** 2 ) , inv_trig_style = 'power' ) == '\\sin^{-1}{\\left (x \\right )}^{2}' ) #NEWLINE# assert ( latex ( asin ( ( x ** 2 ) ) , inv_trig_style = 'power' , fold_func_brackets = True ) == '\\sin^{-1} {x^{2}}' ) #NEWLINE# assert ( latex ( factorial ( k ) ) == 'k!' ) #NEWLINE# assert ( latex ( factorial ( ( - k ) ) ) == '\\left(- k\\right)!' ) #NEWLINE# assert ( latex ( subfactorial ( k ) ) == '!k' ) #NEWLINE# assert ( latex ( subfactorial ( ( - k ) ) ) == '!\\left(- k\\right)' ) #NEWLINE# assert ( latex ( factorial2 ( k ) ) == 'k!!' ) #NEWLINE# assert ( latex ( factorial2 ( ( - k ) ) ) == '\\left(- k\\right)!!' ) #NEWLINE# assert ( latex ( binomial ( 2 , k ) ) == '{\\binom{2}{k}}' ) #NEWLINE# assert ( latex ( FallingFactorial ( 3 , k ) ) == '{\\left(3\\right)}_{k}' ) #NEWLINE# assert ( latex ( RisingFactorial ( 3 , k ) ) == '{3}^{\\left(k\\right)}' ) #NEWLINE# assert ( latex ( floor ( x ) ) == '\\lfloor{x}\\rfloor' ) #NEWLINE# assert ( latex ( ceiling ( x ) ) == '\\lceil{x}\\rceil' ) #NEWLINE# assert ( latex ( Min ( x , 2 , ( x ** 3 ) ) ) == '\\min\\left(2, x, x^{3}\\right)' ) #NEWLINE# assert ( latex ( ( Min ( x , y ) ** 2 ) ) == '\\min\\left(x, y\\right)^{2}' ) #NEWLINE# assert ( latex ( Max ( x , 2 , ( x ** 3 ) ) ) == '\\max\\left(2, x, x^{3}\\right)' ) #NEWLINE# assert ( latex ( ( Max ( x , y ) ** 2 ) ) == '\\max\\left(x, y\\right)^{2}' ) #NEWLINE# assert ( latex ( Abs ( x ) ) == '\\left|{x}\\right|' ) #NEWLINE# assert ( latex ( re ( x ) ) == '\\Re{x}' ) #NEWLINE# assert ( latex ( re ( ( x + y ) ) ) == '\\Re{x} + \\Re{y}' ) #NEWLINE# assert ( latex ( im ( x ) ) == '\\Im{x}' ) #NEWLINE# assert ( latex ( conjugate ( x ) ) == '\\overline{x}' ) #NEWLINE# assert ( latex ( gamma ( x ) ) == '\\Gamma{\\left(x \\right)}' ) #NEWLINE# w = Wild ( 'w' ) #NEWLINE# assert ( latex ( gamma ( w ) ) == '\\Gamma{\\left(w \\right)}' ) #NEWLINE# assert ( latex ( Order ( x ) ) == '\\mathcal{O}\\left(x\\right)' ) #NEWLINE# assert ( latex ( Order ( x , x ) ) == '\\mathcal{O}\\left(x\\right)' ) #NEWLINE# assert ( latex ( Order ( x , ( x , 0 ) ) ) == '\\mathcal{O}\\left(x\\right)' ) #NEWLINE# assert ( latex ( Order ( x , ( x , oo ) ) ) == '\\mathcal{O}\\left(x; x\\rightarrow \\infty\\right)' ) #NEWLINE# assert ( latex ( Order ( ( x - y ) , ( x , y ) ) ) == '\\mathcal{O}\\left(x - y; x\\rightarrow y\\right)' ) #NEWLINE# assert ( latex ( Order ( x , x , y ) ) == '\\mathcal{O}\\left(x; \\left ( x, \\quad y\\right )\\rightarrow \\left ( 0, \\quad 0\\right )\\right)' ) #NEWLINE# assert ( latex ( Order ( x , x , y ) ) == '\\mathcal{O}\\left(x; \\left ( x, \\quad y\\right )\\rightarrow \\left ( 0, \\quad 0\\right )\\right)' ) #NEWLINE# assert ( latex ( Order ( x , ( x , oo ) , ( y , oo ) ) ) == '\\mathcal{O}\\left(x; \\left ( x, \\quad y\\right )\\rightarrow \\left ( \\infty, \\quad \\infty\\right )\\right)' ) #NEWLINE# assert ( latex ( lowergamma ( x , y ) ) == '\\gamma\\left(x, y\\right)' ) #NEWLINE# assert ( latex ( uppergamma ( x , y ) ) == '\\Gamma\\left(x, y\\right)' ) #NEWLINE# assert ( latex ( cot ( x ) ) == '\\cot{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( coth ( x ) ) == '\\coth{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( re ( x ) ) == '\\Re{x}' ) #NEWLINE# assert ( latex ( im ( x ) ) == '\\Im{x}' ) #NEWLINE# assert ( latex ( root ( x , y ) ) == 'x^{\\frac{1}{y}}' ) #NEWLINE# assert ( latex ( arg ( x ) ) == '\\arg{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( zeta ( x ) ) == '\\zeta\\left(x\\right)' ) #NEWLINE# assert ( latex ( zeta ( x ) ) == '\\zeta\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( zeta ( x ) ** 2 ) ) == '\\zeta^{2}\\left(x\\right)' ) #NEWLINE# assert ( latex ( zeta ( x , y ) ) == '\\zeta\\left(x, y\\right)' ) #NEWLINE# assert ( latex ( ( zeta ( x , y ) ** 2 ) ) == '\\zeta^{2}\\left(x, y\\right)' ) #NEWLINE# assert ( latex ( dirichlet_eta ( x ) ) == '\\eta\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( dirichlet_eta ( x ) ** 2 ) ) == '\\eta^{2}\\left(x\\right)' ) #NEWLINE# assert ( latex ( polylog ( x , y ) ) == '\\operatorname{Li}_{x}\\left(y\\right)' ) #NEWLINE# assert ( latex ( ( polylog ( x , y ) ** 2 ) ) == '\\operatorname{Li}_{x}^{2}\\left(y\\right)' ) #NEWLINE# assert ( latex ( lerchphi ( x , y , n ) ) == '\\Phi\\left(x, y, n\\right)' ) #NEWLINE# assert ( latex ( ( lerchphi ( x , y , n ) ** 2 ) ) == '\\Phi^{2}\\left(x, y, n\\right)' ) #NEWLINE# assert ( latex ( elliptic_k ( z ) ) == 'K\\left(z\\right)' ) #NEWLINE# assert ( latex ( ( elliptic_k ( z ) ** 2 ) ) == 'K^{2}\\left(z\\right)' ) #NEWLINE# assert ( latex ( elliptic_f ( x , y ) ) == 'F\\left(x\\middle| y\\right)' ) #NEWLINE# assert ( latex ( ( elliptic_f ( x , y ) ** 2 ) ) == 'F^{2}\\left(x\\middle| y\\right)' ) #NEWLINE# assert ( latex ( elliptic_e ( x , y ) ) == 'E\\left(x\\middle| y\\right)' ) #NEWLINE# assert ( latex ( ( elliptic_e ( x , y ) ** 2 ) ) == 'E^{2}\\left(x\\middle| y\\right)' ) #NEWLINE# assert ( latex ( elliptic_e ( z ) ) == 'E\\left(z\\right)' ) #NEWLINE# assert ( latex ( ( elliptic_e ( z ) ** 2 ) ) == 'E^{2}\\left(z\\right)' ) #NEWLINE# assert ( latex ( elliptic_pi ( x , y , z ) ) == '\\Pi\\left(x; y\\middle| z\\right)' ) #NEWLINE# assert ( latex ( ( elliptic_pi ( x , y , z ) ** 2 ) ) == '\\Pi^{2}\\left(x; y\\middle| z\\right)' ) #NEWLINE# assert ( latex ( elliptic_pi ( x , y ) ) == '\\Pi\\left(x\\middle| y\\right)' ) #NEWLINE# assert ( latex ( ( elliptic_pi ( x , y ) ** 2 ) ) == '\\Pi^{2}\\left(x\\middle| y\\right)' ) #NEWLINE# assert ( latex ( Ei ( x ) ) == '\\operatorname{Ei}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( Ei ( x ) ** 2 ) ) == '\\operatorname{Ei}^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( expint ( x , y ) ** 2 ) ) == '\\operatorname{E}_{x}^{2}\\left(y\\right)' ) #NEWLINE# assert ( latex ( ( Shi ( x ) ** 2 ) ) == '\\operatorname{Shi}^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( Si ( x ) ** 2 ) ) == '\\operatorname{Si}^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( Ci ( x ) ** 2 ) ) == '\\operatorname{Ci}^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( ( Chi ( x ) ** 2 ) ) == '\\operatorname{Chi}^{2}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( Chi ( x ) ) == '\\operatorname{Chi}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( jacobi ( n , a , b , x ) ) == 'P_{n}^{\\left(a,b\\right)}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( jacobi ( n , a , b , x ) ** 2 ) ) == '\\left(P_{n}^{\\left(a,b\\right)}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( gegenbauer ( n , a , x ) ) == 'C_{n}^{\\left(a\\right)}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( gegenbauer ( n , a , x ) ** 2 ) ) == '\\left(C_{n}^{\\left(a\\right)}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( chebyshevt ( n , x ) ) == 'T_{n}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( chebyshevt ( n , x ) ** 2 ) ) == '\\left(T_{n}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( chebyshevu ( n , x ) ) == 'U_{n}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( chebyshevu ( n , x ) ** 2 ) ) == '\\left(U_{n}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( legendre ( n , x ) ) == 'P_{n}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( legendre ( n , x ) ** 2 ) ) == '\\left(P_{n}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( assoc_legendre ( n , a , x ) ) == 'P_{n}^{\\left(a\\right)}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( assoc_legendre ( n , a , x ) ** 2 ) ) == '\\left(P_{n}^{\\left(a\\right)}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( laguerre ( n , x ) ) == 'L_{n}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( laguerre ( n , x ) ** 2 ) ) == '\\left(L_{n}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( assoc_laguerre ( n , a , x ) ) == 'L_{n}^{\\left(a\\right)}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( assoc_laguerre ( n , a , x ) ** 2 ) ) == '\\left(L_{n}^{\\left(a\\right)}\\left(x\\right)\\right)^{2}' ) #NEWLINE# assert ( latex ( hermite ( n , x ) ) == 'H_{n}\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( hermite ( n , x ) ** 2 ) ) == '\\left(H_{n}\\left(x\\right)\\right)^{2}' ) #NEWLINE# theta = Symbol ( 'theta' , real = True ) #NEWLINE# phi = Symbol ( 'phi' , real = True ) #NEWLINE# assert ( latex ( Ynm ( n , m , theta , phi ) ) == 'Y_{n}^{m}\\left(\\theta,\\phi\\right)' ) #NEWLINE# assert ( latex ( ( Ynm ( n , m , theta , phi ) ** 3 ) ) == '\\left(Y_{n}^{m}\\left(\\theta,\\phi\\right)\\right)^{3}' ) #NEWLINE# assert ( latex ( Znm ( n , m , theta , phi ) ) == 'Z_{n}^{m}\\left(\\theta,\\phi\\right)' ) #NEWLINE# assert ( latex ( ( Znm ( n , m , theta , phi ) ** 3 ) ) == '\\left(Z_{n}^{m}\\left(\\theta,\\phi\\right)\\right)^{3}' ) #NEWLINE# assert ( latex ( polar_lift ( 0 ) ) == '\\operatorname{polar\\_lift}{\\left (0 \\right )}' ) #NEWLINE# assert ( latex ( ( polar_lift ( 0 ) ** 3 ) ) == '\\operatorname{polar\\_lift}^{3}{\\left (0 \\right )}' ) #NEWLINE# assert ( latex ( totient ( n ) ) == '\\phi\\left( n \\right)' ) #NEWLINE# assert ( latex ( divisor_sigma ( x ) ) == '\\sigma\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( divisor_sigma ( x ) ** 2 ) ) == '\\sigma^{2}\\left(x\\right)' ) #NEWLINE# assert ( latex ( divisor_sigma ( x , y ) ) == '\\sigma_y\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( divisor_sigma ( x , y ) ** 2 ) ) == '\\sigma^{2}_y\\left(x\\right)' ) #NEWLINE# assert ( latex ( udivisor_sigma ( x ) ) == '\\sigma^*\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( udivisor_sigma ( x ) ** 2 ) ) == '\\sigma^*^{2}\\left(x\\right)' ) #NEWLINE# assert ( latex ( udivisor_sigma ( x , y ) ) == '\\sigma^*_y\\left(x\\right)' ) #NEWLINE# assert ( latex ( ( udivisor_sigma ( x , y ) ** 2 ) ) == '\\sigma^*^{2}_y\\left(x\\right)' ) #NEWLINE# fjlkd = Function ( 'fjlkd' ) #NEWLINE# assert ( latex ( fjlkd ( x ) ) == '\\operatorname{fjlkd}{\\left (x \\right )}' ) #NEWLINE# assert ( latex ( f ) == '\\operatorname{fjlkd}' )