Difference between revisions of "Iteration Command"
From GeoGebra Manual
m |
m (Text replace - ";(.*)\[(.*)\]" to ";$1($2)") |
||
Line 1: | Line 1: | ||
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|function}} | <noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|function}} | ||
− | ;Iteration | + | ;Iteration( <Function>, <Start Value>, <Number of Iterations> ) |
:Iterates the function ''n'' times (''n'' = number of iterations) using the given start value. | :Iterates the function ''n'' times (''n'' = number of iterations) using the given start value. | ||
:{{Examples| 1=<div> | :{{Examples| 1=<div> | ||
Line 6: | Line 6: | ||
:*''Repeated addition'': To obtain the repeated addition of 7 to the number 3, define <code>g(x) = x + 7</code>, then <code>Iteration[g, 3, 4]</code> yields (((3+7) +7) +7) +7 = 31.</div>}} | :*''Repeated addition'': To obtain the repeated addition of 7 to the number 3, define <code>g(x) = x + 7</code>, then <code>Iteration[g, 3, 4]</code> yields (((3+7) +7) +7) +7 = 31.</div>}} | ||
− | ;Iteration | + | ;Iteration( <Expression>, <Variable Name>, ..., <Start Values>, <Number of Iterations> ) |
:Iterates the expression ''n'' times (''n'' = number of iterations) using the given start value. The result is then the last element of the output of [[IterationList Command]], with the same parameters. | :Iterates the expression ''n'' times (''n'' = number of iterations) using the given start value. The result is then the last element of the output of [[IterationList Command]], with the same parameters. | ||
{{Note|See [[IterationList Command]] for further details.}} | {{Note|See [[IterationList Command]] for further details.}} |
Revision as of 17:15, 7 October 2017
- Iteration( <Function>, <Start Value>, <Number of Iterations> )
- Iterates the function n times (n = number of iterations) using the given start value.
- Examples:
- After defining
f(x) = x^2
the commandIteration[f, 3, 2]
gives you the result (32)2 = 81. - Repeated addition: To obtain the repeated addition of 7 to the number 3, define
g(x) = x + 7
, thenIteration[g, 3, 4]
yields (((3+7) +7) +7) +7 = 31.
- After defining
- Iteration( <Expression>, <Variable Name>, ..., <Start Values>, <Number of Iterations> )
- Iterates the expression n times (n = number of iterations) using the given start value. The result is then the last element of the output of IterationList Command, with the same parameters.
Note: See IterationList Command for further details.