Revision history [back]

In your first bit of code, specifying $n$ will make the command work without your workaround. That is, try:

var('x')
g = 2/(1+x+sqrt((1+x)*(1-3*x)))
T=taylor(g, x, 0, 5)
T

You can get a list of lists which each contain the coefficient and degree of the term by using

T.coeffs()

I'm using SageMathCloud and do not get the O(0) in the result. So, I'm not sure what's going on. I wonder if this is a difference in versions of Sage.

In your first bit of code, specifying $n$ will make the command work without your workaround. That is, try:

var('x')
g = 2/(1+x+sqrt((1+x)*(1-3*x)))
T=taylor(g, x, 0, 5)
T

You can get a list of lists which each contain the coefficient and degree of the term by using

T.coeffs()

I'm using SageMathCloud and do not get the O(0) in the result. So, I'm not sure what's going on. I wonder if this is a difference in versions of Sage.

However, if I use the series command, I do get the order of the expansion included. But, this can be removed using truncate. For example,

S=T.series(x,5)
S.truncate()

I think this is what you are looking for.