how can I evaluate a four fold integral with four variables numerically ?

18 views (last 30 days)
ebtehal on 22 Sep 2014
Commented: Mike Hosea on 29 Sep 2014
i used the functions quad, dblquad, and triplequad to evaluate up to three integrals, but i need to evaluate 4 integrals, how can i do that?
ebtehal on 24 Sep 2014
No, I can't separate the integrals to make them multiplied functions. I was asking because I thought there is a way in Matlab to solve higher order integrals that I didn't know.

Mike Hosea on 23 Sep 2014
Edited: Mike Hosea on 23 Sep 2014
There's one thing that people often find difficult: the requirement that the integrand accepts arrays and returns arrays, operating element-wise.
integral(@(x)integral3(@(y,z,w)f(x,y,z,w),ymin,ymax,zmin,zmax,wmin,wmax),xmin,xmax,'ArrayValued',true)
For smooth integrands over finite regions, a double integral of a double integral is usually a lot faster
integral2(@(x,y)arrayfun(@(x,y)integral2(@(z,w)f(x,y,z,w),zmin,zmax,wmin,wmax),x,y),xmin,xmax,ymin,ymax)
Mike Hosea on 29 Sep 2014
You can't use integralN, but you should be able to do this:
If your version is so old that you don't have QUAD2D, you can try this with DBLQUAD, but I don't recommend it. BTW, depending on how x and y are used in f(x,y,z,w), you might need to expand those arguments manually like so:

Roger Stafford on 22 Sep 2014
Set up a function which, when given the value of the outermost variable of integration, calculates the triple integral of the inner three iterated integrals for the particular value of that fourth variable. Then take the integral of the value of this newly-defined function over the appropriate limits for that fourth variable. There's nothing very difficult about that. Let the computer do all the hard work. You can expect it to take a fairly long time at it. That's inherent in doing integration in four dimensions.
ebtehal on 24 Sep 2014
Thank you Roger, I'll consider how to apply your method. The idea is my integration is very complex, and I experienced a another one with triple integration which really took me long time too, and all the integrals are from 0 to infinity, which makes me perform many trials to reach a steady value.