Hi Guys

was just wondering whether the "algebraic" coercion QQbar --> SR had been 
implemented in any form yet? I certainly cannot trick it into happening! ...

eg I have a matrix in SR and I need its (diagonalization and) normalized 
eigenmatrix - that doesn't seem to work in SR (not that I expected it to!) 
so I change rings to QQbar and it works fine - but then I have a matrix 
over QQbar and I need to recognise the algebraic numbers, and they are not 
very nice ... so it would be great to be able to see them in the usual SR 
format. But if I coerce them explicitly to SR via SR(x?) they remain in the 
format x? and I do not seem to be able to trick them back into their 
original format. I would love any suggestions as to how to do this (other 
than Wolfram Alpha, which abandons ship too quickly ...)

Many thanks

Gary

On Thursday, April 8, 2010 12:05:09 AM UTC+1, Alex Raichev wrote:
>
> Hi all:
>
> I ran into an error trying to evaluate the exponential function at an
> algebraic number.  Looks like there's a bug in substituting algebraic
> numbers for variables; see below.  While i was at it, i tried creating
> the expression QQbar(sqrt(2))*x and got a not implemented error.
> Wasn't symbolics with QQbar working in previous versions of Sage, or
> am i mistaken?
>
> Alex
>
> ----------------------------------------------------------------------
> | Sage Version 4.3.5, Release Date: 2010-03-28                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: exp(QQbar(sqrt(2)))
> 4.11325037878293
> sage: exp(x).subs({x:QQbar(sqrt(2))})
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /Users/arai021/Dropbox/sage_work/<ipython console> in <module>()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression.substitute (sage/
> symbolic/expression.cpp:14851)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression.coerce_in (sage/
> symbolic/expression.cpp:10246)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> parent_old.so in sage.structure.parent_old.Parent._coerce_ (sage/
> structure/parent_old.c:3289)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> parent.so in sage.structure.parent.Parent.coerce (sage/structure/
> parent.c:6826)()
>
> TypeError: no canonical coercion from Algebraic Field to Symbolic Ring
> sage: x.subs({x:QQbar(sqrt(2))})
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /Users/arai021/Dropbox/sage_work/<ipython console> in <module>()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression.substitute (sage/
> symbolic/expression.cpp:14851)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression.coerce_in (sage/
> symbolic/expression.cpp:10246)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> parent_old.so in sage.structure.parent_old.Parent._coerce_ (sage/
> structure/parent_old.c:3289)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> parent.so in sage.structure.parent.Parent.coerce (sage/structure/
> parent.c:6826)()
>
> TypeError: no canonical coercion from Algebraic Field to Symbolic Ring
> sage: QQbar(sqrt(2))*x
> ---------------------------------------------------------------------------
> NotImplementedError                       Traceback (most recent call
> last)
>
> /Users/arai021/Dropbox/sage_work/<ipython console> in <module>()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> element.so in sage.structure.element.RingElement.__mul__ (sage/
> structure/element.c:11337)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op
> (sage/structure/coerce.c:6137)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/structure/
> coerce.so in
> sage.structure.coerce.CoercionModel_cache_maps.canonical_coercion
> (sage/structure/coerce.c:7358)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/categories/
> morphism.so in sage.categories.morphism.CallMorphism._call_ (sage/
> categories/morphism.c:2758)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/rings/
> qqbar.pyc in __call__(self, x)
>     779             return AlgebraicNumber(x._descr)
>     780         elif hasattr(x, '_algebraic_'):
> --> 781             return x._algebraic_(QQbar)
>     782         return AlgebraicNumber(x)
>     783
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression.so in sage.symbolic.expression.Expression._algebraic_ (sage/
> symbolic/expression.cpp:5544)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.pyc in algebraic(ex, field)
>     807         0
>     808     """
> --> 809     return AlgebraicConverter(field)(ex)
>     810
>     811 ##############
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.pyc in __call__(self, ex)
>     206         operator = ex.operator()
>     207         if operator is None:
> --> 208             return self.symbol(ex)
>     209
>     210         if operator in arithmetic_operators:
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/
> expression_conversions.pyc in symbol(self, ex)
>     312             NotImplementedError: symbol
>     313         """
> --> 314         raise NotImplementedError, "symbol"
>     315
>     316     def relation(self, ex, operator):
>
> NotImplementedError: symbol
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to