The definition of the elasticity (used in economics a lot) of a function f(x) is $\frac{\mathrm{d} \log(f(x))}{\mathrm{d} \log(x)}$. Using the chain rule, it is easy to show that:

$$ \frac{\mathrm{d} \log(f(x))}{\mathrm{d} \log(x)} =\frac{\mathrm{d}\log(f(x))}{\mathrm{d}f(x)}\frac{\mathrm{d}f(x)}{\mathrm{d}x}\frac{\mathrm{d}x}{\mathrm{d}\log(x))} =\frac{x}{f(x)}\frac{\mathrm{d}f(x)}{\mathrm{d}x} $$

I couldn't find a way to input the derivative directly into Mathematica though. Is there a way?

Dt[ Log[ f[x] ], Log[x] ]

almost works, but not quite.

  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/a/27393/4999 $\endgroup$ – Michael E2 Oct 5 '20 at 18:28
  • 11
    $\begingroup$ A somewhat more direct coding of the formula works: Dt[Log[f[x]]]/Dt[Log[x]]. $\endgroup$ – Michael E2 Oct 5 '20 at 18:30
  • 1
    $\begingroup$ That is an excellent tip Michael E2. Thank you very much. $\endgroup$ – OutsideLoop Oct 5 '20 at 19:40
  • $\begingroup$ In[1804]:= D[Log[f[Exp[y]]], y] /. y -> Log[x] Out[1804]= (x Derivative[1][f][x])/f[x] also handles this. $\endgroup$ – Daniel Lichtblau Oct 6 '20 at 14:05
  • $\begingroup$ This also works: Dt[Log[f[x]], Log[x]] /. x -> E^Hold[Log[x]] // ReleaseHold . $\endgroup$ – Akku14 Oct 9 '20 at 13:37

You can use the ResourceFunction "ChainD" for this purpose:


(x f'[x])/f[x]

  • $\begingroup$ Thanks. Had not come across that (experimental) function before. Looks like there are lots of interesting things to play around with using it. $\endgroup$ – OutsideLoop Oct 5 '20 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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