On Wednesday, January 15, 2020 at 12:45:10 PM UTC-8, Sebastian Oehms wrote:
> My expectation is that two power series are considered to be equal if 
> there polynomials agree, but also their individual precisions as long as 
> one of them is below the default precision of the ring. Accordingly the 
> `is_zero` method should not return True if the individual precision is 
> below the default precision.

The default precision is just that: a default. It's used to get a finitely 
presented result in cases where a computation could normally lead to a 
non-finite one. The setting of the default doesn't affect the mathematical 
properties of the elements. In particular, whether elements are equal or 
not is determined by their direct properties, not by the default set in the 
parent ring. Therefore, your expectation is not compatible with the design 
(as you discovered). But perhaps by seeing how it was designed and why, 
you'll warm to the design decisions made :-).

The arithmetic model used is basically one of "interval" or "ball" 
arithmetic: In terms of actual power series rings, an element like 
1+t+O(t^2) stands for the set of all power series with initial part 1+t. In 
that model, "equality" gets translated to "have non-empty intersection".

This model has the advantage that (sqrt(1+t)^2 -1)/t == 1 returns true, as 
one would expect mathematically.

(insisting equality up to the default precision would have to lead to 
false, because the arithmetic on the LHS leads to precision loss)

> But this doesn't help for the following irritating answer (which was the 
> original issue pointed out to me by Bill Hart):
> sage: R.<t>=PowerSeriesRing(ZZ)
> sage: S.<u>=PowerSeriesRing(R)
> sage: 0 + O(t) + O(u)
> O(u^1)
Indeed, but I think the actual bug there is: Power series rings over 
non-exact base rings don't work properly. This is a problem that you should 
expect: algebra algorithms normally designed to work with exact base rings 
will have problems with non-exact ones, and usually for the reason you see 
here: to work properly with power series over exact rings, you eliminate 
(exact) zeros, but the inexact zeros that you encounter in power series 
rings should probably be kept for precision tracking reasons (also the ones 
up to default precision!). But keeping them around indiscriminately would 
lead to impractical results very quickly. Special care is needed. You might 
try working with ZZ[['t','u']] instead.

(and indeed, power series rings with p-adic coefficients need a whole set 
of extra care too -- and usually convergence properties on the coefficients 
anyway to make meaningful arithmetic possible)

You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to