Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Expanding a bivariate exponential generating function, part II

From FrédéricC's answer to question 66860 I learned the following method (needs SageMath >= 9.8):

def egfExpand(egf, size):
    y = polygen(QQ, "y")
    x = LazyPowerSeriesRing(y.parent(), "x").gen()
    return [list(egf(x, y)[n] * factorial(n)) for n in range(size)]

def f(x, y):
    return exp(x * y) * exp(x)
    #return exp(x * y) * hypergeometric((), (), x) 

egfExpand(f, 10)

[[1],
 [1, 1],
 [1, 2, 1],
 [1, 3, 3, 1],
 [1, 4, 6, 4, 1],
 ...]]

But when I work with hypergeometric functions I get the error message:

cannot coerce arguments: no canonical coercion from Lazy Taylor Series Ring in x over Univariate Polynomial Ring in y over Rational Field to Symbolic Ring

The simplest example is when using the second line as definition of f(x, y) (the result should be identical).

What can I do?