On Jun 10, 2009, at 7:40 AM, Maurizio wrote:
>
> This used to work in SAGE 3.x
> I'm using SAGE 4.0.1 now
>
> sage: ciccio = {'x':10}
> sage: a = 2*x + 5
> sage: a
> 2*x + 5
> sage: a.subs(ciccio)
> ----------------------------------------------------------------------
> -----
> TypeError Traceback (most recent call
> last)
>
> /home/nslabs/.sage/<ipython console> in <module>()
>
> /home/nslabs/Desktop/sage-4.0.1-linux-Ubuntu_9.04-sse2-i686-Linux/
> local/lib/python2.5/site-packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression.substitute (sage/symbolic/
> expression.cpp:13696)()
>
> /home/nslabs/Desktop/sage-4.0.1-linux-Ubuntu_9.04-sse2-i686-Linux/
> local/lib/python2.5/site-packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression.coerce_in (sage/symbolic/
> expression.cpp:9740)()
>
> /home/nslabs/Desktop/sage-4.0.1-linux-Ubuntu_9.04-sse2-i686-Linux/
> local/lib/python2.5/site-packages/sage/structure/parent_old.so in
> sage.structure.parent_old.Parent._coerce_ (sage/structure/
> parent_old.c:
> 4632)()
>
> /home/nslabs/Desktop/sage-4.0.1-linux-Ubuntu_9.04-sse2-i686-Linux/
> local/lib/python2.5/site-packages/sage/structure/parent.so in
> sage.structure.parent.Parent.coerce (sage/structure/parent.c:4765)()
>
> TypeError: no canonical coercion from <type 'str'> to Symbolic Ring
>
> Is it a known bug?
Not sure, if it's not already on http://trac.sagemath.org/sage_trac/
it should be. Probably due to the new symbolics. What you can do is
make your dictionary cicco = {x: 10}. Making strings work shouldn't
be too hard, that's what the a.subs(x=10) needs to handle.
- Robert
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---