08-29-2019, 05:05 PM
I ran into an issue that I mostly sorted out and thought others might benefit from the experience.
I was attempting to find a 2nd derivative at a point so I tried
diff(t*e^t,t,2)|t=3
but the t=3 is substituted first, so I got
diff(3*e^3,3,2)
I was able to use the following work around
∂(∂(t*e^t,t),t)|t=3
but it's not exactly elegant (looks even worse in Textbook display), and it doesn't scale easily to higher order derivatives.
The problem is the |t=3 substitution occurs before the diff() command is run. I found that the subst() command makes the substitution after its expression is evaluated, so this works as intended.
subst(diff(t*e^t,t,2),t,3)
Since something like ∂(sin(x),x)|x=2 does work, I guess that ∂() has a higher evaluation order than |x=2. Seems like diff() should be given this same behavior.
I was attempting to find a 2nd derivative at a point so I tried
diff(t*e^t,t,2)|t=3
but the t=3 is substituted first, so I got
diff(3*e^3,3,2)
I was able to use the following work around
∂(∂(t*e^t,t),t)|t=3
but it's not exactly elegant (looks even worse in Textbook display), and it doesn't scale easily to higher order derivatives.
The problem is the |t=3 substitution occurs before the diff() command is run. I found that the subst() command makes the substitution after its expression is evaluated, so this works as intended.
subst(diff(t*e^t,t,2),t,3)
Since something like ∂(sin(x),x)|x=2 does work, I guess that ∂() has a higher evaluation order than |x=2. Seems like diff() should be given this same behavior.