What I am asking could seem simple but I couldn't find a solution nor here nor in google.
I want to take the derivative of a function by another function. Let say I have two functions of time y[t] and x[t] (and some other parameters). In my code they both have a certain dependence on t. I would like to derive y by x and have the result expressed in function of time as well. Something like D[y[t], x[t]]. I know that I could simply calculate D[y[t], t] / D[x[t], t].
But isn't there a more direct way? Just out of curiosity ...

  • 4
    $\begingroup$ See chainD in my answer to Higher-order partial derivatives w.r.t. variable raised to some power $\endgroup$ – Carl Woll Jul 20 '17 at 7:23
  • 1
    $\begingroup$ This D[y[t], t] / D[x[t], t] actually is a most direct way. You may easily write a custom function for that, if you like. Something like der[y_[t_], x_[t_]] := D[y[t], t]/D[x[t], t]. Then der[Sin[t], Cos[t]] yields -Cot[t]. $\endgroup$ – Alexei Boulbitch Jul 20 '17 at 12:14
  • $\begingroup$ @CarlWoll Thank you. That function works OK. Even though I am not into Mathematica language enough to understand why. Maybe it would take some time. If you could give me some hints I would be grateful but it is not vital for me at the moment so don't worry. $\endgroup$ – LastStarDust Jul 21 '17 at 7:52
  • $\begingroup$ @AlexeiBoulbitch you are right. The function that I wrote proved to be the most simple way that gets the job done. But it is always good to have feedback. Thank you $\endgroup$ – LastStarDust Jul 21 '17 at 7:52

How about using Dt instead of D

In[1]:= Dt[a[t] x[t] + b[t], x[t]]

Out[1]= a[t] + Dt[t, x[t]] x[t] Derivative[1][a][t] + 
 Dt[t, x[t]] Derivative[1][b][t]
  • $\begingroup$ I am sorry this is not working in my case. Maybe it is valid only in case you leave the functions unspecified. In my case the have a well defines dependence on t. To be more specific one is a[t]=someparameters Log[t] and the other is b[t]=someotherparameters Log[t]. And I would like to calculate d a[t] / d b[t]. $\endgroup$ – LastStarDust Jul 21 '17 at 7:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.