Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to solve a nonlinear system of algebraic (not differential) equations which involves double integrals. I want to use Matlab. There seems to be two functions that can do double integration: dblquad and quad2d.

I noticed that the latter is much faster than the former (100+ times). But I don't know the accuracy. I used both functions to evaluate my integrals (which involves bivariate normal density) and got different answers. I chose a rectangular region around the mean in both cases, since Matlab (I think most numerical algorithms) seems to have difficulty finding the substantial values of the integrand if the region is too big and gives me 0.

My question is: does anyone know the difference of these two functions (in terms of integrating mechanism) as well as accuracy?

Thanks.

share|improve this question
    
Did you make sure you exploited any symmetry in your integrands? The problem with the cubature of products of Gaussians is that if the peak is too small, sampling might miss it, which is supposed to contribute to the bulk of the integral. Could you maybe post the function you're trying to integrate? –  J. M. May 3 '11 at 4:03
    
What I'm trying to integrate is $E[c((a_1X_1)^{\alpha_1}+(a_2X_2)^{\alpha_2})X_1^{\alpha_1}]$ where $(X_1,X_2)$ is bivariate normal (correlated) and $c$ is some piecewise linear/quadratic function. –  GWu May 3 '11 at 4:09
    
Note that dblquad is essentially a Cartesian product version of quad (i.e., think of computing the double integral by using quad with an integrand whose expression also involves quad), and thus is likely to be slow (due to the adaptive nature of quad) if the integrand has a lot of "features". –  J. M. May 3 '11 at 4:10
    
Anything special about the $a_i$ and the $\alpha_i$? –  J. M. May 3 '11 at 4:11
    
I double checked using Mathematica function NIntegrate[]. In that case, I simply integrate over the whole plane and don't have to choose a smaller integration region. It seems that Mathematica agrees with dblquad. But that too slow for solving my system because it calls the function many times. –  GWu May 3 '11 at 4:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.