How to get mesh used by integral function adaptive quadrature

3 views (last 30 days)
I'm trying to get a better understanding of how the adaptive quadrature in the integral function works by analyzing the way it distributes points to conduct the numerical integral. I believe I have a decent understanding of how it works, but I would like to visualize the point distribution for various test functions to further my understanding. Is there a way to get the integral function, or similar, to output the x values at which it computes?

Accepted Answer

John D'Errico
John D'Errico on 13 Mar 2024
Nothing stops you from recording the points sent into your integration kernel. Save them in a persistent variable, for example, then set up the function so that if called with NO input argument, it will return the complete, compiled list, in the sequence they were passed in. (If you are careful in how you create that persistent variable.)
However, that will not tell you a lot, since as an adaptive routine, it will adjust where it places the points based on what it sees. Effectively reverse engineering such a tool seems wrong, when you can read the paper it should be based on. So start by a glance at the reference provided.
In there, you will find this reference:
L.F. Shampine “Vectorized Adaptive Quadrature in MATLAB®,” Journal of Computational and Applied Mathematics, 211, 2008, pp.131–140.
which will surely tell you more than inspection of a sequence of points.

More Answers (1)

Torsten
Torsten on 13 Mar 2024
Moved: Torsten on 13 Mar 2024
No.
If you define your function to be integrated in its own function routine, you could somehow save the x-values for which it is called. But I don't think that will give you an impression of the final mesh used to evaluate the integral.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!