# Polynomial Chaos - Quadrature Level Question

Hey everyone, I am fairly new to UQLab, but have been using Polynomial Chaos Expansions (PCEs) in my work to compare against a few other UQ/UP methods. The sparse features of UQLab are great, especially when computing models for higher and higher dimensional problems. My question is:

When implementing the ‘Quadrature’ solution technique, why is the maximum level of the quadrature equal to the degree + 1? I understand polynomial exactness in regards to Gaussian quadratures, and specifically sparse Smolyak grids, but for PCEs we are not integrating expectations of polynomials directly, we’re integrating the product of some orthogonal polynomial with the transformation, M(X).
For example, when I set the degree to 6, the maximum quadrature level that I can input without error is 7. I get the following error for level = 8:

Index in position 1 exceeds array bounds (must not exceed 7).
AB = AB(1:(LEVELS(ii)),:);

My thought would be the quadrature level can/should be independent of the degree of the PCE expansion. Any help here?

Hi @jjm_gatech ,

Thanks for your interest in PCE and UQLab, and sorry for the late answer! Have you found an answer to your question? If yes, we would be interested in hearing it! If not, here is what I think: There are two answers to this questions. The first is that it should not be necessary to adjust the level manually. The idea is that if you decide to use a degree n PCE to approximate your model, you are implicitly assuming that your model is behaving almost like a degree n polynomial (otherwise you would have chosen a higher-degree PCE!). So in total you need to integrate a polynomial of degree 2n. And you want to do this with Gaussian quadrature, which when using m nodes is accurate for polynomials of degree 2m-1. So, you need to use n+1 nodes for your quadrature (which is the number of levels).

The other answer is that since the case of manually specifying a higher level in the quadrature is not really intended, the UQLab implementation does not consider this information when computing the recursion coefficients. (The error you get comes because the array `AB`, which contains the recursion coefficients for the computation of the basis polynomials, does not have enough entries). I guess you could fix it by adding a case distinction in `uq_PCE_initialize_process_basis.m` at the very end, using the level in case of quadrature and `maxdeg` else. And you have to process the level information in `uq_PCE_initialize` instead of lines 32-36 of `uq_PCE_calculate_coefficients_projection.m`. You can just modify the UQLab code by yourself if you want to make it work. I will also check with my colleagues whether what you observed is intended behavior or a bug.

Hope this helps, good luck! PS: Is there a reason that you are using quadrature-based PCE? Sparse regression-based PCE is typically much more efficient…