List and Sequence Commands

Append

Append[List, Object]: Appends the object to the list.          
Example: Append[{1, 2, 3}, 4] gives you {1, 2, 3, 4}.

Append[Object, List]: Appends the list to the object.          
Example: Append[4, {1, 2, 3}] gives you {4, 1, 2, 3}.

CountIf

CountIf[Condition, List]: Counts the number of elements in the list satisfying the condition. 
Examples:

·        CountIf[x < 3, {1, 2, 3, 4, 5}] gives you the number 2.

·        CountIf[x<3, A1:A10] where A1:A10 is a range of cells in the spreadsheet, counts all cells whose values are less than 3.

Element

Element[List, Number n]: Yields the nth element of the list.          
Note: The list can contain only elements of one object type (e. g., only numbers or only points).

First

First[List]: Returns the first element of the list.

First[List, Number n of elements]: Returns a new list that contains just the first n elements of the list.

Insert

Insert[Object, List, Position]: Inserts the object in the list at the given position.
Example: Insert[x^2, {1, 2, 3, 4, 5}, 3] places x2 at the third position and gives you the list {1, 2, x2, 3, 4, 5}. 
Note: If the position is a negative number, then the position is counted from the right. 
Example: Insert[x^2, {1, 2, 3, 4, 5}, -1] places x2 at the end of the list and gives you the list {1, 2, 3, 4, 5, x2}.

Insert[List 1, List 2, Position]: Inserts all elements of list1 in list2 at the given position.           
Example: Insert[{11, 12}, {1, 2, 3, 4, 5}, 3] places the elements of list1 at the third (and following) position(s) of list2 and gives you the list
{1, 2, 11, 12, 3, 4, 5}. 
Note: If the position is a negative number, then the position is counted from the right. 
Example: Insert[{11, 12}, {1, 2, 3, 4, 5}, -2] places the elements of list1 at the end of list2 before its last element and gives you {1, 2, 3, 4, 11, 12, 5}.

Intersection

Intersection[List 1, List 2]: Gives you a new list containing all elements that are part of both lists.

IterationList

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.           
Example: After defining function f(x) = x^2 the command     
L = IterationList[f, 3, 2] gives you the list L = {3, 9, 81}.

Join

Join[List 1, List 2, ...]: Joins the two (or more) lists.
Note: The new list contains all elements of the initial lists even if they are the same. The elements of the new list are not re-ordered. 
Example: Join[{5, 4, 3}, {1, 2, 3}] creates the list {5, 4, 3, 1, 2, 3}.

Join[List of lists]: Joins the sub-lists into one longer list.
Note: The new list contains all elements of the initial lists even if they are the same. The elements of the new list are not re-ordered. 
Examples:

·        Join[{{1, 2}}] creates the list {1, 2}.

·        Join[{{1, 2, 3}, {3, 4}, {8, 7}}] creates the list
{1, 2, 3, 3, 4, 8, 7}.

KeepIf

KeepIf[Condition, List]: Creates a new list that only contains those elements of the initial list that fulfill the condition.
Example: KeepIf[x<3, {1, 2, 3, 4, 1, 5, 6}] returns the new list {1, 2, 1}.

Last

Last[List]: Returns the last element of the list.

Last[List, Number n of Elements]: Returns a list containing just the last n elements of the list.

Length

Length[List]: Yields the length of the list, which is the number of list elements.

Min

Min[List]: Returns the minimal element of the list.

Max

Max[List]: Returns the maximal element of the list.

Product

Product[List of Numbers]: Calculates the product of all numbers in the list.

RemoveUndefined

RemoveUndefined[List]: Removes undefined objects from a list.    
Example: RemoveUndefined[Sequence[(-1)^i, i, -3, -1, 0.5]] removes the second and fourth element of the sequence which have a non-integer exponent and therefore, are undefined.

Reverse

Reverse[List]: Reverses the order of a list.

Sequence

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 as well.

Sort

Sort[List]: Sorts a list of numbers, text objects, or points.      
Note: Lists of points are sorted by x-coordinates.   
Examples:

·        Sort[{3, 2, 1}] gives you the list {1, 2, 3}.

·        Sort[{"pears", "apples", "figs"}] gives you the list elements in alphabetical order.

·        Sort[{(3, 2), (2, 5), (4, 1)}] gives you {(2, 5), (3, 2), (4, 1)}.

Sum

Sum[List]: Calculates the sum of all list elements.        
Note: This command works for numbers, points, vectors, text, and functions.
Examples:

·        Sum[{1, 2, 3}] gives you a number a = 6.

·        Sum[{x^2, x^3}] gives you f(x) = x2 + x3.

·        Sum[Sequence[i,i,1,100]] gives you a number a = 5050.

·        Sum[{(1, 2), (2, 3)}] gives you a point A = (3, 5).

·        Sum[{(1, 2), 3}] gives you point B = (4, 2).

·        Sum[{"a","b","c"}] gives you the text "abc".

Sum[List, Number n of Elements]: Calculates the sum of the first n list elements.
Note: This command works for numbers, points, vectors, text, and functions.
Example: Sum[{1, 2, 3, 4, 5, 6}, 4] gives you the number a = 10.

Take

Take[List, Start Position m, End Position n]: Returns a list containing the elements from positions m to n of the initial list.

Union

Union[List 1, List 2]: Joins the two lists and removes elements that appear multiple times.


www.geogebra.org