Pages

Friday, January 15, 2016

Geometry part 2

In this post, we would use Mathcalc8 to verify two common theorems that appeared in College Geometry course. We begin with a famous theorem called Ptolemy's Theorem :
1/ Refered to the diagram below :


4 points on a circle draws six lines ab, ac, ad, bc, bd and cd. There exists a formula between the lengths of these six lines :
 ac * bd = ab * cd + bc * ad
To verify this formula, we construct a circle and then assign 4 random points on the circle and calculate the length of the six lines.
To simplify the construction without loss of generality, we create a circle ci with center at the origin (0,0) with radius 10.
Input 1 : ci=gcircle(gpt(0,0),10)
Ans. set ci = 2, 0, 0, 0, 10
Select four random angles from 0 to 2*pi and sort from smallest to largest.
Input 2 : r=sort(random(4,0,360)/180*pi)
Ans. set r = 0.192, 3.51, 3.54, 6.13
Using this four random angles, we can construct points a, b, c and d as follows :
Input 3 : a=gpt(10*cos(r(0)),10*sin(r(0)))
Ans. set a = 0, 9.82, 1.91
Input 4 : b=gpt(10*cos(r(1)),10*sin(r(1)))
Ans. set b = 0, -9.34, -3.58
Input 5 : c=gpt(10*cos(r(2)),10*sin(r(2)))
Ans. set c = 0, -9.21, -3.91
Input 6 : d=gpt(10*cos(r(3)),10*sin(r(3)))
Ans. set d = 0, 9.88, -1.56
Now we can calculate the lengths between those 4 points and verify the formula.
For the left-hand side of the formula,
Input 7 : distance(a,c)*distance(b,d)
Ans. 384.25375
For the right-hand side of the formula,
Input 8 : distance(a,b)*distance(c,d)+distance(b,c)*distance(a,d)
Ans. 384.25375
As expected, the values on both sides are the same.
Below is a graph showing the circle and the four points :
Input 9 : draw('ci|a|b|c|d',-12,12,1,-12)


This completed the verification.
Our next demonstration is a theorem called Miquel Theorem.
2/ A diagram is shown below :


p, q, r are three points on the lines ab, bc and ca of a triangle abc. Two circles are made by points p, b, q and p, r, a. The two circles intersect at a point s (and p). Then c, r, s and q are points on a circle.
To verify the theorem, we creates a triangle abc with a at origin (0,0), b at (10,0) and choose c randomly with x between 0 to 10 and y between 0 to 15.
Input 10 : clear()
Input 11 : a=gpt(0,0)
Ans. set a = 0, 0, 0
Input 12 : b=gpt(10,0)
Ans. set b = 0, 10, 0
Input 13 : c=gpt(random(1,0,100)/10,random(1,0,150)/10)
Ans. set c = 0, 8.7, 2.2
Input 14 : t=gtriangle(a,b,c)
Ans. set t = 3, 0, 0, 0, 0, 10, 0, 0, 8.7, 2.2
Next, we create points p, r and q as random points along ab, ac and bc :
Input 15 : p=ept(a,b,random(1,0,100)/10)
Ans. set p = 0, 6.2, 0
Input 16 : r=ept(a,c,random(1,0,100)/10)
Ans. set r = 0, 4.959, 1.254
Input 17 : q=ept(b,c,random(1,0,100)/10)
Ans. set q = 0, 9.363, 1.078
Next, we create two circles from points a, r, p and points b, q, p using a function called 'makecircle' :
Input 18 : c1=makecircle(a,r,p)
Ans. set c1 = 2, 0, 3.1, -1.827, 3.598
Input 19 : c2=makecircle(b,q,p)
Ans. set c2 = 2, 0, 8.1, -0.396, 1.941
The intersection points of c1 and c2 are :
Input 20 : i=intersect(c1,c2)
Ans. set i = 0, 6.697, -1.737, 0, 6.2, 7.1e-15
As expected, one of the intersection point should be p and it is the second intersection point. So, the first intersection point is set as s.
Input 21 : s=i(0)
Ans. set s = 0, 6.697, -1.737
To check that 4 points q, r, s and c are on a same circle, we create a circle from q,r,s and check if the fourth point is on that circle. By calculating its distance from the center of the circle and comparing to the radius, we can check if the point is on the circle.
Input 22 : c3= makecircle(q,r,s)
Ans. set c3 = 2, 0, 7.135, 0.518, 2.297
From the answer, we can see that the center of the circle c3 made by p, r and s is (7.135, 0.518) and it's radius is 2.297.
To verify c is on c3 or not, we measure the distance between c and center of c3. The list c3 has three elements, the first element is the geometrical type which is a circle, so it is 2. The second element is the center point (0, 7.135, 0.518). The third element is the circle's radius which is 2.297. So to get the center point of c3, we use c3(1) (not gpt(c3(2),c3(3)) as c3(3) is undefined. c3(2) is the radius 2.297) :
Input 23 : distance(c,c3(1))
Ans. 2.297
From this result, we can see that c is indeed on the circle c3 and this complete our verification.
To get a graph of the above items :
Input 24 : draw('a|b|c|t|p|q|r|s|c1|c2|c3', -5, 5, 0.1, -5, 'black|black|black|black|black|black|black|black|black|black|red')


The red circle in the graph is c3 and it can be seen that it touchs the 4 points c,r,s and q. It is also noticed that in our case, the point s is formed outside of the triangle abc instead of inside the triangle.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.