Expanding an univariate exponential generating function can be done like this:
def egfExpand1(f, size):
x = var('x')
return taylor(f(x), x, 0, size).power_series(SR).egf_to_ogf().list()
For example egfExpand1(sec, 10) returns [1, 0, 1, 0, 5, 0, 61, 0, 1385, 0, 50521].
But how can I expand a bivariate exponential generating function? Say
def f(x, y): return exp(x * y) * sec(x)
def egfExpand2(f, size):
return ...
The expected output is an integer triangle (i.e. a list of integer lists).
The example would return an unsigned version of A119879, which starts:
1
0, 1
1, 0, 1
0, 3, 0, 1
5, 0, 6, 0, 1
In Maple this can be done with:
egf := exp(x * y) * sec(x): ser := series(egf, x, 11):
poly := n -> n! * coeff(ser, x, n):
row := n -> seq(coeff(poly(n), y, k), k = 0..n):
for n from 0 to 9 do row(n) od;