Print matrix with determinant brackets

60 views
Skip to first unread message

PG

unread,
May 9, 2015, 10:41:35 PM5/9/15
to sy...@googlegroups.com
Hi,

If I have

m = Matrix([ [ 1, 2 ], [ 3, 4 ] ])

how can I latex m so it is printed as a determinant:

\begin{vmatrix}
1 & 2\\ 
3 & 4
\end{vmatrix}

Many thanks in advance,

PG

Jason Moore

unread,
May 10, 2015, 1:06:43 AM5/10/15
to sy...@googlegroups.com
You can subclass the LatexPrinter and override this method: https://github.com/sympy/sympy/blob/master/sympy/printing/latex.py#L1299 to create your custom printer.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/46633e2a-d020-48b8-b5c4-1441b474052f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Meurer

unread,
May 10, 2015, 1:19:33 PM5/10/15
to sy...@googlegroups.com
Try using Determinant from sympy.matrices.expressions.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/CAP7f1AjQu4%2Bxsv8JPWae2kQWRzJ-B0bSPX84DSyyopqQTrwJzw%40mail.gmail.com.

PG

unread,
May 11, 2015, 7:55:03 AM5/11/15
to sy...@googlegroups.com
Hi, here's what worked for me:

latex(Determinant(A), mat_delim='')
Reply all
Reply to author
Forward
0 new messages