Iteration of non-number expressions

gd shared this idea 13 years ago
Under Consideration

Currently the Iteration and the IteratonList commands can iterate only a GeoGebra function which means that a next value must be computed from the last of the already computed values and whose parameter and result can be only numbers. Some recursively defined functions use not only the last value but also a number of values before the last or even all the values before the value which is being computed to compute the next value.


I propose a variation of Iteration and IterationList which, instead of a function, takes an expression which can refer to the previous value with a variable given in another parameter, where the elements could be of any type:

    Iteration[Expression, Variable, x0, Number n]

    IterationList[Expression, Variable, x0, Number n]


Then a sequence with a recursive definition using the whole list of previous values could be formed like

    Iteration[Join[l, next value as expression of l], l, l0, n]

where l0 is the initial list and n is the number of additional values. E. g. the following would calculate the Fibonacci numbers up to the (n+1)th (counting from 0):

    Iteration[Join[l,Sum[Last[l,2]]], l, {1,1}, n]


In this type of IterationList restricting the type of elements to numbers is not necessary any more; with geometric objects it would be easier to implement sequences like this: http://dmentrard.free.fr/GEOGEBRA/Maths/outils/Carrea.html

With using lists as elements future predictions can be computed about systems such as pray-predator systems like these .


I know that these things can be done on the spreadsheet but that has a number of drawbacks: the number of iterations, or at least the maximal number of iterations is finite - and it is either low, or there is a high number of objects slowing the system even when only a few are used, or the user has to auto-complete the spreadsheet cells manually always instead of just using a slider. And more importantly spreadsheet auto-completion cannot be used in tools; also, if we create a tool which computes a recursive sequence with some parameters it would be particularly impractical if the tool was limited to a given number of iterations. I also know that in many cases the elements can be computed with closed forulae (not when random factors are used in the iterations) but many times it is unnecessarily complicated, or even impossible (or impossible to the user).

© 2022 International GeoGebra Institute