Let $f$ be some interpolated function (so not easily integrable in a strict way), and $g$ is analytic function (for example $\exp$). I want to perform indefinite integral, and plug it into $g$, and finally perform definite integral.


However, it fails since NIntegrate only allow definite integral. If I substitute Integrate for the second NIntegrate, it works, but it takes very long time, in my impression. I want to know how to perform this integral and obtain interpolated function $\int_0^x dx f(x)$. Since we can easily differentiate interpolated function directly, I think it should be possible.

Alternatively, if $g=1$ we can rewrite it as a multiple integral,


and it works well with much less calculation time. So I also want to generalize such a kind of approach to the case with general $g$ if possible.


1 Answer 1


The integration NIntegrate[g[NIntegrate[f[x],{x,0,y}]],{y,0,1}]fails because the inner NIntegrate doesn't know about y to be numeric!



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.