[color=#999999][color=#999999][color=#999999]This activity belongs to the [i]GeoGebra book[/i] [url=https://www.geogebra.org/m/h3gbmymu]Linkages[/url].[/color][/color][/color][br][br]GeoGebra allows two types of scripts:[br][list][*]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.[br][/*][/list]As a sample of the use of the latter, we extend the open chain of the [url=https://www.geogebra.org/m/h3gbmymu#material/kfbevjy5]previous construction[/url] 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.[br][br]When moving A1:[br] var j = 2;[br] while (j <= 40) {[br] ggbApplet.evalCommand("SetValue(A" + j + ", Intersect(Ray(A" + (j-1) + ", A" + j + "), Circle(A" + (j-1) + " ,1)))");[br] j++;[br] }[br][br]When moving A40:[br] var j = 39;[br] while (j > 0) {[br] ggbApplet.evalCommand("SetValue(A" + j + ", Intersect(Ray(A" + (j+1) + ", A" + j + "), Circle(A" + (j+1) + " ,1)))");[br] j--;[br] }
[color=#999999]Author of the construction of GeoGebra: [color=#999999][url=https://www.geogebra.org/u/rafael]Rafael Losada[/url][/color][/color]