Научная статья на тему 'A comparative study of two general methods for the approximate construction of regular polygons by using Mathematica 3. 0'

A comparative study of two general methods for the approximate construction of regular polygons by using Mathematica 3. 0 Текст научной статьи по специальности «Электротехника, электронная техника, информационные технологии»

CC BY
77
42
i Надоели баннеры? Вы всегда можете отключить рекламу.

Аннотация научной статьи по электротехнике, электронной технике, информационным технологиям, автор научной работы — Аледо Хуан А., Кортес Хуан С., Пелайо Фернандо Л.

In this paper we study two classic methods for the approximate construction of regular polygons by using Mathematica 3.0: the method of Archimedes and the method of Bardin. In the same way, we make a comparative study of the errors of both methods, concluding that the exactness of Bardin's method is higher than the Archimedes' one. Moreover, we improve both methods, by giving the respective algorithms. We also include the coded algorithm in Mathematica 3.0 for the animation of both methods.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «A comparative study of two general methods for the approximate construction of regular polygons by using Mathematica 3. 0»

A COMPARATIVE STUDY OF TWO GENERAL METHODS FOR THE APPROXIMATE CONSTRUCTION OF REGULAR POLYGONS BY USING MATHEMATICA 3.0

J.A. Aiedo {Department of Mathematics, University of Castilla-La Mancha, 02071 Albacete, Spain}, J.C. Cortes {Department of Mathematics, I.E.S. Bonifacio Sotos, 02200 Casas Ibanez, Albacete, Spain}, F.L. Pelayo {Corresponding Author. Department of Computer Science, University of Castilla-La Mancha, 02071 Albacete, Spain. Tel.: 34-967599200 ext:2410; fax: 34-967599224; e-mail: fpelayo@info-ab.uclm.es}

In this paper we study two classic methods for the approximate construction of regular polygons by using Mathematica 3.0: the method of Archimedes and the method of Bardin. In the same way, we make a comparative study of the errors of both methods, concluding that the exactness of Bardin’s method is higher than the Archimedes' one. Moreover, we improve both methods, by giving the respective algorithms. We also include the coded algorithm in Mathematica 3.0 for the animation of both methods.

1 The method of Archimedes

The method of Archimedes is a geometric procedure to divide the circumference in a number n of equal parts in an approximate way, and therefore, it has as its more immediate application the approximate construction of regular polygons. We should point out that although the authorship of the present algorithm is usually attributed to Archimedes, there is no unanimity in this respect in the scientific community.

1.1 Description of the algorithm

1) Trace a circumference.

2) Trace the main vertical diameter AB of the circumference (as main diameters we understand the two perpendicular diameters that coincide with the coordinated axes), and divide it upside down in n equal parts, where n is the number of sides of the polygon that we want to draw.

3) Trace two arcs centred on the points A and В respectively and with radius AB. These circumference arcs will cut themselves in a point M with positive coordinate of abscissa.

4) We will call N to the second division, beginning from the top, of the diameter AB, and so we obtain the point C of negative coordinate of abscissa in the circumference, result of the intersection of the straight line joining M with N and the circumference.

5) The segment BC is the side that, taken on the circumference, allows us to draw, in an approximate way, a regular polygon of n sides for inscription in the circumference.

Now, we will use Mathematica 3.0 to justify that this algorithm can indeed be used for the approximate construction of regular polygons. We will find the longitude on the side of the regular polygon that we want to build in an approximate way, this is, we will find the distance between the points В and C in function of the number of sides n.

‘Department of Mathematics, University of Castilla-La Mancha, 02071 Albacete, Spain.

^Department of Mathematics, I.E.S. Bonifacio Sotos, 02200 Casas Ibdhez, Albacete, Spain.

Corresponding Author. Department of Computer Science, University of Castilla-La Mancha, 02071 Albacete, Spain. Tel.: 34-967599200 ext:2410; fax: 34-967599224; e-mail: fpelayo@info-ab.uclm.es

Figure 1: Construction of the regular octagon by Archimedes

For this study we will suppose without loss of generality that the radius of the circumference in which we want to inscribe the regular polygon is 1, and that it is centered on (0,0). It is clear that the point

M is determined by the intersection of the circumferences

