Pages

Wednesday, January 13, 2016

Geometry part 1

Mathcalc8 had developed a Geometry module to support teaching of College Geometry. With this module, you can construct geometrical objects such as points, lines, circles, parabola, ellipse, hyperbola and polygons in a 2D plane.
Geometrical object is represented by list. A list that represented a geometrical object contains parameters that is characteristic of that geometrical object. For example, let us create a geometrical point called 'a' at coordinate (0,0) using function 'gpt' through the following input command :
Input 1 : a=gpt(0,0)
Ans. 0, 0, 0
A list with three elements is returned. This list represents the geometrical point 'a'. The first element has a value of 0 which indicated that the list is a representation of a geometrical point. The other two elements represent the x-coordinate and y-coordinate of the point.
We can construct another geometrical point 'b' at (10,0) as follows :
Input 2 : b=gpt(10,0)
Ans. 0, 10, 0
From these two points, we can create extension point along the direction joining these two points 'a' and 'b' using function 'ept'. For example, we can create a middle point 'm' from 'a' and 'b' as follows :
Input 3 : m=ept(a,b,1/2)
Ans. 0, 5, 0
Or, we can add 'a' and 'b' and divided by two to obtain point 'm' :
Input 4 : m=(a+b)/2
Ans. 0, 5, 0
The third parameter of the function 'ept' is the extension ratio which is reference to point 'a' with the distance between 'a' and 'b' treated as one unit. A positive value of 1/2 means that point 'm' is measured from point 'a' at half the distance between point 'a' and 'b' and in the direction 'a' to 'b'. The extension ratio can be any real number. When it is within 0 to 1, it represents a point between points 'a' and 'b'. When it is over 1, it represents an extension point over 'b'. When it is negative, it represents an extension point behind 'a'. As an example, we can construct an extension point of (-5,0) as follows :
Input 5 : m=ept(a,b,-1/2)
Ans. 0, -5, 0
What happen if we replace the variable 'a' in the above input parameter with another list, say (10, 0, 0). Since the input list (10, 0, 0) is not a representation of geometrical point, the function would return an error message. Actually, this is a general feature for all the functions that are defined in the geometry module : only expected types of inputs that entered in the functions can yield meaningful outputs.
Another way to create extension point is through the function 'addpt'. The difference between this function and the function 'ept' is that this function do not need to two reference points in order to create a new geometrical point. By just given a direction and a distance from a reference point, a new geometrical point can be created :
Input 6 : p=addpt(a,45,10)
Ans. 0, 7.071, 7.071
A geometrical point 'p' is created at a distance of 10 from point 'a' in the direction of 45 degree to the horizontal axis.
Next, we create a geometrical line between two points 'a' and 'b'. Let us called it 'lab' :
Input 7 : lab=gline(a,b)
Ans. 1, 0, 0
The function 'gline' is used to create a geometrical line and a list of (1, 0, 0) is returned. The first element has a value of 1 which indicated that the list is a representation of a geometrical line. The next two elements are the angle of the line in degree and the value of the y-intercept. In this case, the line's angle is degree 00 and the value of y-intercept is 0.
In defining a line, there are two more things to mention :
  1. The angle of the line should be ranged between 0 and less than 180. Any angle that is larger than 180 or less than 0 would be automatically converted to a corresponding angle within that range.
  2. If the angle is 90 degree, there is no y-intercept and the value of x coordinate would be stored in place of the y-intercept.
The function 'gline' support two other ways to define a line. We can define the same line above by a point and an angle from that point (point-slope form) as follows :
Input 8 : lab=gline(a,0)
Ans. 1, 0, 0
Or, we can define a line directly by specify its slope angle and value of y-intercept :
Input 9 : lab=gline(0,0)
Ans. 1, 0, 0
Next, we create a circle with center at point 'a' and radius 10 :
Input 10 : cc=gcircle(a,10)
Ans. 2, 0, 0, 0, 10
The result is a list containing three elements. The first element is 2 which is the number representing a circle. The second element is a list contains the point 'a' as the center point of the circle which is (0, 0, 0). The third element is the radius of the circle 10.
A triangle can also be created. First, we create a third point 'c' at (8,7), then we form the triangle using points 'a', 'b' and 'c' :
Input 11 : c=gpt(8,7)
Ans. 0, 8, 7
Input 12 : t=gtriangle(a,b,c)
Ans. 3, 0, 0, 0, 0, 10, 0, 0, 8, 7
The value of 3 as the first element of the list indicated that the list represents a triangle. The other element of th list is a list containing three points (0,0), (10,0) and (8,7) which is the corners of the triangle.
To plot all the above geometrical objects in one graph is as simple as the following :
Input 13 : draw('a|b|c|m|cc|lab|t',-15,15,0.1,-15)
The resulting graph is shown below :


