# HP Forums

Full Version: subst() vs |x=a with diff()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :