integral2 global error test

1 view (last 30 days)
Hussein Ammar
Hussein Ammar on 5 Jul 2019
Hello all,
I'm using integral2 to evaluate a complex function inside a for loop, so integral2 is being used many times for the function at different inputs.
The function contains a singularity, which I was able to solve by dividing the double integral into two parts. But, during the evlauations I'm getting this message:
Warning: Reached the maximum number of function evaluations (10000). The result
fails the global error test.
and some times I get this message:
Warning: Reached the maximum number of function evaluations (10000). The result
passes the global error test.
My questions are the following:
  • What does this message mean?
  • Is the result of integral2 correct in both cases?
  • Do you recommend dividing my double integral into more than two parts during the numerical evaluation? and will that make the integral evaluation faster or slower (I'm feeling that this issue is making the integral evaluation very slow compared to cases when I don't get these messages).
  • I have tried to use two nested integral commands instead of integral2, i.e.:
integral(@(y) integral(@(x) func1(x,y),x_lower,x_upper,'ArrayValued',true)...
,y_lower,y_upper,'ArrayValued',true);
But I have noticed that it is super slow compared to integral2. Why is that? does it give more accurate results?
Feel free to paste links to resources\articles that talk about the details of this message and why it happens.
Regards,

Answers (0)

Categories

Find more on Oceanography and Hydrology in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!