> The reason is that the generic method subs iterates the generators of R
> (in this case x) and checks whether any keyword matches the string
> representation of that generator. But
>
> x._repr_()
>
> does not give 'x', but 0.0... + 1.0... x.
>
> There are two obvious ways to fix this: Change _repr_  or change subs. By
> changing _repr_, we would accept that some elements are wrongly printed as
> exact elements, but this approach would correspond to the fact that
>
> CC(0) == CC(0)
>
> is true. By changing subs, we would introduce a specialized method for
> power series rings, while so far any ParentWithGens comes with the same
> implementation.
>
> I would rather change _repr_. What do you think?
>

I would rather change subs.  Why not use the variable name rather than the
string representation?  In this example it's not clear why it's useful to
see "zero" entries, but consider the following:

sage: K = Qp(5,4,print_mode='terse'); R.<x> = K[]
sage: a = K(6).log(); y = a*x; y
(555 + O(5^4))*x
sage: z = 555*x; z
(555 + O(5^4))*x
sage: y-z
(0 + O(5^4))*x

The print representation lets you know that the degree of the result is
uncertain (in this case the degree is secretly 1, but sometimes the degree
could be 0).
David

-- 
-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to