Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
17402: add SymbolicSeries.power_series
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Dec 1, 2015
1 parent d5cc424 commit 00c35cd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/sage/symbolic/series.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,21 @@ cdef class SymbolicSeries(Expression):
ret[c[1]] = c[0]
return ret

def power_series(self, base_ring):
"""
Return algebraic power series associated to this symbolic
series. The coefficients must be coercible to the base ring.
EXAMPLES::
sage: ex=(gamma(1-x)).series(x,3); ex
1 + (euler_gamma)*x + (1/2*euler_gamma^2 + 1/12*pi^2)*x^2 + Order(x^3)
sage: g=ex.power_series(SR); g
1 + euler_gamma*x + (1/2*euler_gamma^2 + 1/12*pi^2)*x^2 + O(x^3)
sage: g.parent()
Power Series Ring in x over Symbolic Ring
"""
from sage.rings.all import PowerSeriesRing
R = PowerSeriesRing(base_ring, names=str(self.default_variable()))
return R(self.list(), self.degree(self.default_variable()))

0 comments on commit 00c35cd

Please sign in to comment.