@rlopez Your deconstruction very much helps me to understand Kitonum's code.
However I remain puzzled by the statement:
Hence, y prime = yk and Q*yk is fdy
In the above statement is y prime diff(y(x),x) or is it diff(y(t),t) ?
Please expand on your explanation of this statement.
Also, is it true that a series of line segments must be listed in counterclockwise order for their integrated values to have the correct signs when they are summed toward the total integral over the region?
In Kitonum's second example it appears that the integral of an upward convex curve e.g. sin(Pi*t/3) has a negative value where the integral of an upward concave curve e.g. -sin(Pi*t/3) has a positive value. These values add correctly toward the total integral over the region.
Would this be true for more complex curves such as one which has both upward convex and concave sections within the region?