ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 08 Oct 2018 00:24:06 +0200Characteristic polynomial of symbolic matrix of size 7https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/There is a problem when computing the characteristic polynomial of a matrix of size greater than 7 containing a large number of symbolic variables.
<pre><code>a = SR.var('a', 100)
M = identity_matrix(SR, 7)
for i in range(7):
for j in range(7):
M[i,j] = a[i*7+j]
print(M.charpoly().degree()) # prints 5
</code></pre>
The value it should print is 7. Over $\mathbb{Z}[a_0,a_1,\dots]$, the result is correct.
I use Sage 8.3 (Release Date: 2018-08-03), installed from the official repository of Archlinux. The bug is present both in command line and with `sage file.sage` (if I copy and paste the code above).Sat, 06 Oct 2018 08:04:49 +0200https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/Answer by tmonteil for <p>There is a problem when computing the characteristic polynomial of a matrix of size greater than 7 containing a large number of symbolic variables.</p>
<pre><code>a = SR.var('a', 100)
M = identity_matrix(SR, 7)
for i in range(7):
for j in range(7):
M[i,j] = a[i*7+j]
print(M.charpoly().degree()) # prints 5
</code></pre>
<p>The value it should print is 7. Over $\mathbb{Z}[a_0,a_1,\dots]$, the result is correct.</p>
<p>I use Sage 8.3 (Release Date: 2018-08-03), installed from the official repository of Archlinux. The bug is present both in command line and with <code>sage file.sage</code> (if I copy and paste the code above).</p>
https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?answer=43847#post-id-43847It works for me (Sage 8.4.beta7 complied on Debian stretch 64bit, run from the command line).
Could you please give us some informations so that someone can try to reproduce your problem:
- which version of Sage did you use ?
- which OS ?
- did you install Sage from the binaries, and which ones ?
- did you compile Sage yourself ?
- which notebook did you use (Sage notebook or jupyter notebook) ?
- did you use the command line ?
- which commands did you type precisely to get the error ?
- which error message did you get ?
- ... ?
**EDIT** thanks for reporting, it seems to be an issue with Archlinux port, since it works well on Sage Cell which also ships 8.3:
http://sagecell.sagemath.org/?z=eJxlzkEKwjAQheF9IHeYXRMNoa4CgkfIpl2WIoONdYomYQzF3t7YrdvvwePPTLGoNfCbUlRaSyEFwgX6zq7IqsHGwKltq_uqNIVYqGzXFxamj-o7A65u98RAQBEY4xyU02cpAH66_CmAH8gsY73DgQ7uuIxS5D3D29sDOafnprSdwswh7ElfMdUuww==&lang=sage
**Second EDIT**: this is now [trac ticket 26427](https://trac.sagemath.org/ticket/26427), i will contact Archlinux devs about that issue.Sat, 06 Oct 2018 12:57:52 +0200https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?answer=43847#post-id-43847Comment by ScreenName for <p>It works for me (Sage 8.4.beta7 complied on Debian stretch 64bit, run from the command line). </p>
<p>Could you please give us some informations so that someone can try to reproduce your problem: </p>
<ul>
<li>which version of Sage did you use ?</li>
<li>which OS ?</li>
<li>did you install Sage from the binaries, and which ones ?</li>
<li>did you compile Sage yourself ?</li>
<li>which notebook did you use (Sage notebook or jupyter notebook) ?</li>
<li>did you use the command line ?</li>
<li>which commands did you type precisely to get the error ?</li>
<li>which error message did you get ?</li>
<li>... ?</li>
</ul>
<p><strong>EDIT</strong> thanks for reporting, it seems to be an issue with Archlinux port, since it works well on Sage Cell which also ships 8.3:</p>
<p><a href="http://sagecell.sagemath.org/?z=eJxlzkEKwjAQheF9IHeYXRMNoa4CgkfIpl2WIoONdYomYQzF3t7YrdvvwePPTLGoNfCbUlRaSyEFwgX6zq7IqsHGwKltq_uqNIVYqGzXFxamj-o7A65u98RAQBEY4xyU02cpAH66_CmAH8gsY73DgQ7uuIxS5D3D29sDOafnprSdwswh7ElfMdUuww==&lang=sage">http://sagecell.sagemath.org/?z=eJxlz...</a></p>
<p><strong>Second EDIT</strong>: this is now <a href="https://trac.sagemath.org/ticket/26427">trac ticket 26427</a>, i will contact Archlinux devs about that issue.</p>
https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?comment=43851#post-id-43851I added information in the original post. I tried to install the 8.4 beta7 version but it failed.Sun, 07 Oct 2018 07:03:05 +0200https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?comment=43851#post-id-43851Answer by arojas for <p>There is a problem when computing the characteristic polynomial of a matrix of size greater than 7 containing a large number of symbolic variables.</p>
<pre><code>a = SR.var('a', 100)
M = identity_matrix(SR, 7)
for i in range(7):
for j in range(7):
M[i,j] = a[i*7+j]
print(M.charpoly().degree()) # prints 5
</code></pre>
<p>The value it should print is 7. Over $\mathbb{Z}[a_0,a_1,\dots]$, the result is correct.</p>
<p>I use Sage 8.3 (Release Date: 2018-08-03), installed from the official repository of Archlinux. The bug is present both in command line and with <code>sage file.sage</code> (if I copy and paste the code above).</p>
https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?answer=43853#post-id-43853Hi,
This should be fixed now with pynac 0.7.22-5Sun, 07 Oct 2018 19:09:26 +0200https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?answer=43853#post-id-43853Comment by tmonteil for <p>Hi,
This should be fixed now with pynac 0.7.22-5</p>
https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?comment=43856#post-id-43856Thanks for the clarification !Mon, 08 Oct 2018 00:24:06 +0200https://ask.sagemath.org/question/43839/characteristic-polynomial-of-symbolic-matrix-of-size-7/?comment=43856#post-id-43856