# How to evaluate the average value of a polynomial inside the triangle area in finite volume sense?

Consider we have a linear bivariate polynomial: $$p(x,y)=ax+by+c.$$

To construct the linear polynomial using least square method, we need to evaluate the value of the average polynomial $$p$$ in at least in three cells that approximately must be equal to the average of conservative variable $$\bar{\psi}$$. $$\frac{1}{\Delta_i}\int_{\Delta_i}{p(x,y)}\,dx\,dy = \bar{\psi}_i.$$

My question are:

1. How should I define the limit of integration?
2. How to evaluate the integral of the polynomial?

## 1 Answer

If $$(x_i,y_i)$$ is the centroid of the triangle, then $$\frac{1}{\Delta_i}\int_{\Delta_i}{p(x,y)}\,dx\,dy = p(x_i,y_i) = \bar{\psi}_i$$ This is mid-point quadrature, which is exact for an affine function. The centroid of a triangle is the arithmetic average of its three vertices. Note that $$x_i = \frac{1}{\Delta_i} \int_{\Delta_i} x dx dy = \frac{1}{3}\sum_{vert} x_{vert}$$ and similarly for $$y_i$$. This suggests to reparametrize $$p$$ as $$p = \bar{\psi}_i + a (x-x_i) + b(y-y_i)$$ which automatically satisfies the average condition.

• Is your answer valid for arbitrary triangle? Nov 9 '20 at 7:48
• yes, it is valid. Nov 9 '20 at 9:31
• Sorry I just noticed from your answer that the quadrature is exact for an affine function, how if the function is quadratic? Nov 9 '20 at 9:57