Ask Your Question
1

Working with series

asked 2012-06-01 16:07:02 +0100

yrogirg gravatar image

updated 2012-06-01 16:07:26 +0100

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.

edit retag flag offensive close merge delete

Comments

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

niles gravatar imageniles ( 2012-06-01 21:05:23 +0100 )edit

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.

yrogirg gravatar imageyrogirg ( 2012-06-02 02:07:22 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-06-02 14:21:06 +0100

niles gravatar image

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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-06-01 16:07:02 +0100

Seen: 479 times

Last updated: Jun 02 '12