subst() vs |x=a with diff()
08-29-2019, 05:05 PM
Post: #1
 Wes Loewer Member Posts: 162 Joined: Jan 2014
subst() vs |x=a with diff()
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.
 « Next Oldest | Next Newest »

 Messages In This Thread subst() vs |x=a with diff() - Wes Loewer - 08-29-2019 05:05 PM

User(s) browsing this thread: 1 Guest(s)