I suppose the same issue applies to other common functions, such as
the sine function.
Alex
----------------------------------------------------------------------
| Sage Version 3.4, Release Date: 2009-03-11 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: sin(QQbar(2))
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/arai021/<ipython console> in <module>()
/Applications/sage/local/lib/python2.5/site-packages/sage/calculus/
calculus.pyc in __call__(self, x)
8124 if isinstance(x, float):
8125 return math.sin(x)
-> 8126 return SymbolicComposition(self, SR(x))
8127
8128 sin = Function_sin()
/Applications/sage/local/lib/python2.5/site-packages/sage/calculus/
calculus.pyc in __call__(self, x)
504 msg, s, pos = err.args
505 raise TypeError, "%s: %s !!! %s" % (msg, s
[:pos], s[pos:])
--> 506 return self._coerce_impl(x)
507
508 def _coerce_impl(self, x):
/Applications/sage/local/lib/python2.5/site-packages/sage/calculus/
calculus.pyc in _coerce_impl(self, x)
566 return self(x._sage_())
567 else:
--> 568 raise TypeError, "cannot coerce type '%s' into a
SymbolicExpression."%type(x)
569
570 def _repr_(self):
TypeError: cannot coerce type '<class
'sage.rings.qqbar.AlgebraicNumber'>' into a SymbolicExpression.
On Mar 21, 12:54 am, Burcin Erocal <[email protected]> wrote:
> On Thu, 19 Mar 2009 20:22:18 -0700 (PDT)
>
> AlexRaichev<[email protected]> wrote:
>
> > Here's another one for you,Burcin...
>
> Thanks. I am really glad you're trying things out. This use case hadn't
> occured to me at all. Good catch.
>
>
>
> > sage: var('n',ns=1)
> > n
> > sage: (QQbar(2)^3)^n
> > ---------------------------------------------------------------------------
> > TypeError Traceback (most recent call
> > last)
>
> <snip>
> > TypeError: no canonical coercion from New Symbolic Ring to Rational
> > Field
>
> Since pynac now supports using arbitrary Sage objects in symbolic
> expressions, it is possible to coerce QQbar(2) to the new symbolic
> ring. So we should really return a symbolic expression, but this case
> is not treated since the maxima backed symbolics didn't support this.
>
> Unfortunately, the __pow__ method, the function that handles
> exponentiation in python, is not a part of the coercion system. This
> makes it hard to implement this functionality in a general way.
>
> I've made this issue #5574 on trac. You can follow the progress here:
>
> http://trac.sagemath.org/sage_trac/ticket/5574
>
> Thanks again.
>
> Cheers,Burcin
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---