I am trying to simplify a differential equation via substitution in maxima
. However, the substitution does not seem to be working.
Here's my code:
depends (\rho,[t, r, \theta, z]); depends (V, [t, r, \theta, z]);
f_contin : diff (\rho, t) + diff (\rho*r*V[r], r)*(1/r) = 0;
base : diff (V[b]*r*\rho, r) = 0;
V_sub : V[r] = V[b] + \epsilon*V[r];
subst (V_sub, f_contin);
subst (base, %o6);
The last substitution did not work. What am I doing wrong here?
The problem is that
subst(a=b, c)
(or equivalentlysubst(b, a, c)
) can only make substitutions whena
is an exact subexpression ofc
.ratsubst
(which see) can handle some cases whena
is not an exact subexepression but in this case it doesn't seem to work.But I think you can get the result you want by just subtracting the one equation from the other. Note that
(a=b) - (c=d)
yieldsa - c = b - d
. Note also that I've put in another step (in %i7) to apply thediff
operator. Also I've multiplied %o7 by r to get something likebase
.