Google Classroom
GeoGebraGeoGebra Classroom

Technical details

Computational background

We think that most readers of this papers are neither technicians, nor mathematicians, but teachers. Nevertheless, it is good to know some computational details how the LocusEquation command works. Computing a locus equation can be time consuming even for fast computers. Basically, a set of equations has to be created in the background: the more objects we have in our construction, the more variables and equations we need. After setting up algebraic equations, they have to be solved symbolically in an efficient way. For this task we use Gröbner bases. GeoGebra uses the Giac computer algebra system to compute Gröbner bases as efficiently as possible, but the general method is still double exponentional in the number of variables. On the other hand, Giac runs in a web browser in today's computers, and this slows down computations by almost one magnitude. (This means that computing locus equation in the desktop version of GeoGebra is still much faster than observing the construction in a web browser. For the future, however, there are plans to speed up JavaScript computations by substituting them with native instructions.) Giac is a powerful CAS, but it can slow down if bogus input must be processed. That is why it is desired to solve equations only having integer coefficients. To achieve this, it is suggested to use so-called dynamic coordinates in GeoGebra: to create free point A', B', C' ... first and then define point A=DynamicCoordinates[A',round(x(A')),round(y(A'))], then similar definitions for points B and C and so on. Also using "easy" coordinates will speed up computations. For example, putting A into the origin, B on the x-axis and using small integers instead of larger numbers may decrease computation time significantly.

Supported construction steps

Since the Gröbner basis computation assumes algebraic (polynomial) equations, there are restrictions for the available construction steps for the LocusEquation command. First of all, only Euclidean construction steps are supported. Even if a step could be converted into a Euclidean construction, some non-trivial way of wording are not supported, for example, when the user defines a parabola by entering its explicit formula, then it cannot be discovered by the LocusEquation command at the moment. Instead, the parabola must be constructed by using the appropriate GeoGebra tool. Most Euclidean two dimensional construction steps are already supported. To see the full list please refer to the Javadoc at the GeoGebra Developer Wiki. If a geometry problem is described fully or partially by formulas, it may be difficult to translate it to a purely Euclidean construction. Below we will see an example how this can be achieved.

Agnesi's witch

Here we provide two examples to implement Agnesi's witch in GeoGebra. The first approach will be a general way which will result in slow computation and some extra components. The second approach will be much faster and results only in one extra component. For the first approach we simply consider the formula . Here we need to define the unit (1) and compute the square of x based on this unit, then add these two lengths. Then we need to compute the reciprocal of the result, and translate the final length y to the correct position of the coordinate system.
In this figure we can see a numerical locus in red and a symbolical locus in blue. In fact Agnesi's curve is just a part of these curves since the conversion of its formula will introduce extra components. Let us follow the steps we made in this figure:
  1. Point A is created (origin).
  2. Point B is created, (0,1).
  3. Line a is the y-axis.
  4. Line b is the x-axis.
  5. Point C lies on the x-axis, it will be the projection of a point of the curve to the x-axis, i.e. its abscissa will be x.
  6. We will use the intercept theorem to construct . So we create a triangle with sides having length 1 (AB) and x (AC). This triangle will be right, but this property is not necessary. The third side of the triangle will be line c.
  7. For the intercept theorem we prepare length x also on line AB by drawing circle d.
  8. Point D is intersection of line a and circle d. (In fact there are two intersection points here, but we use the "upper" one.) Now .
  9. Line e is parallel to D and lies on D.
  10. Point E is intersection of line b and d. By using the intercept theorem obviously .
  11. We are preparing addition, thus we draw another circle f around the origin having unit radius.
  12. Point F is intersection of line b and circle f. (In fact there are two intersection points here, but we use the "left" one.) Now .
  13. We would like to copy the unit length, so we create segment g as the unit (i.e., AB).
  14. Circle h is around point E with unit radius.
  15. Line i is perpendicular to line b and lies on point E.
  16. Point G is intersection of line i and circle h. (In fact there are two intersection points here, but we use the "upper" one.) Now GE is a copy of the unit. This is a preparation for applying another intercept theorem.
  17. We will use triangle EFG for the intercept theorem, thus we draw line FG as line j.
  18. Point H is again an intersection of circle h and line b. (The "left" one.) Now we copied the unit as EH, too.
  19. Drawing line k as a parallel one with line j through H.
  20. Intersection of lines i and k is point I.
  21. Now applying the intercept theorem for length IE we obtain . This will be y.
  22. Now we will copy this length to point C orthogonally. Thus we draw a perpendicular with line b through C. This will be line m.
  23. We copy length IE to point C upwards, thus we draw circle p around C with radius IE.
  24. "Upper" intersection point of m and p will be point J.
  25. Locus of point J while C is moving on the x-axis is what we search for. In fact, only those points J are proper which have positive abscissa.
  26. Finally, LocusEquation shows a 12 degree polynomial, , which is a product of the cubic Agnesi curve and its reflection to the x-axis, and two other cubics (reflections of each other), namely , , and .
After finishing this construction it is clear that we almost surely obtain extra components since it is impossible to exclude the "right" intersection point in steps 12 and 18, for example. The construction process described above illustrates the weakness of the Euclidean (i.e. in fact algebraic) method.
Finally we refer to a more simple definition of Agnesi's curve, also used by a Google "doodle" on the 296th anniversary of Maria Agnesi's birth on 16 May 2014.
Image
This "easy" definition allows GeoGebra to show Agnesi's witch much faster than above and make it computationally possible to drag the input points even in a web browser. Of course, in many cases such a simplification is an intellectual challenge by searching for algebraic or geometric simplifications to result in less variables in the Gröbner basis computations.
As an exercise, we leave to the Reader to prove that the trace of point F is if B is in the origin, A=(0,1/2) and C=(0,1). Also an exercise in GeoGebra to improve this figure: use DynamicCoordinates instead of point capturing to grid points (which yields non-continuous motion for point D). Another improvement can be to put the equation text into a fix position, preferably in the second Graphics View.