( x2 + (y + l)2 = 4

\ x2 + (y — l)2 = 4

that can be solved with Mathematica 3.0 by means of

Solve[{x2 + (y + l)2 == 4, x2 + (y - l)2 == 4}, {x, y}]

Keeping in mind that, according to the described algorithm, the coordinate of abscissa of the point M is positive, we should choose between the two solutions of the previous system

M = (v/3,0) .

On the other hand, the coordinates of the point N are

and the equation of the straight line that goes through the points M and N is

4 — n / \/3z

V =

- 1

n

The point C results from solving the non lineal system

x2 +y2 = 1

4 — n I Vtx

V =

- 1

n

that can be made with Mathematica in the way

Simplify[Solve[{x2 + y2 — 1, y == ((4 - n)/n) * ((\/3 * x/3) - 1)}, {x, y}]] Choosing the solution whose coordinate of abscissa is negative, we have

C= V3

(n - 4)2 - ny/ri2 + 16n - 32 4(n2 — 2n + 4)

4 — n

n

(n — 4)2 — ns/n2 + 16n — 32 4(n2 — 2n + 4)

- 1

In order to calculate the distance between the points В and C, we can use the following simple algorithm with Mathematica

_ . . r— ((n — 4)2 - n * -s/n2 + 16n — 32 A

0Х[П_]:= V3» ^--------J4t(na_2n + 4)--------- J

_ . . 4 —n ( ((n — 4)2 — n * \/n2 + 16n — 32 A \

:=—*( {------------4 * (n2 — 2n + 4)------J -

PointC[n_] := {Cx[n], Cy[n]}

distan[{a_, b_ }, {c_, d_ }] := y/{c - a)2 + (d - b)2 Simplify [distan[PointC[n], {0, l}]]

So we obtain as approximate side of the polygon the value

_ \fl n2 + An + 16 — (n — 4)Vn2 + 16n — 32

A = T V n2 - 2n + 4 •

It is simple to check that La is well defined for any n > 3, and therefore this method can be applied for the approximate construction of any regular polygon.

1.2 Analysis of the error of the method of Archimedes

Next we will study the precision of the method of Archimedes comparing the exact value Le of the longitude on the side of a regular polygon, with the value obtained by means of this technique. It is well known that

r л 7Г

Le = 2 sen—.

n

So we will obtain an estimate of the precision of the method starting from the relative error (Le~La)/Le■ The reason why we don’t consider the error taking the absolute value of the difference Le - La, is that we want to know if the value La obtained by means of the algorithm of Archimedes approaches for excess or for defect to the exact longitude Le•

To calculate the limit of the relative error when n —»• oo, we can implement the code

n.i. i« j r i \/2 I n2 + 4n + 16 - (n - 4) * Vn2 + 16n - з¥ SideArcmmedes[n_] := — * W-------------------- —^ ^ ^----------------

ExactSide [n_ ] := 2 * Sin

_ , „ „ , . , ExactSide fnl — SideArchimedesfn]

RelativeErrorArchimedes[n_] :=--------------^^ ^-----------------—

Limit [RelativeError Archimedes [n], n —>• oo]

obtaining as result of this limit

2\/3

1 - — ~ -0.1026 7Г

It can also be interesting, although this information is implicit in the relative error, to observe that the quotient La/Le approaches to 2\fZ/nr ~ 1.1026 when n -> oo

Limit [SideArchimedes[n]/ExactSide[n], n -> oo]

The figure 2 illustrates the behaviour of the relative error of the method of Archimedes for values of n between 3 and 100. Although we present it with a continuous line for further clarity, we should remember that it is only defined for entire values greater or equal to three.

Plot(RelativeErrorArchimedes[n], {n, 3, 100}]

Figure 2: Behaviour of the relative error of the method of Archimedes

In the table 1 we study some values of Le, La, the difference Le — La, the quotient La/Le and the relative error (Le - La)/Le• It is notable to point out that the method of Archimedes is exact for the construction of the triangle, the square and the regular hexagon. The positive sign of the column Le — La indicates that the approach for the method of Archimedes is carried out for defect, and its negative sign indicates that the approach is for excess.

n Le La Le - La La/Le (Le - La)/Le

3 1.73205 1.73205 0 1 0

4 1.41421 1.41421 0 1 0

5 1.17557 1.17491 6.57336- 10"4 0.99944 5.59163 • 10-4

6 1 1 0 1 0

7 0.86776 0.86917 -1.40948- 10"3 1.00162 — 1.62426 • 10-ii

8 0.76536 0.76838 -3.02029 - 10-3 1.00395 -3.94620- 10"3

9 0.68404 0.68859 —4.55432 • 10-3 1.00666 -6.65798- 10"3

10 0.61803 0.62393 -5.90314- 10”3 1.00955 -9.55148- 10"3

11 0.56346 0.57050 -7.04078 • 10"a 1.01250 -0.0124955

12 0.51763 0.52561 —7.97689 • 10-3 1.01541 -0.0154102

13 0.47863 0.48736 -8.73428 • 10"11 1.01825 -0.0182484

14 0.44504 0.45438 -9.33876- 10"3 1.02098 -0.0209840

15 0.41582 0.42563 -9.81485- 10"3 1.02360 -0.0236034

50 0.12558 0.13400 -8.42832 • 10~3 1.06711 -0.0671146

100 0.06282 0.06803 -5.21126 - 10"3 1.08295 -0.0829534

1000 6.28317- 10~y 6.9145- 10"3 -6.31322- 10“4 1.10048 -0.0100478

10000 6.28319- 10"4 6.92682-10"4 -6.43634 • 10“5 1.10244 -0.102438

Table 1: Relative error Archimedes

2 The method of Bardin

The method of Bardin is another geometric procedure to build regular polygons in an approximate way. We will make a parallel study to the one carried out with the method of Archimedes

Description of the algorithm

Trace a circumference.

Trace the two main diameters of the same one, which we will denote for A A' and BB'. One of these diameters, for example the horizontal one, is divided from right to left in so many equal parts, n, as number of sides the regular polygon that we want to build has. We will call the third division

Q.

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

Add to the diameters A A' and B B' toward the right and up respectively one of these n parts. This way we obtain the points M and N.

Trace a straight line joining M and N that will cut the circumference in two points (whenever n > 5). We will call P to the point of between the both previous whose abscissa is bigger.

The segment PQ is the side that, taken on the circumference, allows us to draw in an approximate way a regular polygon of n sides for inscription in the circumference.

Figure 3: Construction of the regular octagon by Bardin

Like in the previous section, we will use Mathematica to justify the validity of the method of Bardin. Let us begin finding the longitude on the side PQ of the regular polygon of n sides that results from the preceding algorithm. Working again with the circumference of radius one, we obtain the point P for resolution of the non lineal system

x2 + y2 = 1

n + 2 x + y =----------

n

where the straight line x + y = (n + 2)/nis the one going by the points

M=(1 + ^’°) = (!LT^’0) and + =

So that we can implement in Mathematica

Solve[{x2 + y2 == 1, x + y == (n + 2)/n}, {x, y}]

Taking into account the procedure of Bardin, between the two solutions we choose the one with smaller ordinate (or bigger abscissa), this is

n2 + y/n2 — An — A n + 2 — y/n2 — An — A

2 n ’ 2 n

On the other hand, the coordinates of the point Q are

<3=(i-3!'°)=(!^-0)-

2.1

l)

2)

3)

4)

5)

Hence, the longitude of the segment PQ can be calculated by means of the code

n + 2 -f \/n2 - 4n - 4 n + 2 — \/n2 — 4n-4

P[n_l :=

2n 2n

Q[n-] :

Simplify [distan[P[n], Q[n]]] obtaining as longitude on the approximate side Lb of the regular polygon of n sides

yjri2 — 8n 4-48 — (n — 6 )y/ri2 — An — A

Lb =-------------------------------------------•

n

Note that the point P is only well defined for values of n > 5, because then n2 — An —A > 0. Therefore, the method of Bardin is not applicable either to the construction of the equilateral triangle or to the square.

2.2 Analysis of the error of the method of Bardin

Let us study, like in the method of Archimedes, the relative error (Le~ Lb)/Le to analyze the precision of the algorithm of Bardin. By means of the code

Jn2 - 8n + 48 — (n — 6) * -s/n2 — 4n — 4 SideBardin[n_] :=----------------

RelativeErrorBardin[n_] :=

n

ExactSide Ini - SideBardinfn]

ExactSide [n]

Limit [RelativeErrorBardin[n], n —»• oo]

we obtain as limit of the relative error when n —► oo the value

v/l0

1 - -— ~ -0.00658

7T

In this occasion, the quotient Lb/Le approaches to \/l0/7r ~ 1.00658 when n —> oo. The comparison of this value with the limit of La/Le invites us to think that the method of Bardin will be more exact than the Archimedes one.

Limit [SideBardinfn]/ExactSide [n], n -> oo]

