Arc Length by Simpson’s Rule

C++. I applied Simpson’s rule to the integral in the Arc length formula to get an approximate length of a quadratic equation curve. To do that, I applied Simpson rule by  sweeping small increments on x axis instead of using full Integral calculations. At the beginning, I chose 100 sub-intervals within [-1,1] to calculate the approximate lengths.

Here, the example functions are: y = x^2 + 1, y = 3x^2 + 2x – 5, and y = -2x^2 + x -3, with the error percentages respectively %2.03, %3.07, and %1.64. If we increase n to 1000, the error percentages are going to be really small like %0.34, %0.42, and %0.20.

[1] Simpson Rule

[2] Arc Length Formula