openturns icon indicating copy to clipboard operation
openturns copied to clipboard

Check polynomial degree of exactness of quadrature

Open mbaudin47 opened this issue 1 year ago • 6 comments

Based on a suggestion by J.Peter (ONERA), here are unit tests of quadrature based on their polynomial degree of exactness.

  • GaussProductExperiment
  • SmolyakExperiment
  • TensorProductExperiment
  • GaussLegendre

Update documentation of polynomial degree of exactness of the same classes.

mbaudin47 avatar May 31 '24 21:05 mbaudin47

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.38%. Comparing base (39d39f0) to head (14d81ab). Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2670      +/-   ##
==========================================
+ Coverage   79.27%   79.38%   +0.11%     
==========================================
  Files         847      845       -2     
  Lines       98256    98391     +135     
==========================================
+ Hits        77892    78109     +217     
+ Misses      20364    20282      -82     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jun 02 '24 11:06 codecov-commenter

@regislebrun Can you please review this PR ?

mbaudin47 avatar Jun 21 '24 13:06 mbaudin47

Michaël, Here are some minor remarks. PRQuad-1

  • $a_i < b_i$ and not $a_i \leq b_i$ because other wose the integral = 0
  • why not call the number od node $n_i$ rather than $s_i$?
  • numbers and not number
  • $w_{k_i}^{(i)}>0$ and not $w_{k_i}^{(i)}\geq 0$

adutfoy avatar Jun 26 '24 13:06 adutfoy

Still for the same file: You should introduce better that this is another example. For example you could write: We show how to use this method to evaluate the following integral: PRQuad-2

First, we use the default number of nodes as defined in the Resourcemap class: you give the pyhton lines you have already written .. Now, we set the number of nodes....

adutfoy avatar Jun 26 '24 14:06 adutfoy

I continue my review... About SmolyakExperiment:

  • you should explain that the sets of nodes are nested sets so that we understand better the $\Delta_k^{(1)}$ set.
  • section 'Merge duplicate node': you announced $(x_1, x_2)$ points to be merged and thnen you used $(x_1, y_1)$
  • I could have written $T_\ell^{(d)} = Q_{\ell,1}^{(1)} \times \dots \times Q_{\ell,d}^{(1)} $ to distinguish the quadratures according to the components

adutfoy avatar Jun 26 '24 14:06 adutfoy

A last question about the integral we evaluate with the Smolyak quadrature: must the set on which we integrate $\chi$ be a multivariate interval?

adutfoy avatar Jun 26 '24 14:06 adutfoy

@regislebrun , @adutfoy , @josephmure : Can you please review this PR?

mbaudin47 avatar Sep 17 '24 14:09 mbaudin47

@adutfoy wrote:

Michaël, Here are some minor remarks. * $a_i < b_i$ and not $a_i \leq b_i$ because otherwise the integral = 0

Actually, the code does not prevent from using a zero-volume interval:

https://github.com/openturns/openturns/blob/39d39f0dc9b1a6e37edeca15bef568643400a33c/lib/src/Base/Algo/GaussLegendre.cxx#L84

In this case, it just returns zero. This is why I did not update the doc: it reflects what is actually implemented in the code.

mbaudin47 avatar Oct 05 '24 17:10 mbaudin47

@adutfoy wrote:

I continue my review... About SmolyakExperiment:

* you should explain that the sets of nodes are nested sets so that we understand 
  better the  Δk(1) set.

This is not mandatory. Even if the marginal quadratures are not nested, the Smolyak quadrature produce a valid quadrature rule.

* I could have written Tℓ(d)=... to distinguish the quadratures according to the components.

This would be formally more accurate indeed, since the Smolyak quadrature does not require to use the same quadrature rule for all dimensions. Notice that this complicates the mathematical equations. Hence, I think that the choice from (Gerstner & Griebel, 1992) is a reasonable trade-off and I suggest to stick to the current simplification.

mbaudin47 avatar Oct 05 '24 18:10 mbaudin47

@adutfoy : I took into account for your comments in cb48d1134c717b3b6df2a6599cd213daba0a60e2. Are you ok with this PR?

mbaudin47 avatar Oct 07 '24 15:10 mbaudin47

@adutfoy : Is this OK from your point of view?

mbaudin47 avatar Oct 11 '24 10:10 mbaudin47

ok for me!

adutfoy avatar Oct 14 '24 08:10 adutfoy