# Working with series

I can't get how to work with series. I do

```
sage: R.<t> = PowerSeriesRing(QQ)
sage: t^2
t^2
sage: sin(t)
```

but the last rises an error. I want to do usual manipulations like `sin(t)/cos(t+2)^2`

.

Working with series

I can't get how to work with series. I do

```
sage: R.<t> = PowerSeriesRing(QQ)
sage: t^2
t^2
sage: sin(t)
```

but the last rises an error. I want to do usual manipulations like `sin(t)/cos(t+2)^2`

.

1

Use the `taylor`

method to get a Taylor polynomial. This needs to be done in the symbolic ring since the power series ring is purely algebraic and doesn't know about derivatives.

```
sage: t = var('t')
sage: f = sin(t)
sage: s_poly = f.taylor(t,0,7)
sage: s_poly
-1/5040*t^7 + 1/120*t^5 - 1/6*t^3 + t
sage: s_poly.parent()
Symbolic Ring
```

The `power_series`

method will convert the Taylor polynomial to a power series for you:

```
sage: s_ser = s_poly.power_series(QQ)
sage: s_ser
t - 1/6*t^3 + 1/120*t^5 - 1/5040*t^7 + O(t^8)
sage: s_ser.parent()
Power Series Ring in t over Rational Field
sage: g = cos(t)
sage: c_poly = g.taylor(t,0,7)
sage: c_poly
-1/720*t^6 + 1/24*t^4 - 1/2*t^2 + 1
sage: c_ser = c_poly.power_series(QQ)
sage: c_ser
1 - 1/2*t^2 + 1/24*t^4 - 1/720*t^6 + O(t^7)
```

Over the power series ring, you can do arithmetic with the power series. Note that you will need to change "`t`

" from the generator of the symbolic ring to the generator of the power series ring in order to use things like `t+2`

:

```
sage: t.parent()
Symbolic Ring
sage: t = s_ser.parent().gen()
sage: t.parent()
Power Series Ring in t over Rational Field
sage: s_ser/c_ser(t+2)
-45/19*t + 1890/361*t^2 - 83085/6859*t^3 + 3677670/130321*t^4 - 649441779/9904396*t^5 + 7173329982/47045881*t^6 - 17745663554041/50056817384*t^7 + O(t^8)
```

Asked: **
2012-06-01 09:07:02 -0500
**

Seen: **173 times**

Last updated: **Jun 02 '12**

Differentiation of a power series.

How to compute the multiplicative inverse of a series?

Power series with coeffs in SymmetricFunctions()

I want to plot power series with symbolic functions

integrating formal Laurent series

How to convert a Taylor polynomial to a power series?

Working with formal power series

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.

What do you mean by sin(t)? Do you want the Taylor series for sin around some point?

yes, generally Puiseux series would be better, but sin t is to return Taylor expansion around zero if it doesn't specified in it's type directly.