# Non-integrable multiple integrals for Mathematica

• Mathematica

It looks pretty good. Here are a couple of small suggestions.

Because you are repeating that inner-most integral so many times it is actually quite a bit more efficient to evaluate it once, construct an interpolating function and then just evaluate that interpolating function in the other integrals. It calculates about 26 times faster with little loss in accuracy.
Hi DaleSpam,
Can I ask for some clarifications?
When you say the innermost integral, do you refer to the one where the limits are d and b?
And then you suggest evaluating it once and then interpolating. Can you please explain how would I evaluate it? Because the limits of integrations, d, m and t are all variable, and I am not sure how to do it. If I know, I can as you suggest construct an interpolating function, but I am not sure. Can you please help?
Thanks a lot.
Anna.

Hi DaleSpam,
I might have figured out what you have suggested. Can you please have a look at the attached nb file and let me know if I understood you correctly. Or if there is even more efficient way to run this procedure for my problem? I wonder if what I wrote makes things faster actually...
Thanks.
Anna.

#### Attachments

• 13.5 KB Views: 381
Dale
Mentor

For function interpolation you will be better off using the example I showed in post 25 than the one you used in post 27. The built-in function will look at the function it is interpolating and make sure to adapt the sampling density if the function is changing rapidly.

For function interpolation you will be better off using the example I showed in post 25 than the one you used in post 27. The built-in function will look at the function it is interpolating and make sure to adapt the sampling density if the function is changing rapidly.
Thanks a lot for your help, I have not noticed your file in post 25.

I have used now this approach, and indeed it is better.

For a different function and a slightly modified ranges of the integration limits, I after I interpolatefunction, the following message:

FunctionInterpolation::ncvb: FunctionInterpolation failed to meet the prescribed accuracy and precision goals after 6 recursive bisections near j={0.}. Continuing to refine elsewhere.

I wonder if I should be ignoring this message or if it can cause any harm.

Thanks a lot.

Anna.

I tend to be cautious and I think it would be very nice if someone would contribute the perhaps small changes needed to get rid of all the error and warning messages. Sometimes those are there for good reasons and I often learn something when I find out why.

Dale
Mentor

You probably have a division by 0 somewhere. Look at your variable j and see what happens near 0. Possible solutions are to interpolate the inverse of the original equation, or to simply avoid 0.