Project 6

Integrate the fifth degree polynomial (x + 2*y + 1)^5 over the domains triangle with hole and annulus which your worked with in the meshing project.

Here is what I am getting:

On the triangle with hole:
./triangle-with-hole
Usage:
	./triangle-with-hole d a
	d = integration strength
	a = maximal triangle area
./triangle-with-hole 5 0.1
requested integration strength = 5
used integration strength = 5
domain is a triangle with hole
vertices = 31, edges = 65, elems = 34
expected integral =   463.1075439453125
calculated integral = 463.1075439
error = -2.28511e-11
On the annulus:
 ./annulus
Usage:
	./annulus d a n
	d = integration strength
	a = maximal triangle area
	n = number of outer edges on the annulus
./annulus 5 0.1 24
requested integration strength = 5
used integration strength = 5
domain is an annulus (really a 24-gon) of radii 0.325 and 0.65
vertices = 74, edges = 174, elems = 100
exact integral = 11.21156654
calculated integral = 10.92885656
error = 0.28271
./annulus 5 0.1 48
requested integration strength = 5
used integration strength = 5
domain is an annulus (really a 48-gon) of radii 0.325 and 0.65
vertices = 219, edges = 561, elems = 342
exact integral = 11.21156654
calculated integral = 11.14019861
error = 0.0713679

The "exact answer" in those outputs is the value of the integral over a true (round) annulus. We are approximating the annulus with a polygon, so some of the error is due to that approximation.

Experiment with your code to confirm that every doubling the number of sides cuts down the error by a factor of four. I think that's not difficult to prove but I haven't done it.