1 | initial version |
In such a case, I would introduce a "small" parameter, t
say, substitute t*h
for h
, perform the expansion in term of t
, and set t=1
in the final result. Here is the corresponding code:
sage: x, y = var('x y')
sage: h = function('h')
sage: H = h(x, y)
sage: e = (1 + H + diff(H, x)) * (1 + H + diff(H, y))
sage: e
(h(x, y) + diff(h(x, y), x) + 1)*(h(x, y) + diff(h(x, y), y) + 1)
sage: t = var('t')
sage: th(x, y) = t*H
sage: et = e.substitute_function(h, th)
sage: et
(t*h(x, y) + t*diff(h(x, y), x) + 1)*(t*h(x, y) + t*diff(h(x, y), y) + 1)
sage: taylor(et, t, 0, 1).subs({t: 1})
2*h(x, y) + diff(h(x, y), x) + diff(h(x, y), y) + 1