#NEWLINE# def test_latex_sequences( ) : #NEWLINE# #INDENT# s1 = SeqFormula ( ( a ** 2 ) , ( 0 , oo ) ) #NEWLINE# s2 = SeqPer ( ( 1 , 2 ) ) #NEWLINE# latex_str = '\\left\\[0, 1, 4, 9, \\ldots\\right\\]' #NEWLINE# assert ( latex ( s1 ) == latex_str ) #NEWLINE# latex_str = '\\left\\[1, 2, 1, 2, \\ldots\\right\\]' #NEWLINE# assert ( latex ( s2 ) == latex_str ) #NEWLINE# s3 = SeqFormula ( ( a ** 2 ) , ( 0 , 2 ) ) #NEWLINE# s4 = SeqPer ( ( 1 , 2 ) , ( 0 , 2 ) ) #NEWLINE# latex_str = '\\left\\[0, 1, 4\\right\\]' #NEWLINE# assert ( latex ( s3 ) == latex_str ) #NEWLINE# latex_str = '\\left\\[1, 2, 1\\right\\]' #NEWLINE# assert ( latex ( s4 ) == latex_str ) #NEWLINE# s5 = SeqFormula ( ( a ** 2 ) , ( ( - oo ) , 0 ) ) #NEWLINE# s6 = SeqPer ( ( 1 , 2 ) , ( ( - oo ) , 0 ) ) #NEWLINE# latex_str = '\\left\\[\\ldots, 9, 4, 1, 0\\right\\]' #NEWLINE# assert ( latex ( s5 ) == latex_str ) #NEWLINE# latex_str = '\\left\\[\\ldots, 2, 1, 2, 1\\right\\]' #NEWLINE# assert ( latex ( s6 ) == latex_str ) #NEWLINE# latex_str = '\\left\\[1, 3, 5, 11, \\ldots\\right\\]' #NEWLINE# assert ( latex ( SeqAdd ( s1 , s2 ) ) == latex_str ) #NEWLINE# latex_str = '\\left\\[1, 3, 5\\right\\]' #NEWLINE# assert ( latex ( SeqAdd ( s3 , s4 ) ) == latex_str ) #NEWLINE# latex_str = '\\left\\[\\ldots, 11, 5, 3, 1\\right\\]' #NEWLINE# assert ( latex ( SeqAdd ( s5 , s6 ) ) == s3 ) #NEWLINE# latex_str = '\\left\\[0, 2, 4, 18, \\ldots\\right\\]' #NEWLINE# assert ( latex ( SeqMul ( s1 , s2 ) ) == latex_str ) #NEWLINE# latex_str = '\\left\\[0, 2, 4\\right\\]' #NEWLINE# assert ( latex ( SeqMul ( s3 , s4 ) ) == latex_str ) #NEWLINE# latex_str = '\\left\\[\\ldots, 18, 4, 2, 0\\right\\]' #NEWLINE# assert ( latex ( SeqMul ( s5 , s6 ) ) == latex_str )