Ask Your Question

Revision history [back]

The reason is that Sage considers that Ds still has one variable, though it is a dummy one:

sage: Ds
t5040*sum((-1)^l/factorial(l), l, 0, 7)
sage: Ds.variables()
(l,)

You can solve this issue by simplifying the expression:

sage: Ds.simplify_full()
1854

The reason is that Sage considers that Ds still has one variable, though it is a dummy one:

sage: Ds
t5040*sum((-1)^l/factorial(l), l, 0, 7)
sage: Ds.variables()
(l,)

You can solve this issue by simplifying the expression:

sage: Ds.simplify_full()
1854

By the way, please note that the lines:

D=function('D')(n,l)
Dn=function('Dn')(n,l)

are useless, since D and Dn are overwritten just after.