Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem with Singular output for Maple 8 and later
PostPosted: Sat Dec 10, 2005 11:44 pm 

Joined: Sat Dec 10, 2005 11:39 pm
Posts: 1
Location: Tennessee Technological University
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]


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with Singular output for Maple
PostPosted: Mon Dec 19, 2005 11:26 am 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 19, 2005 11:58 am 
Site Admin

Joined: Fri Apr 29, 2005 12:02 am
Posts: 24
Location: Germany, Kaiserslautern
You can use the tools

dos2unix and unix2dos

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: fopen mode on windows
PostPosted: Mon Dec 19, 2005 12:02 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: A well working fix to this problem for Maple 8, 9, and 10
PostPosted: Mon Dec 19, 2005 4:40 pm 
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


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 11:03 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group