Hi. I think that I have come across a bug in sage.calculus.calculus.SymbolicArithmetic.substitute_over_ring
The first three examples below work, but the fourth does not. It seems that sage can coerce Integers(10)(3) into a symbolic expression, but only when it is passed as a keyword argument. I'm not sure what is going on here, but when R = Integers(10), an explicit conversion such as SymbolicExpressionRing(R(3)) does not work either (I'm not claiming that it should). I think that is why the fourth example below doesn't work. I don't know how the third example does work, however. sage: R = Integers(10) sage: x = var('x') sage: expression = 3*x sage: expression.substitute_over_ring(x=3,ring=R) 9 sage: expression.substitute_over_ring(3,ring=R) 9 sage: expression.substitute_over_ring(x=R(3),ring=R) 9 sage: expression.substitute_over_ring(R(3),ring=R) --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/bober/math/talof/<ipython console> in <module>() /home/bober/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py in substitute_over_ring(self, in_dict, ring, **kwds) 2052 def substitute_over_ring(self, in_dict=None, ring=None, **kwds): 2053 X = self.simplify() -> 2054 kwds = self.__parse_in_dict(in_dict, kwds) 2055 kwds = self.__varify_kwds(kwds) 2056 if ring is None: /home/bober/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py in __parse_in_dict(self, in_dict, kwds) 2034 if len(kwds) > 0: 2035 raise ValueError, "you must not both give the variable and specify it explicitly when doing a substitution." -> 2036 in_dict = SR(in_dict) 2037 vars = self.variables() 2038 #if len(vars) > 1: /home/bober/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py in __call__(self, x) 313 elif hasattr(x, '_symbolic_'): 314 return x._symbolic_(self) --> 315 return self._coerce_impl(x) 316 317 def _coerce_impl(self, x): /home/bober/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py in _coerce_impl(self, x) 342 return evaled_symbolic_expression_from_maxima_string('%s+%%i*%s'%(x.real,x.imag)) 343 else: --> 344 raise TypeError, "cannot coerce type '%s' into a SymbolicExpression."%type(x) 345 346 def _repr_(self): <type 'exceptions.TypeError'>: cannot coerce type '<type 'sage.rings.integer_mod.IntegerMod_int'>' into a SymbolicExpression. sage: --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---