Integration of the function derivative wrt the function

66 Views Asked by At

According to wolframalpha

$$ \int f'(x)df(x) = f'(x) f(x) + constant $$

I am trying to get the RHS, but alas... I tried to apply integration by parts and to apply it twice

1

There are 1 best solutions below

0
On BEST ANSWER

Too long for comment: As you and MartinR suspect, WA is mistaken due to a bug* in the Wolfram Language function Integrate that has been addressed (but not fixed!) as recently as version 13.2.0 of Mathematica.

I happen to have just the right versions of Mathematica installed that demonstrate this. Here's the output from 12.2.0 :

In[]:= $Version
Out[]= "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)"

In[]:= Integrate[f'[x], f[x]]
Out[]= f[x] Derivative[1][f][x]

And from 13.2.0 :

In[]:= $Version
Out[]= "13.2.0 for Mac OS X x86 (64-bit) (November 18, 2022)"

In[]:= Integrate[f'[x] f[x], f[x]]
Out[]= 1/2 f[x]^2 Derivative[1][f][x]

(NB: Derivative[1][f][x] means "Derivative of order 1 of f with respect to x", i.e. $f'(x)$)

But this result is still not quite right (outside of Mathematica, anyway; it's possible this behavior is by design). The problem is that Integrate[expr, var] is strictly integrating w.r.t. var and treats everything else constant. In this case the symbol f[x] is the variable, and the dependency on x is ignored. Similarly, computing a derivative w.r.t. $f(x)$ also gives a bad result in both aforementioned versions,

In[]:= D[f[x] f'[x], f[x]]
Out[]= Derivative[1][f][x]

whereas one might expect, using the chain rule,

$$\begin{align*} \frac{d}{df(x)}[f(x)f'(x)] &= f'(x) + f(x) \frac{df'(x)}{df(x)} \\ &= f'(x) + f(x) \frac{df'(x)}{dx} \frac{dx}{df(x)} \\ &= f'(x) + \frac{f(x)f''(x)}{f'(x)} \end{align*}$$

Doing the same for your original output, the same process yields

$$\begin{align*} \frac{d}{df(x)} \left[\frac12 f(x)^2 f'(x)\right] &= \frac12 \frac{df(x)^2}{df(x)} f'(x) + \frac12 f(x)^2 \frac{df'(x)}{df(x)} \\ &= f(x) f'(x) + \frac12 f(x)^2 \frac{df'(x)}{dx}\frac{dx}{df(x)} \\ &= f(x) f'(x) + \frac12 f(x)^2 \frac{f''(x)}{f'(x)} \end{align*}$$

which would mean WA's antiderivative only applies to a certain family of functions $f$, namely those for which $f'\neq0$ and $f''=0$.