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

Problem with Singular output for Maple 8 and later
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1482
Page 1 of 1

Author:  Ablamowicz [ Sat Dec 10, 2005 11:44 pm ]
Post subject:  Problem with Singular output for Maple 8 and later

I am trying to call Singular 3-0-1 from Maple 8 and return result back to Maple 8. Problem is that when Singular writes to a text file that later will be read into Maple, it ends its output with a symbol that looks like [] in Notepad. Then, when using Maple's read command, Maple returns

on line 1, unexpected end of input

Error, while reading `C:/Maple8/Out.txt`

If I open my Out.txt file manually and replace that symbol with ; then Maple has no problem reading the file. I have written my version of SINGULARlink in maple 8 programming language based on a procedure from pages 546-547 in "A Singular Introduction to Commutative Algebra"

Does anyone have any suggestions how to get Singular to write ; instead of [] in its output file? I know very little how Singular works and would appreciate some suggestions how to modify its output.

Thanks.

Rafal Ablamowicz
[email protected]

Author:  hannes [ Mon Dec 19, 2005 11:26 am ]
Post subject:  Re: Problem with Singular output for Maple

This is probably a problem with
line endings on Windows:
Windows uses control-m control-j (rn) as end of line.
Singular writes file in Unix mode:
control-j (n) as end of line
(it uses binary mode for opening files).
An explanation is given at:
http://cygwin.com/faq/faq.api.html#faq.api.cr-lf

Author:  wienand [ Mon Dec 19, 2005 11:58 am ]
Post subject: 

You can use the tools

dos2unix and unix2dos

to change the line endings of files between the Windows and Unix ways.

Author:  hannes [ Mon Dec 19, 2005 12:02 pm ]
Post subject:  fopen mode on windows

Singular uses ftell/fseek,
so binary mode (unix line endings)
are needed for input files.
But for output files,
we will change the mode to
DOS-compatible in the next release.

Author:  Guest [ Mon Dec 19, 2005 4:40 pm ]
Post subject:  A well working fix to this problem for Maple 8, 9, and 10

Thank you to all for replying and suggesting a fix. I have found my own fix too: while Maple 8's "read" command produces the error I have described, Maple 8's "readline" command doesn't. So I am reading in output file Out.txt produced by Singular (both, 2-3-1 and 3-1-0) into Maple 8 without any problems now. It is read line by line and then put together.

I have now a very well working procedure that produces a link between Maple 8 - it also works in Maple 9, 9.5, and 10 - and either version of Singular for the purpose of computing Groebner basis in Singular and bringing it back into Maple. It is based somewhat on a similar procedure for connecting with Maple V in the "SINGULAR..." book. If anyone would be interested to try it, I would be glad to emila it or post it here, if it would be of interest to this group.

Thanks.

Rafal Ablamowicz

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