I am trying to substitute the first order derivative of a term into an expression that contains higher order derivatives and am not getting the desired behavior.
A minimal example:
declare([w0], constant);
depends(P0, [T0, T1]);
O0sol:[diff(P0,T0)=w0];
ex1:subst(O0sol, diff(P0,T0));
ex2:subst(O0sol, diff(P0,T0,2));
ex3:subst(O0sol, diff(diff(P0,T0),T1));
ex4:subst(O0sol, diff(diff(P0,T1),T0));
Out of these, only ex1
evaluates to w0
correctly. All the remaining have to be zeros but I'm unable to force it to be zeros.
I will appreciate any help.
Okay I figured this out myself. Turns out that there's a parameter derivsubst
that controls exactly this behavior (see https://maxima.sourceforge.io/docs/manual/maxima_101.html). I don't understand why this has to be false
by default; I'm making it a point to set it to true
in everything now.
The above example works with:
derivsubst:true$
declare([w0], constant);
depends(P0, [T0, T1]);
O0sol:[diff(P0,T0)=w0];
ex1:subst(O0sol, diff(P0,T0));
ex2:subst(O0sol, diff(P0,T0,2));
ex3:subst(O0sol, diff(diff(P0,T0),T1));
ex4:subst(O0sol, diff(diff(P0,T1),T0));