The figure 4 illustrates the behaviour of the relative error of the method of Bardin.

In the table 2 we study some values of Le, Lb, the difference Le — Lb, the quotient Lb/Le and the relative error (Le - Lb)/Le. Observe that the method of Bardin is also exact for the construction of the regular hexagon.

We should remark that the construction is carried out for defect until the polygon of 21 sides, being this construction for excess started from the polygon of 22 sides. Also, from the last column it follows that the construction of the polygons of 21 and 22 sides by means of the algorithm of Bardin is especially good.

3 Comparison between both methods

To begin with, note that the method of Archimedes is valid for the approximate construction of any regular polygon, while the method of Bardin is valid for the approximate layout of regular polygons of five or more sides. This restriction of the method of Bardin is not relevant, because the equilateral triangle and the square can be built easily in an exact way. It’s important to point out that both methods are exact for the construction of the regular hexagon, being also exact the method of Archimedes for the construction of the triangle and the square.

Plot[ErrorBardin[n], {n, 5,100}]

0.008

0.006

0.004

Figure 4: Behaviour of the relative error of the method of Bardin

<j,From the observation of the tables of the relative errors, it follows that the method of Archimedes obtains its best approach in the construction of the pentagon and the relative error grows with the number of sides. On the other hand, the algorithm of Bardin reaches its best results for the construction of the polygons of 21 and 22 sides.

The construction of the regular polygons by means of the method of Archimedes is always carried out for excess except for the pentagon, while the method of Bardin approaches the polygons for defect from the triangle to the polygon of 21 sides, being this approach for excess started from the polygon of 22 sides.

Plot[{RelativeErrorArchimedes[n], RelativeErrorBardinfn]}, {n, 5,100},

PlotStyle -> {GrayLevel[0], Dashing [{.02}]}]

Figure 5: Comparison between relative errors

Finally, comparing the limits in the infinite of the relative errors of both algorithms (10.26% for the method of Archimedes and 0.658% for the method of Bardin) we can conclude the supremacy of the method of Bardin over the Archimedes one. In fact, only for the construction of the pentagon, the method of Archimedes is superior to the method of Bardin. The comparison of the limits in the infinite of the reasons La/Le and Lb/Le, also illustrates this supremacy.

The figure 5 compares the relative errors of both methods, appearing with continuous line the graph

n Le Lb Le — Lb Lb/Le (Le - Lb)/Le

5 1.17557 1.16619 9.38013- 10“3 0.992021 7.97921 • 10"3

6 1 1 0 1 0

7 0.86776 0.86751 2.48210- 10"4 0.999714 2.86033 • 10~4

8 0.76536 0.76461 7.48958- 10~4 0.999021 9.78561 • 10"4

9 0.68404 0.68304 9.94934- 10~4 0.998546 1.4545- 10"3

10 0.61803 0.61698 1.05149- 10“^ 0.998299 1.70134 • 10~3

11 0.56346 0.56246 1.00313- 10~3 0.998220 1.78029-10"3

12 0.51763 0.51673 9.04078 • 10-4 0.998253 1.74654 • 10~3

13 0.47863 0.47784 7.84956- 10"4 0.998360 1.64000- 10~3

14 0.44504 0.44437 6.62171- 10"4 0.998512 1.48789- 10"3

15 0.41582 0.41527 5.44080- 10~4 0.998692 1.30844- 10"3

21 0.29808 0.29805 3.49901 • 10"5 0.9998826 1.17383-10~4

22 0.28463 0.28464 -1.94551 • 10”6 1.000068 -6.835239- 10"5

50 0.12558 0.12596 -3.86981 • 10"4 1.003082 -3.08152-10“3

100 0.06282 0.06311 -2.95464 • 10"4 1.004703 -4.70322 • 10~3

1000 6.28317- 10"3 6.32329 - 10"3 -4.01130- 10"4 1.006384 —6.38426 • 10-3

10000 6.28319- 10~4 6.32443- 10~4 -4.12436- 10"6 1.006564 -6.56412- 10"3

Table 2: Relative error Bardin corresponding to the method of Archimedes and with discontinuous line the graph of Bardin.

4 Improvement of both methods

We have obtained improvements in Archimedes’ and Bardin’s methods so they will be exact, this is, we have found the appropriates values for N (Archimedes’ method) and for Q (Bardin’s one) which makes both constructions exact.

The authors are at your disposal for any question about these results and the mathematic studies of them.

5 Animation of both methods by using Mathematica 3.0

We have made one program for each method, whose input is the number of sides of the polygon which we want to build, and it outputs the respective guided construction (animation) of the regular polygon. These programs will be shown at IMACS-ACA’99.

References

%

[1] J.C. Cortes Lopez, Estudio matematico del trazado general de polfgonos regulares, Epsilon 39 (1997), 149-158.

[2] S. Wolfram, Mathematica, a system for doing mathematics by computer, Ed. Adison-Wesley (1991).

[3] S. Wolfram, The Mathematica book, Wolfram Media, Inc (1996).

i Надоели баннеры? Вы всегда можете отключить рекламу.