Hi William,

On Jan 15, 9:39 am, William Stein <[email protected]> wrote:
> Why don't you improve the singular pexpect interface so it can write
> output to a file that Sage reads in, then see if that helps?

For four reasons:
- Because I don't know how Singular can write into a file without
appending (it seems awkward to me to let Sage delete the file before
Singular writes into it)

- Because I don't know how to get a reasonable threshold for whether
or not a file should be used (mind that Singular just thinks it would
output a polynomial on screen, so, I can not simply ask how long the
string is, since there is no string from Singular's perspective)

- Because I am using the interface rather explicitly, so, it could as
well be a fault in my way of using it.

And actually the third reason seems to be it. Let p be a polynomial
defined in Singular. I did singular.eval('p') to get a string
representation. It should work, and it did most of the time, but
apparently not always. Now, I changed it into singular.eval('string
(p)'), and the error disappeared (at least so far...), and
singular.eval('print(p)') seemed to work as well.

One more reason:
- It seems that the interface does take care of it. Namely, if
P=singular('p'), then P.__repr__() relies on P.parent().get(), and
this returns singular.eval('print(%s);'%var), not singular.eval(var).
Probably the intention was to avoid nasty output for ideals (if P was
an ideal, 'sage83496[1]=x^2' may be the result of singular.eval(var),
while singular.eval('print(%s)'%var) yields 'x^2'), but at the same
time it avoids the problem into which I was running.


On the other hand, the infrastructure is already there! There is the
method Expect.get_using_file(self,var), that by default returns
self.get(var). So, it would be easy to implement, for each individual
interface.

Cheers,
Simon
-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to