Message Boards Message Boards

2
|
11227 Views
|
5 Replies
|
16 Total Likes
View groups...
Share
Share this post:

Integration method used in NIntegrate

Posted 10 years ago

Is in there any way in Mathematica how to find out which integration method was actually used in NIntegrate[f[x],{x,xmin,xmax}] if no method is explicitly specified by user?

POSTED BY: Tomas Rihacek
5 Replies

I updated the notebook with explanations for this discussion with a new section where it is given and explained NIntegrate methods tracing code.

Here is an example output of the tracing (see the notebook for details): enter image description here

POSTED BY: Anton Antonov

I should have given more explanations in my first response in this discussion. The attached notebook has some more detailed answers.

In many cases I find it helpful to look at the sampling points used by NIntegrate. Using the sampling points plots I can figure out which integration strategy and integration rule has been applied -- each integration strategy and integration rule has a unique pattern of sampling points.

The second section of the attached notebook has some examples that demonstrate the previous statement.

One can also use the "NIntegrate Explorer" to build knowledge or proficiency in determining NIntegrate's methods by the plots of the sampling points. See the tutorial example "GUIKit Example: NIntegrate Explorer" in the documentation. (It can be found by searching for "NIntegrateExplorer" in the help browser.)

Further, we can use the undocumented NIntegrate option IntegrationMonitor in order to obtain more detailed information of the integration rules and integrands used. This is demonstrated in the third section.

We can also look at the definition of the default, automatic integration strategy in order to see which methods are applied and in what order. This shown in the fourth section.

The fifth section shows and describes code for tracing the initialization of NIntegrate's methods for the computation of concrete integrals.

Attachments:
POSTED BY: Anton Antonov

In many cases I find it helpful to look at the sampling points used by NIntegrate. Below are some examples:

Needs["Integration`NIntegrateUtilities`"]

NIntegrateProfile[NIntegrate[1/Sqrt[x], {x, 0, 1}]]

NIntegrateSamplingPoints[NIntegrate[1/Sqrt[x], {x, 0, 1}]]

NIntegrateSamplingPoints[
 NIntegrate[1/Sqrt[x], {x, 0, 1}, 
  Method -> {"GlobalAdaptive", "SingularityHandler" -> "IMT"}]]

NIntegrateSamplingPoints[
 NIntegrate[1/Sqrt[x], {x, 0, 1}, 
  Method -> {"LocalAdaptive", "SymbolicProcessing" -> 0, 
    "SingularityHandler" -> "IMT"}]]

NIntegrateSamplingPoints[
 NIntegrate[1/Sqrt[x], {x, 0, 1}, 
  Method -> {"GlobalAdaptive", "SingularityDepth" -> 20}]]

NIntegrateSamplingPoints[
 NIntegrate[1/Sqrt[Abs[x]], {x, -2, 1}, 
  Method -> {"GlobalAdaptive", "SingularityDepth" -> 2}]]

NIntegrateSamplingPoints[
  NIntegrate[1/Sqrt[Sin[x]], {x, 0, \[Pi]}, 
    Method -> {"GlobalAdaptive", "SingularityDepth" -> 2}]]
POSTED BY: Anton Antonov
Posted 10 years ago
POSTED BY: Alexey Popkov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract