Print huge matrix - notebook: WARNING: Output truncated!

757 views
Skip to first unread message

Jakob Lombacher

unread,
May 10, 2011, 11:26:42 AM5/10/11
to sage-support
Hi,

I've got a ugly matrix, that elements consists of huge symbolic
expressions.
When I try to print it via "view(H)" I get the message WARNING: Output
truncated! .... full_output.txt

By clicking on full_output.txt I get some text file, looking like html
but it doesn't seem complete and the browser doesn't render it.

How can I have a look at this Matrix with nice typesetting?

Thanks

Jakob

kcrisman

unread,
May 10, 2011, 12:08:48 PM5/10/11
to sage-support
Dear Jakob,

Thanks for your question. You may find
http://ask.sagemath.org/question/469/how-do-i-display-the-full-output-that-includes
helpful in this regard. Please let us know if that doesn't help.

- kcrisman

kcrisman

unread,
May 10, 2011, 2:08:59 PM5/10/11
to sage-support
sage: M = matrix(50)
sage:
sage: M
50 x 50 dense matrix over Integer Ring (type 'print M.str()' to see
all of the entries)
sage: M.str()
<all the entries>

This answers you immediately preceding question. But I don't think
that will look nice in the html.

latex(M) gives what you are looking for, except for the headers and
putting it in math mode, so that is not quite it, and

f = open('my.html','w')
f.write(latex(M))
f.close()

won't do it either, nor does

html(latex(M))

show(M)

should view it, and gives a correct html, but for some reason the
jsmath is not rendering it on the other page.

I'm sorry that none of these seem to work right. Hopefully someone
just a little more conversant with how to make the notebook do this
will pipe up.

+++
Your reply to previous message:

I tried, but I couldn't figure out how to get my Matrix as a string so
I could write
f.write(M.toString())

Which function is responsible for the string representation?

I've also tried to rename full_output.txt to full_output.html but this
hasn't worked either.


Jakob

On May 10, 12:08 pm, kcrisman <kcris...@gmail.com> wrote:
> Dear Jakob,
>
> Thanks for your question.  You may findhttp://ask.sagemath.org/question/469/how-do-i-display-the-full-output...

kcrisman

unread,
May 10, 2011, 2:11:24 PM5/10/11
to sage-support

John H Palmieri

unread,
May 10, 2011, 3:03:41 PM5/10/11
to sage-s...@googlegroups.com

This is not the perfect solution, but you can try looking at pieces of the matrix: execute

  view(M.submatrix(3,4,5,5))

for the 5x5 submatrix starting at row 3, column 4.

Another option is

  view(M, viewer='pdf').

This should pop open a separate window (indeed, a separate program, whatever's suitable on your OS for viewing a pdf file) with the whole output.

--
John

Jakob Lombacher

unread,
May 11, 2011, 7:38:40 AM5/11/11
to sage-support
Thanks for your advice.

My solution for the time until its fixed is:


from sage.misc.latex import latex_extra_preamble
latex.extra_preamble('')
latex.add_to_preamble('\\usepackage[margin=2cm,a4paper,landscape]
{geometry}')
latex.add_to_preamble('\\textwidth 0cm')
latex.extra_preamble()

view(dP.factor().submatrix(0,0,4,1),engine=pdflatex, tiny=true,
viewer='pdf')

Jakob

Wilfried Huss

unread,
May 11, 2011, 8:23:43 AM5/11/11
to sage-s...@googlegroups.com

Something like this

html(r'<div class="notruncate">')
view(H)
html(r'</div>')

should also work.

--
Wilfried

Reply all
Reply to author
Forward
0 new messages