Message Boards Message Boards

1
|
3296 Views
|
4 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Implicit differentiation at a point

Posted 2 years ago

I have the following implicit equation, and I'd like to compute the derivative of p with respect to T at a specific point. In other words, if I were to create the Contourplot of this equation, with p as the y-axis, and T as the x-axis, what would be its slope a certain point. I'm using Dt[] for the derivative, but it seems to give another implicit function, whereas I'm looking a numeric value. Code is attached.

derivativ = 
 Dt[p == \[Phi]/R + ((1 - \[Phi]) \[Phi] (1 - \[Lambda]) \[Beta])/(((W - T p) R + \[Phi] T) R + \[Phi]*(1 - \[Phi]) T)/(R (\[Lambda]/((W - T p) R + \[Phi] T  ) + ((1 - \[Lambda]) \[Beta] R)/(((W - T p) R + \[Phi] T) R + \[Phi] (1 - \[Phi]) T))), T]

derivativ /. {p -> 0.3192789688874802, T -> 313.206}

I get the following warning:

General::ivar: 313.206` is not a valid variable.

The output is:

Dt[0.319279, 313.206] == -142495. (-7.33049*10^-13 (0.16 + 1.05263 (0.2 + 1.05263 (-0.319279 - 313.206 Dt[0.319279, 313.206]))) -  9.02573*10^-14 (0.2 + 1.05263 (-0.319279 - 313.206 Dt[0.319279, 313.206]))) - 1.16674*10^-7 (0.16 + 1.05263 (0.2 + 1.05263 (-0.319279 - 313.206 Dt[0.319279, 313.206])))

Is it possible to get a number for the derivative evaluated at {p -> 0.3192789688874802, T -> 313.206}? And what does that warning actually mean?

Thank you,

Attachments:
POSTED BY: Guangye Cao
4 Replies
Posted 2 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi

The problem is ans is not numerical. You need to define all the variables if you want to plot it. For example Phi, Lambda, etc. You will also need p[T] for each T or some function for p (or interpolation).

To verify that you have everything in place, try evaluating the plot argument and make sure its numerical.

Regards.

POSTED BY: Neil Singer

You need to control what symbols are constant and what symbols vary with T. I really think you need to use D[] and not Dt[]. Dt[] assumes that every symbol varies with T. This is an unusual case. For example, if all your variables are constant in T, except for p, you would do:

derivativ = 
 D[p[T] == \[Phi]/
     R + ((1 - \[Phi]) \[Phi] (1 - \[Lambda]) \[Beta])/(((W - 
              T p[
                T]) R + \[Phi] T) R + \[Phi]*(1 - \[Phi]) T)/(R (\
\[Lambda]/((W - 
               T p[
                 T]) R + \[Phi] T) + ((1 - \[Lambda]) \[Beta] R)/(((W \
- T p[T]) R + \[Phi] T) R + \[Phi] (1 - \[Phi]) T))), T]

Now solve for the term p'[T] (solve returns a list of solution lists so take the first and only answer)

ans = Simplify[Solve[derivativ, p'[T]]][[1, 1]]

use the solution rule to evaluate p'[T] and substitute your numbers:

p'[T] /. ans /. {p[T] -> 0.3192789688874802, T -> 313.206}

If, say, R depended on T you would change all occurrences of R to R[T] and Mathematica would know to do the differentiation with T and you would get terms with R'[T] in the result.

I hope this helps.

Regards

Neil

POSTED BY: Neil Singer
Posted 2 years ago

Hello Neil,

Thank you so much! Your suggestion works perfectly. I have a follow up question: I'm trying to plot the derivative p'[T] as a function T, so p'[T] on the y-axis, and T on the x-axis. The following code returns an empty plot. I assume I need to compute p[T] for all T in my desired range, ie: {0,1000}, and then compute p'[T] for each pair of p[T] and T, and then plot. Would you know any way of achieving that?

Thank you again!

Plot[Evaluate[ans], {T, 0, 10000}]
POSTED BY: Guangye Cao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract