# A problem in powerseries It seems there is a problem when expanding tan(t), sinh(t), cosh(t) using PowerSeries. The following works fine

R.<t> = PowerSeriesRing(QQ)
sin(t)/cos(t)
t + 1/3*t^3 + 2/15*t^5 + 17/315*t^7 + 62/2835*t^9 + 1382/155925*t^11 + 21844/6081075*t^13 + 929569/638512875*t^15 + 6404582/10854718875*t^17 + 443861162/1856156927625*t^19 + O(t^20)


However, tan(t) returns

TypeError: cannot coerce arguments: no canonical coercion from Power Series Ring in t over Rational Field to Symbolic Ring

edit retag close merge delete

This is because the power series do have "sin" and "cos" methods, but no "tan" method. So Sage tries to fall back to the symbolic ring SR and fails.

For the situation you presented, you could use tan(t).taylor(t, 0, 10)

Thanks for the replies. Of course talylor can do the job, however I had in mind more compex calculations with several steps where the series expanded results from the first step can be used in the next one and so on. PowerSeries is very usefull to this end. I guess at some point in the future more methods will be included in PowerSeries. Some of them e.g. sinh(x), cosh(x) which can be explicitly written in terms of exponentials would be simple to implement , I guess.

Sort by » oldest newest most voted

If working in SR is good enough for your problem :

tan(x).maxima_methods().powerseries(x,0)
sum((2^(2*i1) - 1)*2^(2*i1)*(-1)^(i1 - 1)*x^(2*i1 - 1)*bern(2*i1)/factorial(2*i1), i1, 0, +Infinity)


HTH,

more