Next, we begin to do some simple constructions.
1/ Given a line and a point not on the line, construct a parallel line through that point ?
We first define a point called 'a' and a line called 'l' as follows :
Input 14 : clear()
Input 15 : a=gpt(5,5)
Ans. 0, 5, 5
Input 16 : l=gline(30,-2)
Ans. 1, 110, -2
To make the parallel line 'll', we use point-slope form definition :
Input 17 : ll=gline(a,l(1))
Ans. 1, 110, 18.74
2/ Make a perpendicular line to line 'l' which passes through the same point 'a' ?
Input 18 : lp=gline(a,l(1)+90)
Ans. 1, 20, 3.18
Input 19 : draw('a|l|ll|lp',-10,10,0.1,-10)
The construction is shown on the following graph :


The point on the graph is 'a'. Lines 'll' and 'lp' are perpendicular to each other and line 'll' is parallel to 'l'.
3/ Construct an isosceles triangle abc with length ab = 10, length ac = length bc = 14 ? Find also the height of the triangle.
We set point 'a' at origin and point 'b' at (10,0).
Input 20 : clear()
Input 21 : a=gpt(0,0)
Ans. 0, 0, 0
Input 22 : b=gpt(10,0)
Ans. 0, 10, 0
To construct the point 'c', we need to use the function 'intersect' since point 'c' is the intersection point between two circles with center points at 'a' and 'b' and same radius 14 :
Input 23 : i=intersect(gcircle(a,14),gcircle(b,14))
Ans. 0, 5, 13.08, 0, 5, -13.08
The function 'intersect' return a list of two intersection points (0, 5, 13.08) and (0, 5, -13.08). We select i(0) as point 'c' :
Input 24 : c=i(0)
Ans. set c = 0, 5, 13.08
Input 25 : t=gtriangle(a,b,c)
Input 26 : draw('a|b|c|t',-1,20,0.1,-1)
The resulting construction is shown below :


We can verify the length of ac and bc using the function 'distance' :
Input 27 : distance(a,c)
Ans. 14
Input 28 : distance(b,c)
Ans. 14
The height of the triangle abc can also be found by the same function as follows :
Input 29 : distance(c,gline(a,b))
Ans. 13.08
The value is as expected as it is equal to the value of y-coordinate of the intersection point i(0).
4/ Given a circle and a point which is outside the circle, construct two tangents that touch the circle from that point ?
An arbitrarily point and a circle are created as follows :
Input 30 : clear()
Input 31 : a=gpt(-2,3)
Ans. 0, -2, 3
Input 32 : c=gcircle(gpt(5,-1),5)
Ans. 2, 0, 5, -1, 5
To find the tangent point of the circle, we use a function called 'tpt' :
Input 33 : t=tpt(a,c)
Ans. 0, 0.362, -2.867, 0, 4.254, 3.944
So, the two tangents are :
Input 34 : l1=gline(a,t(0))
Ans. 1, 111.93, -1.97
Input 35 : l2=gline(a,t(1))
Ans. 1, 8.58, 3.3
Input 36 : draw('a|c|t(0)|t(1)|l1|l2',-10,12,1,-10)
The construction is shown below :


5/ Construct a triangle and verify that the sum of the three interior angles is equal to 180 ?
We randomly select three points with both x and y coordinates ranged between -20 and 20 as follows :
Input 37 : clear()
Input 38 : a=gpt(random(3,-2000,2000)/100,random(3,-2000,2000)/100)
Ans. 0, 13.86, -5.07, 0, 14.55, 16.16, 0, 16.11, 2.15
The function 'random' is used to pick up three random numbers each to form the x and y coordinate for the three points. Here, it can be seen that the function 'gpt' can be used to construct not just one point but a list of points if the inputs to the function are not single numbers but two lists of numbers.
To verify the angle sum, we need to use a new function called 'anglepts'. It can measure the angle between three points. In our case, the three points are the list members of a which are a(0), a(1) and a(2).
The angle at point a(0) can be found as follows :
Input 39 : anglepts(a(2),a(0),a(1))
Ans. 15.447
Or,
Input 40 : anglepts(a(1),a(0),a(2))
Ans. 15.447
So, the total sum of the interior angles can be found by the formula :
Input 41 : anglepts(a(1),a(0),a(2))+anglepts(a(0),a(1),a(2))+anglepts(a(1),a(2),a(0))
Ans. 180
We can repeat the above procedures using function 'table' for 100 times and with each time, the triangle is formed by three different random points :
Input 42 : y=id(100)
Input 43 : table('a=gpt(random(3,-2000,2000)/100,random(3,-2000,2000)/100)|y(x)=anglepts(a(1),a(0),a(2))+anglepts(a(0),a(1),a(2))+anglepts(a(1),a(2),a(0))',id(100))
Input 44 : show('y:',4)
The below graph shows the beginning of the table of y :


The full list of y is actually has only one value, 180.
It should be noticed that the above construction is not a proof for the statement that the sum of interior angles of any triangle is 180. We can only claim that these examples do not falsify the statement.
Finally, we end this post with the following open question :
If f(x) = 180 for some random real numbers x,

can we say that f(x) = 180  for all real numbers x ?

No comments:

Post a Comment

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