polynomials are power series?

77 views
Skip to first unread message

Ralf Stephan

unread,
Jan 22, 2014, 6:49:01 AM1/22/14
to sage-...@googlegroups.com
While the ring type hierarchy does not reflect that polynomials are power series, you can have a power series without bigoh which is pratically a polynomial but, being a power series, has much less member functions available.

I think Sage shouldn't allow a zero bigoh term in power series. It should avoid unexpected behaviour, eg. users complaining that a polynomial isn't what it seems.

But I'm writing here to ask for your opinion before I think about patching, because I'm only beginning to understand Sage, and I'm not even a mathematician!

Regards,
Ralf Stephan

Martin Raum

unread,
Jan 22, 2014, 9:49:52 AM1/22/14
to sage-...@googlegroups.com
Thank you, Ralf, for considering ideas how to improve Sage.

I can't, however, agree with this particular idea. Think of coercion. You have a polynomial, coerce it into the power series ring, and then? Choose the precision = degree + 1? How could that be a ring homomorpism. You would sacrifice structure for the idea "what looks the same should be the same". I don't think the latter is important enough to justify the former.

Martin

John Cremona

unread,
Jan 22, 2014, 10:01:27 AM1/22/14
to SAGE devel
Surely all Ralf meant was that R[X] is a subring of R[[X]], i.e. some
elements of R[[X]] are exact, just as some decimal numbers like 0.25
are exact (in binary), and just as we might want to define a real
number as having *exactly* the value 0.25 and not just 0.25 +
O(10^-1000) one might want to consider 1+X as an exact power series
and not just 1+X+O(X^1000).

Of course I amy have misunderstood Ralf (or you)!

John
> --
> 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+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/groups/opt_out.

Ralf Stephan

unread,
Jan 22, 2014, 10:56:19 AM1/22/14
to sage-...@googlegroups.com
I understand precision as being independent from element properties (as it is in Pari). Note also that R.random_element() always has O(x^20) so a fixed precision is already implemented.

​John is right that I see polynomials as a subring to power series. I would not be able to give references to that however.​


Nils Bruin

unread,
Jan 22, 2014, 10:57:04 AM1/22/14
to sage-...@googlegroups.com
On Wednesday, January 22, 2014 3:49:01 AM UTC-8, Ralf Stephan wrote:
While the ring type hierarchy does not reflect that polynomials are power series, you can have a power series without bigoh which is pratically a polynomial but, being a power series, has much less member functions available.
As a power series, it has *different* methods available. For instance, the (formal) power series 1-x has a multiplicative inverse (formal) power series
1+x+x^2+x^3+...
but the polynomial 1-x does not have a multiplicative inverse polynomial.

The big-Oh term is giving you useful information: it is telling you that "1 - x + O(x^10)" is considered a power series. You also see why, even if this is the power series representation of the polynomial 1-x and not of a power series 1-x+x^11+x^13+..., it is still essential to have some "precision" associated to the object: once you take the inverse of a power series, you need a precision to represent it in a finite way (ignoring "lazy" approaches for now).

Ralf Stephan

unread,
Jan 22, 2014, 11:01:17 AM1/22/14
to sage-...@googlegroups.com
If polynomials were a subring of power series then 1-x would have an inverse. Who says it has not?

(Do not misunderstand me please, I simply don't know)


--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/APnWIGYcq3M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.

Ralf Stephan

unread,
Jan 22, 2014, 11:21:17 AM1/22/14
to sage-...@googlegroups.com
I will abstain from the type hierarchy. I need to have a better grip on rings. Sorry for the time you wasted.

Travis Scrimshaw

unread,
Jan 22, 2014, 11:21:42 AM1/22/14
to sage-...@googlegroups.com
It would not have it's inverse in the subring. You need an infinite number of terms to express (1 - x)^-1 = 1 + x + x^2 + x^3 + ... (by using multiplication as 1/(1 - x) is formally a rational function).

Currently we have the following behavior in sage:

sage: R.<x> = QQ[]
sage
: f = 1 - x; f
-x + 1
sage
: f.parent()
Univariate Polynomial Ring in x over Rational Field
sage
: FPS.<x> = QQ[[]]
sage
: FPS
Power Series Ring in x over Rational Field
sage
: FPS(f)
1 - x
sage
: _.parent()
Power Series Ring in x over Rational Field
sage
: f + x
1
sage: FPS(f)^-1
1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11 + x^12 + x^13 + x^14 + x^15 + x^16 + x^17 + x^18 + x^19 + O(x^20)
sage
: f^-1
1/(-x + 1)
sage
: _.parent() # This is the field of rational functions
Fraction Field of Univariate Polynomial Ring in x over Rational Field

so it looks like the 0*O(x^20) is just suppressed from the output in the (formal) power series ring.

Best,
Travis

Peter Bruin

unread,
Jan 22, 2014, 11:36:31 AM1/22/14
to sage-...@googlegroups.com
Hi Ralf,


I understand precision as being independent from element properties (as it is in Pari).

In Sage, there are two kinds of precision: the precision of an individual element and the default precision of the power series ring.  The same power series ring can contain elements that are represented using different precisions; for example, you can have a power series ring R with default precision 20, an element f in R with precision 10, and another element g in R with infinite precision.

An operation on power series (addition, inversion etc.) return the result in the highest precision to which it is defined; this depends on the precision of the elements, not on the default precision.  The exception is when the input has infinite precision and the output cannot be represented with infinite precision.  This is where the default precision comes in.  For example, 1 - x has infinite precision, but 1/(1 - x) = 1 + x + x^2 + x^3 + ... cannot be represented exactly as a power series, so it is truncated to the default precision.

In PARI the situation is similar, except for two things: (1) there is no distinction between polynomials and "power series of infinite precision that happen to be polynomials", and (2) the default precision is a global setting, not tied to any specific ring.  Both of these are simply because PARI has no (explicit) concept of polynomial rings and power series rings.

Peter

Peter Bruin

unread,
Jan 22, 2014, 11:41:24 AM1/22/14
to sage-...@googlegroups.com
Hi Travis,


so it looks like the 0*O(x^20) is just suppressed from the output in the (formal) power series ring.

If you mean that this is suppressed when printing FPS(f): no, actually FPS(f) has infinite precision, even though its parent FPS has a finite default precision.  Only when computing 1/f does the O(x^20) arise; the default precision is used here because the result cannot be expressed as a power series with infinite precision.

Peter

Ralf Stephan

unread,
Jan 22, 2014, 11:53:10 AM1/22/14
to sage-...@googlegroups.com
Thanks Travis, so there is coercion already. Now I think it natural to also have coercion from the polynomial fractions to power series, or at least have an expand() member function with a precision parameter and coercion in case of addition with some bigoh, see

And thanks to Peter for completely clarifying power series precision.



--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/APnWIGYcq3M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.

Travis Scrimshaw

unread,
Jan 22, 2014, 12:35:44 PM1/22/14
to sage-...@googlegroups.com
Ah, I see. Thanks for clarifying that for me Peter.

Martin Raum

unread,
Jan 23, 2014, 9:25:41 AM1/23/14
to sage-...@googlegroups.com
Which actually makes me think of one change that might be helpful. When we have a power series of infinite precision then why not print an additional O(x^oo), that is $O(x^{\infty})$. That would, indeed, help to distinguish infinite precision power series from polynomials. It only requires a minor change in _repr_ and _latex_, I suppose.

Martin
Reply all
Reply to author
Forward
0 new messages