Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not sure I understand why your example doesn't work, but here is a workaround:

sage: var('a b x')
sage: f = function('foo',x)
sage: g(x) = a*foo(x) + b*foo(x)^2
sage: h = g.diff(x)
sage: bar(x) = a*x + b
sage: h.substitute_function(foo, bar)
2*(a*x + b)*a*b + a^2