Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You could make the coercion explicit:

sage: var('a')
a
sage: (a*3).substitute(a=AA(2))    
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[...]
TypeError: no canonical coercion from Algebraic Real Field to Symbolic Ring
sage: (a*3).substitute(a=SR(AA(2)))
6

or work in a polynomial ring over AA:

sage: R.<a,b,c> = AA[]
sage: R
Multivariate Polynomial Ring in a, b, c over Algebraic Real Field
sage: a*3
3*a
sage: (a*3).subs(a=2)
6
sage: parent((a*3).subs(a=2))
Algebraic Real Field
sage: parent((a*3).subs(a=AA(2)))
Algebraic Real Field