File: matrix_latex.py

package info (click to toggle)
sympy 0.7.5-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,576 kB
  • ctags: 27,948
  • sloc: python: 213,240; xml: 359; makefile: 117; sh: 53; lisp: 4
file content (28 lines) | stat: -rwxr-xr-x 542 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python

from __future__ import print_function

from sympy import symbols, Matrix
from sympy.galgebra import xdvi
from sympy.galgebra import Format

def main():
    Format()
    a = Matrix( 2, 2, ( 1, 2, 3, 4 ) )
    b = Matrix( 2, 1, ( 5, 6 ) )
    c = a * b
    print(a, b, '=', c)

    x, y = symbols( 'x, y' )

    d = Matrix( 1, 2, ( x ** 3, y ** 3 ))
    e = Matrix( 2, 2, ( x ** 2, 2 * x * y, 2 * x * y, y ** 2 ) )
    f = d * e

    print('%', d, e, '=', f)

    xdvi()
    return

if __name__ == "__main__":
    main()