find correct coefficients in $n$

asked 2020-02-25 15:32:04 -0500

brettpim gravatar image

updated 2020-02-26 08:19:39 -0500

def desc_prod_recip(x,y):
    t0 = 1
    t1 = y*(y-1)/(2*x)
    t2 = (y*(y+1)*(y-1)*(3*y-2))/(24*x^2)
    t3 = (y^2*(y-1)^2*(y+1)*(y+2))/(48*x^3)
    t4 = y*(y-1)*(y+1)*(y+2)*(y+3)*(15*y^3-15*y^2-10*y+8)/(5760*x^4)
    return (x^(-y))*(t0 + t1 + t2 + t3 + t4)
n,t = var('n t')
E1 = desc_prod_recip(n,t).expand().simplify()
E1.coefficients(n)

gives the answer:

 [[1/96*t^7 - 1/576*t^6, -t - 4],
 [-1/16*t^4, -t - 3],
 [1/(n^t), 0],
 [1/384*t^8 - 1/30*t^5 - 5/1152*t^4 + 1/32*t^3 + 1/288*t^2 - 1/120*t, -t- 4],
 [1/48*t^6 + 1/48*t^5 - 1/48*t^3 + 1/24*t^2, -t - 3],
 [1/8*t^4 - 1/12*t^3 - 1/8*t^2 + 1/12*t, -t - 2],
 [1/2*t^2 - 1/2*t, -t - 1]]

It seems to detect all the powers of $n$ properly except $n^{-t}$. How can I process this symbolic expression so that sagemath computes the coefficients of $n$ properly?

edit retag flag offensive close merge delete

Comments

I just realised that it also has two separate coefficients for $n^{-t-4}$ and $n^{-t-3}$, so there are other issues with .coefficients()

brettpim gravatar imagebrettpim ( 2020-02-26 17:59:22 -0500 )edit