Consider the function

$$M = \frac{\left[(f^{\prime})^2 - 2ff^{\prime \prime} - f^{\prime}_H~f^{\prime}\right]}{2f}$$

where $f \equiv f(r)$, and the primes are derivatives with respect to $r$. $f'_H$ is a constant. I want to consider a limit $r \to r_H$, wherein $f\to 0, f' \to f'_H, f'' \to f''_H$. If I evaluate this limit directly, I obtain an undetermined expression. Upon using L'Hospital's rule, I get,

$$\lim_{r\to r_H} \frac{2f^{\prime}f^{\prime \prime} - 2f^{\prime}f^{\prime \prime} - 2ff^{\prime \prime \prime} - f^{\prime}_Hf^{\prime \prime}}{2f^{\prime}} = - \frac{f^{\prime \prime}_H}{2}$$

However, I tried evaluating the same limit in Mathematica, and it's giving me $-f''_H$. My code is attached below:

M[r] =(-(fph*Derivative[1][f][r]) + Derivative[1][f][r]^2 - 2*f[r]*Derivative[2][f][r])/(2*f[r])

Limit[M[r], {f[r] -> 0, f'[r] -> fph, f''[r] -> fpph}]

which gives me an output of -fpph. Where is the discrepancy of the $1/2$ factor coming from?

  • $\begingroup$ In the limit, you have specified the numerator goes to -fh'^2, while the denominator to zero. Hence the limit is minus infinity if fh'!=0. $\endgroup$ Commented Feb 12, 2023 at 10:37
  • $\begingroup$ @AlexeiBoulbitch, how? The second term in the numerator vanishes. The first and third term cancel, giving 0. Since the denominator is also 0 in the limit, I can apply L'Hospital's rule $\endgroup$
    – newtothis
    Commented Feb 12, 2023 at 12:05

1 Answer 1


Limit is treating the function and its derivatives as independent variables, which is not the case in your intended problem. According to the docs, the limit is computed in nested iterator order (last rule done first). The result is the same as this:

FoldList[Limit, M[r], Reverse@{
   f[r] -> 0,      (* third limit  *)
   f'[r] -> fph,   (* second limit *)
   f''[r] -> fpph  (* first limit  *)

 (-fph f'[r] + f'[r]^2 - 2 f[r] f''[r])/(2 f[r]),
 (-2 fpph f[r] - fph f'[r] + f'[r]^2)/(2 f[r]),

You have to compute your limit in a different way.

We could plug in the correlations between the function and derivative values:

M[r] /. {f[r] -> fph eps , f'[r] -> fph + fpph eps, 
   f''[r] -> fpph + fppph eps} // Simplify
% /. eps -> 0
(eps fpph^2 - fph (fpph + 2 eps fppph))/(2 fph)


One caveat is to consider how far to expand the functions. The above works, but one could go farther. For instance:

M[r] /. {f[r] -> fph eps + fpph eps^2/2 + fppph eps^3/6 , 
   f'[r] -> fph + fpph eps + fppph eps^2/2, 
   f''[r] -> fpph + fppph eps} // Simplify

The following approach uses Series[] to figure all that out for us, but the input and output are in slightly different form:

Assuming[{f'[rh] == fph, f[rh] == 0},
 Series[M[r], {r, rh, 0}] // Simplify // Normal]
-(1/2) f''[rh]
  • $\begingroup$ Thank you very much! $\endgroup$
    – newtothis
    Commented Feb 14, 2023 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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