Length of a Circle: Iterative Numerical Approximation (Ver.1)
The equation of a general circle centered at the point

with radious
is

it is known that its length is
. We want to approach the actual length by an increasing value of the inscrived polygon length.
Contents
Automatic point generation
Now we'll generate the appropriate number of points using polar coordinates

where ![$$\theta \in [0,2\pi]$](circleLengthV1_eq06932068371753988843.png)
( Hint : see at the end of this page)
radious = 1; numPoints = 8; points = generatePolygonPoints(radious, numPoints) [m,n] = size(points)
points =
1.0000 0
0.7071 0.7071
0.0000 1.0000
-0.7071 0.7071
-1.0000 0.0000
-0.7071 -0.7071
-0.0000 -1.0000
0.7071 -0.7071
m =
8
n =
2
m rows (number of points) and n columns (number of coordinates)
Now we compute the length of the closed curve associated to this polygon
Build also a funtion that returns the length of this polygon
clength = curveLength(points,m)
clength =
6.1229
Finally the error obtained by the present approximation is:
actualLength = 2*pi*radious; absError = abs(clength-actualLength); relError = absError/actualLength; [absError,relError]
ans =
0.1603 0.0255
Write the following function file and named it as generatePolygonPoints








![$$ \texttt{ pts=[x',y']; }$](circleLengthV1_eq06189676027835635327.png)
(c) Numerical Factory 2017