Difference between revisions of "IterationList Command"

From GeoGebra Manual
Jump to: navigation, search
(create official page from pdf)
 
m (typo, indentation, spacing)
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|function}}
; IterationList[Function, Number x0, Number n]: Gives you a list of length ''n+1'' whose elements are iterations of the function starting with the value ''x0''.
+
; IterationList[ <Function>, <Start Value>, <Number of Iterations> ]
: Example: After defining <tt>f(x) = x+7</tt> the command <tt>IterationList[f,3,4]</tt> gives you the list ''L = {3, 10, 17, 24, 31}''.
+
: Gives you a list of length ''n+1'' (''n'' = number of iterations) whose elements are iterations of the function starting with the start value.
 +
: {{Example| 1=After defining <code>f(x) = x^2</code> the command <code>IterationList[f, 3, 2]</code> gives you the list ''{3, 9, 81}''.}}
 +
 
 +
;IterationList[ <Expression>, <Variable Name>, ..., <Start Values>, <Number of Iterations> ]
 +
: Gives you a list of length ''n+1'' (''n'' = number of iterations) whose elements are iterations of the expression starting with the given start value. In each iteration the variables in the expression are substituted by last elements of the list. There should be at least as many start values as there are variables, otherwise the result is ''undefined''.
 +
:{{Example|1=Let ''A'', ''B'' be points. The command <code>IterationList[Midpoint[A, C], C, {B}, 3]</code> internally computes values ''C''<sub>0</sub> = ''B'', &nbsp; ''C''<sub>1</sub> = ''Midpoint''[''A'', ''C''<sub>0</sub>], &nbsp; ''C''<sub>2</sub> = ''Midpoint''[''A'', ''C''<sub>1</sub>], &nbsp; ''C''<sub>3</sub> = ''Midpoint''[''A'', ''C''<sub>2</sub>] and yields {''C''<sub>0</sub>, ''C''<sub>1</sub>, ''C''<sub>2</sub>, ''C''<sub>3</sub>}. Hence for ''A'' = (0,0) and ''B'' = (8,0) the result will be {(8,0), (4,0), (2,0), (1,0)}.}}
 +
:{{Example|1=Let ''f''_0, ''f''_1 be numbers. <code>IterationList[a + b, a, b, {f_0, f_1},5]</code> fills the first 2 values of the resulting list from the start values. Afterwards the values are computed as ''f''<sub>2</sub> = ''f''<sub>0</sub> + ''f''<sub>1</sub>, &nbsp; ''f''<sub>3</sub> = ''f''<sub>1</sub> + ''f''<sub>2</sub>, &nbsp; ''f''<sub>4</sub> = ''f''<sub>2</sub> + ''f''<sub>3</sub>, &nbsp; ''f''<sub>5</sub> = ''f''<sub>3</sub> + ''f''<sub>4</sub>. Hence for ''f''_0 = ''f''_1 = 1 the result will be {1, 1, 2, 3, 5, 8}.}}
 +
{{Note|1=See also [[Iteration_Command]].}}

Revision as of 10:38, 9 August 2015


IterationList[ <Function>, <Start Value>, <Number of Iterations> ]
Gives you a list of length n+1 (n = number of iterations) whose elements are iterations of the function starting with the start value.
Example: After defining f(x) = x^2 the command IterationList[f, 3, 2] gives you the list {3, 9, 81}.


IterationList[ <Expression>, <Variable Name>, ..., <Start Values>, <Number of Iterations> ]
Gives you a list of length n+1 (n = number of iterations) whose elements are iterations of the expression starting with the given start value. In each iteration the variables in the expression are substituted by last elements of the list. There should be at least as many start values as there are variables, otherwise the result is undefined.
Example: Let A, B be points. The command IterationList[Midpoint[A, C], C, {B}, 3] internally computes values C0 = B,   C1 = Midpoint[A, C0],   C2 = Midpoint[A, C1],   C3 = Midpoint[A, C2] and yields {C0, C1, C2, C3}. Hence for A = (0,0) and B = (8,0) the result will be {(8,0), (4,0), (2,0), (1,0)}.
Example: Let f_0, f_1 be numbers. IterationList[a + b, a, b, {f_0, f_1},5] fills the first 2 values of the resulting list from the start values. Afterwards the values are computed as f2 = f0 + f1,   f3 = f1 + f2,   f4 = f2 + f3,   f5 = f3 + f4. Hence for f_0 = f_1 = 1 the result will be {1, 1, 2, 3, 5, 8}.
Note: See also Iteration_Command.
© 2024 International GeoGebra Institute