Well, here's what i tried and it doesn't seem to work after I build sage again. I added this code to the to_sage() function, elif cls_str == "Divide": self_Div = self div_Numerator = macaulay2('numerator self_Div') div_Denominator = macaulay2('denominator self_Div') div_Numerator = div_Numerator.sage_polystring() div_Denominator = div_Denominator.sage_polystring() sage_Div = div_Numerator/div_Denominator return sage_Div
I added this after the main else statement. The code looks like rubbish to me but I didn't know what else to do, so i thought I'd show something and ask for improvements, if that's okay... When running the following code now in Sage, here is my error message: sage: macaulay2.eval(""" ....: K = toField(QQ[zet]/(zet^8 - zet^7 +zet^5 - zet^4 +zet^3 -zet + 1)) ....: A=matrix{{zet^1,0},{0,zet^14}} ....: needsPackage "InvariantRing" ....: G=generateGroup({A},K) ....: P = molienSeries G ....: """) K PolynomialRing | zet 0 | | 0 -zet^7+zet^6-zet^4+zet^3-zet^2+1 | 2 2 Matrix K <--- K InvariantRing Package {| 1 0 |, | -zet^7-zet^2 0 |, | zet^7 0 |, | zet^7-zet^6-zet^3+zet^2-1 0 |, | -zet^7+zet^6-zet^4+zet^3-zet^2+1 0 |, | zet 0 |, | -zet^6-zet 0 |, | zet^5 0 |, | zet^2 0 |, | zet^6 0 |, | zet^7-zet^5+zet^4-zet^3+zet-1 0 |, | zet^4 0 |, | -zet^7 +zet^5-zet^4-zet+1 0 |, | zet^3 0 |, | -zet^5-1 0 |} | 0 1 | | 0 zet^3 | | 0 zet^7-zet^5+zet^4-zet^3+zet-1 | | 0 zet^6 | | 0 zet | | 0 -zet^7+zet^6-zet^4+zet^3-zet^2+1 | | 0 zet^4 | | 0 - zet^5-1 | | 0 -zet^7+zet^5-zet^4-zet+1 | | 0 zet^7-zet^6-zet^3+zet ^2-1 | | 0 zet^7 | | 0 -zet^6-zet | | 0 zet^2 | | 0 -zet^7-zet^2 | | 0 zet^5 | List 2 3 4 5 6 7 8 9 10 11 12 13 14 1 - T + T - T + T - T + T - T + T - T + T - T + T - T + T --------------------------------------------------------------------------- 2 3 4 5 7 8 2 2 3 4 (1 - T) (1 - T + T - T + T - T + T )(1 + T + T )(1 + T + T + T + T ) Expression of class Divide sage: G = macaulay2('P').to_sage() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/saad/sage/local/lib/python2.7/site-packages/sage/all_cmdline.pyc in <module>() ----> 1 G = macaulay2('P').to_sage() /home/saad/sage/local/lib/python2.7/site-packages/sage/interfaces/macaulay2.pyc in to_sage(self) 1151 elif cls_str == "Divide": 1152 self_Div = self -> 1153 div_Numerator = macaulay2('numerator self_Div') 1154 div_Denominator = macaulay2('denominator self_Div') 1155 div_Numerator = div_Numerator.sage_polystring() /home/saad/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, x, name) 241 242 if isinstance(x, six.string_types): --> 243 return cls(self, x, name=name) 244 try: 245 return self._coerce_from_special_method(x) /home/saad/sage/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc in __init__(self, parent, value, is_name, name) 1379 except (RuntimeError, ValueError) as x: 1380 self._session_number = -1 -> 1381 raise_(TypeError, x, sys.exc_info()[2]) 1382 except BaseException: 1383 self._session_number = -1 /home/saad/sage/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc in __init__(self, parent, value, is_name, name) 1374 else: 1375 try: -> 1376 self._name = parent._create(value, name=name) 1377 # Convert ValueError and RuntimeError to TypeError for 1378 # coercion to work properly. /home/saad/sage/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in _create(self, value, name) 431 def _create(self, value, name=None): 432 name = self._next_var_name() if name is None else name --> 433 self.set(name, value) 434 return name 435 /home/saad/sage/local/lib/python2.7/site-packages/sage/interfaces/macaulay2.pyc in set(self, var, value) 318 ans = Expect.eval(self, cmd) 319 if ans.find("stdio:") != -1: --> 320 raise RuntimeError("Error evaluating Macaulay2 code.\nIN:%s\nOUT:%s"%(cmd, ans)) 321 322 def _object_class(self): TypeError: Error evaluating Macaulay2 code. IN:sage1=numerator self_Div; OUT:stdio:13:7:(3): error: no method found for applying numerator to: argument : self (of class IndexedVariable) Div It's certainly a different error message from what I was getting before when I tried this, but i don't know what it means. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.