Difficulties creating a graphics function

Alasdair shared this problem 4 months ago
Not a Problem


I am using GeoGebra in a numerical methods class, and I want to draw some cobweb diagrams, illustrating the successive approximations of the iteration

x[n] = g(x[n-1])

I have a list L of the x[k] values which is created with IterationList. What I want to do is to plot the Polyline through the points

(L(1), L(1))



(L(2), L(3))

(L(3), L(3))

and so on. Ideally, I'd like to make a command "Cobweb(L, n)" which would draw that Polyline, given the list, and taking the first n points from it.

My attempt so far is:

Cobweb(Ls,n) = Polyline[Flatten(Sequence({(Ls(k),Ls(k)),(Ls(k),Ls(k+1))},k,1,n))]

but I get an error about "Command Sequence: Illegal argument: Function n". Does this mean I can't create a command which includes a variable indicating the number of elements of a sequence?

And for that matter, is there a better, more flexible way, of creating such a function other than one long single nested command as shown here? Should I be creating a Custom Tool for this?

Two other more minor questions:

  1. How can I change the font used in the Algebra View? At the moment it's a sans-serif font which means that a list name, if automatically assigned, is something like "l4": the lower case L is indistinguishable from a capital "I". Either I'd like lists to be assigned capital letters, or use a different font.
  2. How can I copy commands in and out of the Algebra View? My Cobweb attempt above, because it returns an error, sort of "locks up" the Algebra View, and I can't enter any more commands without deleting that one. But then where does it go, and how can I get it back for future exploration?

Thank you very much!



Comments (2)


tú quieres algo parecido a esto?

Files: foro.ggb

Muchas gracias! Thank you very much - I was hoping for a single command, but in the end I discovered that I could do the same thing with Polyline - very similar to your sequence of lists and segments.

From Google translate:

Muchas gracias, esperaba un solo comando, pero al final descubrí que podía hacer lo mismo con Polyline, muy similar a su secuencia de listas y segmentos.

© 2020 International GeoGebra Institute