Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I define the $n$th product derivative of a function in Mathematica?

The first product derivative $f^\ast$ of a function $f$ is $$ f^\ast(x)=\exp\left(\frac{f^\prime(x)}{f(x)}\right) $$ The $n$th product derivative is the result of applying this operator $n$ times.

This is my attempt at a recursive definition:

In[111]:= Clear[prodd]
prodd[f_, n_] := prodd[e^(f'/f), n - 1]; prodd[f_, 0] = f

Out[112]= f

In[113]:= prodd[E^x, 1](* Should print E *)

Out[113]= e^(E^-x Derivative[1][(E^x)])

In[114]:= prodd[E^E^x, 1](* Should print E^E^x *)

Out[114]= e^(E^-E^x Derivative[1][(E^E^x)])

In[114]:= prodd[E^x, 2](* Should print 1 *)
share|improve this question
As an aside, what is the product derivative used for? – rcollyer Oct 22 '12 at 3:29
@rcollyer: see the preprint by Mike Spivey that I linked to. See also this, this, and this. – J. M. Oct 22 '12 at 11:17
@J.M. the preprint is awesome. I like the exponential approximations, and it makes me wonder what else I've missed in calculus, or was ignored ... – rcollyer Oct 22 '12 at 20:19
up vote 8 down vote accepted

From Corollary 1 of this preprint by Mike Spivey, there is a simple nonrecursive definition for the product derivative:

ProductD[f_, x_] := ProductD[f, {x, 1}];
ProductD[f_, {x_, k_Integer?NonNegative}] := Exp[D[Log[f], {x, k}]]

Verify a few identities:

ProductD[f[x] g[x], x] == ProductD[f[x], x] ProductD[g[x], x] // Simplify

ProductD[x^a, x] == Exp[a/x]

ProductD[Exp[Exp[x]], x] == Exp[Exp[x]]

ProductD[x^x, x] == E x

Here's the corresponding multiplicative calculus analog of Derivative[]:

ProductDerivative[0] = Identity;
ProductDerivative[k_Integer?Positive][f_] := 
             Derivative[k][Composition[Log, f]] /. Function[ff_] :> Function[Evaluate[E^ff]]

To use the example given by the OP in the comments:


ProductDerivative[1][Sin[#] &][4]

ProductDerivative[1][Function[u, Sin[u]]][4]
share|improve this answer
Thanks. I guess I should have tried to find an explicit definition first. – Navin Oct 21 '12 at 19:42
Is there a way to make this return a function? For example, ProductD[Sin[x], {x, 1}][4] should evaluate to E^Cot[4]. – Navin Oct 21 '12 at 19:53
I've added an implementation of ProductDerivative[] now. – J. M. Oct 22 '12 at 2:19

e is not the same as E, and f' expects f to be a function but E^x is just an expression, so I use D[f, x] instead:

prodd[f_, n_] := prodd[E^(D[f, x]/f), n - 1];
prodd[f_, 0] := f

prodd[E^x, 1](*Should print E*)

prodd[E^E^x, 1](*Should print E^E^x*)

prodd[E^x, 2](*Should print 1*)



You could also write:


prodd[f_, n_] := Nest[E^(D[#, x]/#) &, f, n]

If you are going to use x in this manner I recommend using \[FormalX] instead to prevent failure if you accidentally assign a value to x.

You might also consider something like this:


prodd[f_, n_] := Nest[E^(#'[\[FormalX]]/#[\[FormalX]]) &, f, n]

prodd[E^# &, 1]

prodd[E^E^# &, 1]

prodd[E^# &, 2]


share|improve this answer
Thanks, this seems to work. – Navin Oct 21 '12 at 19:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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