Difference between revisions of "Sequence Command"

From GeoGebra Manual
Jump to: navigation, search
(added v.4)
m
Line 2: Line 2:
 
{{command|list}}
 
{{command|list}}
 
; Sequence[Expression, Variable i, Number a, Number b]: Yields a list of objects created using the given expression and the index ''i'' that ranges from number ''a'' to number ''b''.
 
; Sequence[Expression, Variable i, Number a, Number b]: Yields a list of objects created using the given expression and the index ''i'' that ranges from number ''a'' to number ''b''.
{{Example|<code><nowiki>L = Sequence[(2, i), i, 1, 5]</nowiki></code> creates a list of points whose ''y''-coordinates range from 1 to 5: <code><nowiki>L = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5)}</nowiki></code>}}
+
{{Example|1=<code>L = Sequence[(2, i), i, 1, 5]</code> creates a list of points whose ''y''-coordinates range from 1 to 5: <code>L = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5)}</code>}}
 
; Sequence[Expression, Variable i, Number a, Number b, Increment]: Yields a list of objects created using the given expression and the index ''i'' that ranges from number ''a'' to number ''b'' with given increment.
 
; Sequence[Expression, Variable i, Number a, Number b, Increment]: Yields a list of objects created using the given expression and the index ''i'' that ranges from number ''a'' to number ''b'' with given increment.
{{Example| <code><nowiki>L = Sequence[(2, i), i, 1, 3, 0.5]</nowiki></code> creates a list of points whose ''y''-coordinates range from 1 to 3 with an increment of 0.5: <code><nowiki>L = {(2, 1), (2, 1.5), (2, 2), (2, 2.5), (2, 3)}</nowiki></code>.}}
+
{{Example|1=<code>L = Sequence[(2, i), i, 1, 3, 0.5]</code> creates a list of points whose ''y''-coordinates range from 1 to 3 with an increment of 0.5: <code>L = {(2, 1), (2, 1.5), (2, 2), (2, 2.5), (2, 3)}</code>.}}
 
{{Note|Since the parameters ''a'' and ''b'' are dynamic you could use [[Slider Tool|slider]] variables in both cases above as well.}}
 
{{Note|Since the parameters ''a'' and ''b'' are dynamic you could use [[Slider Tool|slider]] variables in both cases above as well.}}
 
; Sequence[<Number b>]
 
; Sequence[<Number b>]
 
:Creates list of numbers 1 to ''b'', e.g. {1,2,...,b}.  
 
:Creates list of numbers 1 to ''b'', e.g. {1,2,...,b}.  
{{Example| <code><nowiki>L = 2^Sequence[4]</nowiki></code> creates list {2,4,8,16}. See [[Lists]] for more information on list operations.}}
+
{{Example| 1=<code>L = 2^Sequence[4]</code> creates list {2,4,8,16}. See [[Lists]] for more information on list operations.}}

Revision as of 14:01, 18 April 2011


Sequence[Expression, Variable i, Number a, Number b]
Yields a list of objects created using the given expression and the index i that ranges from number a to number b.
Example: L = Sequence[(2, i), i, 1, 5] creates a list of points whose y-coordinates range from 1 to 5: L = {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5)}
Sequence[Expression, Variable i, Number a, Number b, Increment]
Yields a list of objects created using the given expression and the index i that ranges from number a to number b with given increment.
Example: L = Sequence[(2, i), i, 1, 3, 0.5] creates a list of points whose y-coordinates range from 1 to 3 with an increment of 0.5: L = {(2, 1), (2, 1.5), (2, 2), (2, 2.5), (2, 3)}.
Note: Since the parameters a and b are dynamic you could use slider variables in both cases above as well.
Sequence[<Number b>]
Creates list of numbers 1 to b, e.g. {1,2,...,b}.
Example: L = 2^Sequence[4] creates list {2,4,8,16}. See Lists for more information on list operations.
© 2024 International GeoGebra Institute