Free string

This activity belongs to the GeoGebra book Linkages. GeoGebra allows two types of scripts:
  • Those specific to this Dynamic Geometry program, made up of successive commands lines. They are the ones we have used so far, simple and without the need to know programming.
  • Those typical of programming in Javascript.
As a sample of the use of the latter, we extend the open chain of the previous construction from 4 points to 40 points (A1, ..., A40, all free). By hiding the intermediate points (A2, ..., A39), which are now left without a script, we get the result to simulate a string. As A1 moves, the wave of its movement is transmitted through all intermediate points up to A40, and vice versa.
The Javascript code used is detailed below. When moving A1: var j = 2; while (j <= 40) { ggbApplet.evalCommand("SetValue(A" + j + ", Intersect(Ray(A" + (j-1) + ", A" + j + "), Circle(A" + (j-1) + " ,1)))"); j++; } When moving A40: var j = 39; while (j > 0) { ggbApplet.evalCommand("SetValue(A" + j + ", Intersect(Ray(A" + (j+1) + ", A" + j + "), Circle(A" + (j+1) + " ,1)))"); j--; }
Author of the construction of GeoGebra: Rafael Losada