Singular
https://www.singular.uni-kl.de/forum/

Bug: Read/write error n Singular
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1814
Page 1 of 1

Author:  petermj [ Thu Mar 25, 2010 1:27 am ]
Post subject:  Bug: Read/write error n Singular

Dear group members,

Until now, I never saw any bugs in Singular, just errors (in earlier versions)
when memory ran out.

Sorry I could not test this under the latest version, which I only recently saw --
using the latest Ubuntu, the 4th step in the installation failed (maybe this also
is a bug, but I can only do sudo and do not have full root permissions). Later,
I will try some other method. The command and error messages were:

sudo dpkg -i Singular-release.deb; apt-get update

Selecting previously deselected package singular-release.
(Reading database ... 135970 files and directories currently installed.)
Unpacking singular-release (from Singular-release.deb) ...
Setting up singular-release (3.1.1-1) ...
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock the list directory


The real bug is in the code that follows: Singular writes to a file but finds
an error when reading what it just wrote. In my experience, this bug appears
only rarely. Sorry that the file below showing this problem is a ittle long.
By the way, this comes from trying to find new knot invariants.

I have also encountered strange behaviour where a file can be read but differs
from (and can be much larger than) what was written to it, but this could have
been a side effect of other things done during busy sessions and at the moment
I cannot supply an example.

Greetings,
Peter Johnson
Recife, Brazil


==================================================================

/* SINGULAR v3-1-0 (interactive) under Ubuntu (Karmic) on a PC (c2009);
/* See ERROR after ideal rez. */

option(redSB);

ring rr = 0,(o,j,k,l,m,n,p,q,r,s,t,u,v,w,x,y,z,
J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z),dp;

ideal rez = /* 94 */
xX-1,sS-1,sR+uR-rS+uS-rU-sU,rR+xR-rS-rU-sU+rX,
nP-qP-sP+xP+pR-pS-pU+pX,qN+sN-nQ-sQ-nS+qS,
pN+rP-sP-uP+xP-pQ-pS+pX,nN+xN-nQ-sQ-nS+nX,oNX-oQX+oRX-oUX,
onX+orX,NRU+NSU-QSU+RSU-QU2-SU2,oQU+oU2+oQX+oUX,
oNU+oRU+oQX+oUX,orU,oqU,opU+nU+uU+xU+uX,
RS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QX+PRX+PUX+PX2,oU3,oSU2,oRU2,oPU2,oS2U,
oRSU,oPSU+QSU+S2U+QU2+SU2,oR2U,oPRU,oR2S,oPRS+QSU+S2U+QU2+SU2,
oP2S-PRS+PS2+PQU-PRU+5PSU+3PU2,oR3,oP2R+oP2U+PRS+PRU-PSU-PU2,
oP2Q+oP2U,o2xQ+o2xU-o2qX-o2uX+uN-rQ+qR-nU,
o2qQ+o2uU+o2qX+o2uX-uN-qQ-xQ-qR-uU-xU-qX-uX,
o2S2X+oPS2+2oPSX+S3+NQU-R2U+NSU+3QSU-2RSU+2S2U+2QU2+2SU2+NQX
+NSX+QSX+RSX+RUX+SUX+SX2,o3rQ+o3nU+o3qX+o3uX-ouN-orQ-oxQ-oqR
-onU-oxU-oqX-ouX,o3uN+o3qR+o3qX+o3uX-2ouN-oxQ-2oqR-oxU-oqX-ouX;


write("rez","ideal rz = ",rez,";");
< "rez"; interred(rez-rz);
/* OK, can write this ideal to a file and then read it. BUT why not .. */

ideal grez = groebner(rez); size(grez); /* 166, takes about 10 minutes */
write("grez","ideal grez = ",grez,";"); /* file size only 4K */
< "grez"; /* **** ERROR **** when reading this ideal ?! */

/* I have, only in recent months, had a few other similar errors. */

Author:  seelisch [ Mon Mar 29, 2010 2:09 pm ]
Post subject:  Re: Bug: Read/write error n Singular

Hello,

you may want to give the following a try:
write("MPfile:grezFile.mp", grez);
def j=read("MPfile:grezFile.mp");
The manual says at the page for the command "write",
http://www.singular.uni-kl.de/Manual/3- ... htm#SEC356
that for large objects, the MP format and MPfile links may work better.

Regards,
Frank

Author:  petermj [ Tue Mar 30, 2010 1:20 am ]
Post subject:  Re: Bug: Read/write error n Singular

Hello again,

Just to clarify: the ideal written but not read properly, for some reason I do
not understand, takes about 10 minutes to generate but is tiny - only 4KB!
Writing and reading files up to about 20MB usually works well for me.

I am trying to report what seems to be an elusive bug in Singular and would like
some independent confirmation (or not - maybe this is system-dependent).

- Peter Johnson

Author:  seelisch [ Tue Mar 30, 2010 11:31 am ]
Post subject:  Re: Bug: Read/write error n Singular

Ok, sorry for bothering you with manual stuff...
I found the problem: Somewhere in the content of "grez" appears the reserved name 'or':

? error occurred in or before x.txt line 48: `3qS-qU-2sU+xU-nX+4qX,nqX2-nS-qS-2sU+uU+2xU+nX+2qX+uX,n2X2-nR-3nS+qS-2sU+xU+3nX`
? expected ideal-expression. type 'help ideal;'
? last reserved name was `or`
skipping text from `,`

I am sure that's the problem. So, maybe you are able to change the variable names, or more easily, use "short = 0" to enforce the usage of "*" and "^" when the ideal is written to the file. This should help when re-reading the file contents.

Regards,
Frank

Author:  petermj [ Thu Apr 01, 2010 12:23 am ]
Post subject:  Re: Bug: Read/write error n Singular

Thanks to Frank for pointing out what went wrong. The error message was in this case sufficiently clear, and I should not have posted so hastily. But I am not sure if the result of processing a short monomial that happens to be a reserved word (although not in a place that would make any sense) should be regarded as a bug or a feature, so will post a remark about this in the "Features for the future" section.

- Peter Johnson

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/