1 | initial version |
You should use the method substitute_function
instead of subs
and use a symbol different from p
to denote p(r)
(otherwise there is a confusion between the function p
and its value at r
). Besides the semicolons at the end of each line are not necessary in Python and the line v = var('v')
is useless, since the Python variable v
is redeclared in the next line. So basically, your code should be:
sage: r = var('r')
sage: P = function('p')(r)
sage: v = P + P.derivative(r)
sage: p1(r) = desolve(P.derivative(r)==0, P, ivar=r); p1(r)
_C
sage: v.substitute_function(p, p1)
_C