Ask Your Question

Revision history [back]

For substituting a function, you should use substitute_function, not subs;

sage: y = function('y')
sage: f = diff(y(x), x) + 5*y(x)
sage: y0(x) = x^2
sage: f.substitute_function(y, y0)
5*x^2 + 2*x

Note the definition y = function('y') instead of y = function('y')(x). Of course, you can always introduce some abbreviation for y(x), with a symbol different from y, e.g.

sage: Y = y(x)
sage: f = diff(Y, x) + 5*Y
sage: f.substitute_function(y, y0)
5*x^2 + 2*x

For substituting a function, you should use substitute_function, not subs;:

sage: y = function('y')
sage: f = diff(y(x), x) + 5*y(x)
sage: y0(x) = x^2
sage: f.substitute_function(y, y0)
5*x^2 + 2*x

Note the definition y = function('y') instead of y = function('y')(x). Of course, you can always introduce some abbreviation for y(x), with a symbol different from y, e.g.

sage: Y = y(x)
sage: f = diff(Y, x) + 5*Y
sage: f.substitute_function(y, y0)
5*x^2 + 2*x