HP Forums
subst() vs |x=a with diff() - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: subst() vs |x=a with diff() (/thread-13532.html)



subst() vs |x=a with diff() - Wes Loewer - 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.