Difference between revisions of "Sequence Command"

From GeoGebra Manual
Jump to: navigation, search
m (Text replace - "<div class="box info"> 48px|left This page is part of the official manual for print and pdf. For structural reasons normal users can't edit this page. If you found any errors on this page please contact )
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.2}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|cas=true|list}}
{{command|cas=true|list}}
+
; Sequence( <Expression>, <Variable k>, <Start Value a>, <End Value b> )
; Sequence[ <Expression>, <Variable i>, <Number a>, <Number b>]
+
:Yields a list of objects created using the given expression and the index ''k'' that ranges from start value ''a'' to end value ''b''.
:Yields a list of objects created using the given expression and the index ''i'' that ranges from number ''a'' to number ''b''.
+
:{{examples|1=<div>
:{{example|1=<div><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>.</div>}}
+
:*<code><nowiki>Sequence((2, k), k, 1, 5)</nowiki></code> creates a list of points whose ''y''-coordinates range from 1 to 5: ''{(2, 1), (2, 2), (2, 3), (2, 4), (2, 5)}''
;Sequence[ <Expression>, <Variable i>, <Number a>, <Number b>, <Increment>]
+
:*<code>Sequence(x^k, k, 1, 10)</code> creates the list {''x, x², x³, x⁴, x⁵, x⁶, x⁷, x⁸, x⁹, x¹⁰''}</div>}}
: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 k>, <Start Value a>, <End Value b>, <Increment> )
:{{example|1=<div><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>.</div>}}
+
:Yields a list of objects created using the given expression and the index ''k'' that ranges from start value ''a'' to end value ''b'' with given increment.
 +
:{{examples|1=<div>
 +
:*<code><nowiki>Sequence((2, k), k, 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'': ''{(2, 1), (2, 1.5), (2, 2), (2, 2.5), (2, 3)}''
 +
:*<code>Sequence(x^k, k, 1, 10, 2)</code> creates the list {''x, x³, x⁵, x⁷, x⁹''}.</div>}}
 
:{{note| 1=Since the parameters ''a'' and ''b'' are dynamic you could use [[Slider Tool|slider]] variables in both cases above as well.}}
 
:{{note| 1=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( <End Value > )
:Creates list of numbers 1 to ''b'', e.g. {1, 2, ..., b}.  
+
:Creates a list of integers from 1 to the given end value.
:{{example| 1=<div><code><nowiki>L = 2^Sequence[4]</nowiki></code> creates list ''{2, 4, 8, 16}''.</div>}}
+
:{{examples| 1=<div>
 +
:*<code><nowiki>Sequence(4)</nowiki></code> creates the list ''{1, 2, 3, 4}''.
 +
:*<code><nowiki>2^Sequence(4)</nowiki></code> creates the list ''{2, 4, 8, 16}''.</div>}}
 +
;Sequence( <Start value k >, <End value n > )
 +
: Creates a list of integers from ''k'' to ''n'' (increasing or decreasing).  
 +
:{{Examples| 1=<div>
 +
:*<code><nowiki>Sequence(7,13)</nowiki></code> creates the list {''7, 8, 9, 10, 11, 12, 13''}
 +
:*<code><nowiki>Sequence(18,14)</nowiki></code> creates the list {''18, 17, 16, 15, 14''}
 +
:*<code><nowiki>Sequence(-5, 5)</nowiki></code> creates the list {''-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5''}.
 +
::{{Note|This syntax can be further simplified: instead of using e.g. the formal <code><nowiki>Sequence(7,13)</nowiki></code> it is possible to obtain the same result by typing in the input bar <code><nowiki>7..13</nowiki></code>  .}}</div>}}
 
:{{note| 1=See [[Lists]] for more information on list operations.}}
 
:{{note| 1=See [[Lists]] for more information on list operations.}}
==CAS Syntax==
 
;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|1=<div><code><nowiki>Sequence[x^i, i, 1, 10]</nowiki></code> generates the sequence ''{x, x², x³, x⁴, x⁵, x⁶, x⁷, x⁸, x⁹, x¹⁰}''.</div>}}
 
;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|1=<div><code><nowiki>Sequence[x^i, i, 1, 10, 2]</nowiki></code> generates the sequence ''{x, x³, x⁵, x⁷, x⁹}''.</div>}}
 
;Sequence[ <Number b> ]
 
:Creates list of numbers 1 to ''b'', e.g. {1, 2, ..., b}.
 
:{{example|1=<div><code><nowiki>Sequence[5]</nowiki></code> generates the sequence ''{1, 2, 3, 4, 5}''.</div>}}
 

Latest revision as of 23:26, 6 August 2019


Sequence( <Expression>, <Variable k>, <Start Value a>, <End Value b> )
Yields a list of objects created using the given expression and the index k that ranges from start value a to end value b.
Examples:
  • Sequence((2, k), k, 1, 5) creates a list of points whose y-coordinates range from 1 to 5: {(2, 1), (2, 2), (2, 3), (2, 4), (2, 5)}
  • Sequence(x^k, k, 1, 10) creates the list {x, x², x³, x⁴, x⁵, x⁶, x⁷, x⁸, x⁹, x¹⁰}
Sequence( <Expression>, <Variable k>, <Start Value a>, <End Value b>, <Increment> )
Yields a list of objects created using the given expression and the index k that ranges from start value a to end value b with given increment.
Examples:
  • Sequence((2, k), k, 1, 3, 0.5) creates a list of points whose y-coordinates range from 1 to 3 with an increment of 0.5: {(2, 1), (2, 1.5), (2, 2), (2, 2.5), (2, 3)}
  • Sequence(x^k, k, 1, 10, 2) creates the list {x, x³, x⁵, x⁷, x⁹}.
Note: Since the parameters a and b are dynamic you could use slider variables in both cases above as well.
Sequence( <End Value > )
Creates a list of integers from 1 to the given end value.
Examples:
  • Sequence(4) creates the list {1, 2, 3, 4}.
  • 2^Sequence(4) creates the list {2, 4, 8, 16}.
Sequence( <Start value k >, <End value n > )
Creates a list of integers from k to n (increasing or decreasing).
Examples:
  • Sequence(7,13) creates the list {7, 8, 9, 10, 11, 12, 13}
  • Sequence(18,14) creates the list {18, 17, 16, 15, 14}
  • Sequence(-5, 5) creates the list {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}.
Note: This syntax can be further simplified: instead of using e.g. the formal Sequence(7,13) it is possible to obtain the same result by typing in the input bar 7..13 .
Note: See Lists for more information on list operations.
© 2024 International GeoGebra Institute