The implementation included a particular challenge as I wished to construct the area using the points in order of their x-values. That is, the polygon area is always representative of an area between a function and the x-axis and does not allow the user to manipulate it otherwise. Seven sides of the polygon connect the eight independent points. Two sides connect the points with the highest and lowest abscissae to the base, which is an interval of the x-axis. The polygon sides connect the point with the smallest abscissa to the point with the second smallest abscissa to the point with the third smallest abscissa and so on. This is different than a polygon whose sides connect point A to point B and point B to point C. Most notably, it does not allow the top seven edges of the polygon to violate the vertical line test.

**Finding the Maximum or Minimum of two values in GSP:**

I have occasionally made use of a calculation to determine the maximum or minimum of two numbers. Here are examples of such calculations that are supported in GSP:

**max(a,b) = ((sgn(a-b)+1)*a+(sgn(b-a)+1)*b)/2**

min(a,b) = ((sgn(a-b)+1)*b+(sgn(b-a)+1)*a)/2

min(a,b) = ((sgn(a-b)+1)*b+(sgn(b-a)+1)*a)/2

Figure out why it works, then verify that it works when a=b. It is a handy calculation that I have used recently to construct the interval (a,b) for a Riemann integral sketch; while a and b can switch orders, the smaller value of the two defines the initial point of the construction. I did use this some time ago in my LSRL sketch to scale residual plots so that the dimensions of the graph were each determined by the maximum and minimum of seven values. My approach then was to construct a tree-like set of max/min equations and define a tool to find the maximum of seven numbers by clicking on the seven values. This was a bit tedious, but effective if I only needed the largest or smallest. This does not easily address ordering the points or identifying the second largest of a list.

**Ordering Values in GSP:**

To order a list of eight values {a, b, c, d, e, f, g, h}, I made the following calculations*, one for each value:

rankA = sgn(a-b)+sgn(a-c)+sgn(a-d)+sgn(a-e)+sgn(a-f)+sgn(a-g)+sgn(a-h)

rankB = sgn(b-a)+sgn(b-c)+sgn(b-d)+sgn(b-e)+sgn(b-f)+sgn(b-g)+sgn(b-h)

rankC = sgn(c-a)+sgn(c-b)+sgn(c-d)+sgn(c-e)+sgn(c-f)+sgn(c-g)+sgn(c-h)

rankD = sgn(d-a)+sgn(d-b)+sgn(d-c)+sgn(d-e)+sgn(d-f)+sgn(d-g)+sgn(d-h)

rankE = sgn(e-a)+sgn(e-b)+sgn(e-c)+sgn(e-d)+sgn(e-f)+sgn(e-g)+sgn(e-h)

rankF = sgn(f-a)+sgn(f-b)+sgn(f-c)+sgn(f-d)+sgn(f-e)+sgn(f-g)+sgn(f-h)

rankG = sgn(g-a)+sgn(g-b)+sgn(g-c)+sgn(g-d)+sgn(g-e)+sgn(g-f)+sgn(g-h)

rankH = sgn(h-a)+sgn(h-b)+sgn(h-c)+sgn(h-d)+sgn(h-e)+sgn(h-f)+sgn(h-g)

The calculation rankA would have a value of 7 if a is the maximum in the set and -7 if a is the minimum. If a is the second smallest, then whenever we subtract the minimum we will get a positive "sgn" and the other six terms in the calculation will be negative, making rankA=-5. Thus, the eight calculations will map the eight values to {-7, -5, -3, -1, 1, 3, 5, 7}, provided that no two of the values are equal**. I could then plot the points (rankA, a), (rankB, b), (rankC, c), etc.*** At that point I could find, say the second highest value by looking for the y-value of the plotted point whose x-value was 5. Now a human user can see the plotted points as an ordered ascending sequence, but the computer identifies each point with its name, so determining which point was the maximum involves an inverse approach. For this I defined a polynomial f(x) passing through the eight points. Now f(5) gives the second largest value, f(7) gives the maximum, f(-3) gives the sixth largest value, no matter which point possesses that distinction. These values I used for my construction, so that if the independent points change order the points defining the construction still maintain their ordering.

This solution, once constructed is of course tailored to eight points and a different number of points would need to be individually approached. The ability to define custom tools is really what makes this possible, since the construction of a seventh degree polynomial through eight points is not something I would be inclined to do more than once. I appreciated the task for its logical demands and further exposure to the ideas of generality in dynamic geometry.

*

*This type of repeated tedious calculation can streamlined by carefully defining a custom tool that does most of the work.*

***For my purposes in the construction described, it is desirable that two equal values should lead to an undefined ordering. I am trying to use the ordering as a function and if two values share a rank, my construction is ambiguous.*

***For the sake of discussion, this is the simplest way to describe the plotted points, but in fact if one looks at the construction in

***For the sake of discussion, this is the simplest way to describe the plotted points, but in fact if one looks at the construction in

*the file I am describing*

*, I have done something slightly different. To keep them out of the way of my sketch, I actually multiplied each of the "rank" calculations by 0.1 and subtracted 2, so that they ranged from -2.7 to -1.3 before plotting.*

## No comments:

## Post a Comment