Ask Your Question

visor841's profile - activity

2016-07-20 15:40:12 +0200 received badge  Supporter (source)
2016-07-20 15:40:11 +0200 received badge  Scholar (source)
2016-07-20 15:40:01 +0200 commented answer Singular objects break after using in Sage

Ah, this makes so much sense. Defining my own singular interface instance is a much better idea. Thanks.

2016-07-20 09:08:44 +0200 received badge  Student (source)
2016-07-20 03:45:46 +0200 asked a question Singular objects break after using in Sage

I don't understand why this code breaks:

R1 = singular.ring('(0,a)','(x,y)','dp')
f1 = singular('x^2')
g1 = singular('x')
fsage = f1.sage()
gsage = g1.sage()
print(f1)
print(g1)
print(fsage)
print(gsage)
g2 = fsage.reduce(gsage)
print(g2)
print(f1)

It gives this result:

x^2
x
x^2
x
0
Traceback (most recent call last):    print(g1)
  File "", line 1, in <module>

  File "/tmp/tmpO7_2ph/___code___.py", line 13, in <module>
    exec compile(u'print(f1)
  File "", line 1, in <module>

  File "/home/sage/sage-7.2/local/lib/python2.7/site-packages/sage/interfaces/singular.py", line 1318, in __repr__
    elif self.type() == 'matrix':
  File "/home/sage/sage-7.2/local/lib/python2.7/site-packages/sage/interfaces/singular.py", line 2059, in type
    return m.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

f1 prints fine the first time, but after running the reduce, it seems like it no longer exists. I'm trying to use f1 for other things after doing a reduce, but can't seem to find any way to do it.