# Integral of a numerical second derivative

I need to find the integral $$M(r)$$ of a second derivative of equation $$f(r)$$ where this equation has only a numerical solution sol = NDSolve[f[r],...].

M[r]=Integrate[the second derivative of f(r),{r,0,10}]


Because lack of example code I show the principal way to solve the problem:

Create NDSolve solution f[r]

f = NDSolveValue[{F'[r] + F[r] == 0, F[0] == 1}, F, {r, 0, 10}]


Integrate NDSolve result f''[r]

NIntegrate[f''[r], {r, 0, 10}]
(*0.999955*)


That's it!

Let's say the original call has a form something like the following:

sol = NDSolve[f[r], u, {r, 0, 10}] (* OP says f[r] is an 'equation' but does
not indicate the dependent variable
or boundary conditions              *)


By the Fundamental Theorem of Calculus, the answer should be given by

u'[10] - u'[0] /. sol


This will return the value(s) for the integral, one for each solution returned by NDSolve. (A nonlinear f[r] may have more than one solution.)