Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

find correct coefficients in $n$

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?

find correct coefficients in $n$

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?

find correct coefficients in $n$

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?