#NEWLINE# def test_matMul( ) : #NEWLINE# #INDENT# from sympy import MatrixSymbol #NEWLINE# from sympy.printing.latex import LatexPrinter #NEWLINE# A = MatrixSymbol ( 'A' , 5 , 5 ) #NEWLINE# B = MatrixSymbol ( 'B' , 5 , 5 ) #NEWLINE# x = Symbol ( 'x' ) #NEWLINE# l = LatexPrinter ( ) #NEWLINE# assert ( l . _print_MatMul ( ( 2 * A ) ) == '2 A' ) #NEWLINE# assert ( l . _print_MatMul ( ( ( 2 * x ) * A ) ) == '2 x A' ) #NEWLINE# assert ( l . _print_MatMul ( ( ( - 2 ) * A ) ) == '-2 A' ) #NEWLINE# assert ( l . _print_MatMul ( ( 1.5 * A ) ) == '1.5 A' ) #NEWLINE# assert ( l . _print_MatMul ( ( sqrt ( 2 ) * A ) ) == '\\sqrt{2} A' ) #NEWLINE# assert ( l . _print_MatMul ( ( ( - sqrt ( 2 ) ) * A ) ) == '- \\sqrt{2} A' ) #NEWLINE# assert ( l . _print_MatMul ( ( ( ( 2 * sqrt ( 2 ) ) * x ) * x ) ) == '2 \\sqrt{2} x A' ) #NEWLINE# assert ( l . _print_MatMul ( ( ( ( - 2 ) * A ) * ( A + ( 2 * B ) ) ) ) in [ '-2 A \\left(A + 2 B\\right)' , '-2 A \\left(2 B + A\\right)' ] )