This page contains the commands found in the Toolbox, Math, List menu.
Return to the Prime Programming Page: Prime Programming Language (PPL)
Creates a list based on the expression, start point, end point, and increment. The increment can be omitted. The expression can be a constant.
The increment can be negative if start point > end point.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
MAKELIST(expression, variable, start point, end point, increment)
If increment = 1, it can be left out: MAKELIST(expression, variable, start point, end point)
Home Mode - RPN Entry
5: Expression in single quotes 4: Variable in single quotes 3: Start Point 2: End Point 1: Increment MAKELIST(5), press Enter
If increment = 1, it can be left out: 4: Expression in single quotes 3: Variable in single quotes 2: Start Point 1: End Point MAKELIST(4), press Enter
CAS Mode
Not available. Rev. 5166 Use the seq command instead. The seq command works similar to the MAKELIST command.
Output: A list.
Examples:
A list of constants: MAKELIST(4,X,1,4) returns {4, 4, 4, 4}
A sequence generated with of increment of 1: MAKELIST(X²,X,1,6) returns {1,4,9,16,25, 36}
A sequence generated with a specified increment: MAKELIST(X²,X,1,6,2) returns {1, 9, 25}
A sequence generated with a negative increment (start point > end point). MAKELIST(X²,X,6,1,-1) returns {36, 25,16,9,4,1}
Notes: Lists generated by MAKELIST must be stored to universal list variables L#, C#, and D#.
If increment is positive, the generation of the list stops when variable ≥ end point.
If increment is negative, the generation of the list stops when variable ≤ end point.
Access: Toolbox, Math, 6. List, 1. MAKELIST
See Also: seq, CONCAT, Intersect, Difference
Returns the intersection between lists. The intersected list contains elements that the two lists have in common. The lists can be different lengths and the number of lists to be compared can vary.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
Intersect(list 1, list 2, list 3, … , list n)
Home Mode - RPN Entry
n: list n … 2: list 2 1: list 1 Intersect(n), press Enter
CAS Mode
Intersect(list 1, list 2, list 3, … ,list n)
Output: A list. If there is no element in common, the list will be empty.
Examples:
Let L1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, L2 = {2, 4, 6, 8, 10}, and L3 = {1, 4, 9, 16}
Intersect(L1, L2) returns {2, 4, 6, 8, 10} Intersect(L1, L3) returns {1, 4, 9} Intersect(L1, L2, L3) returns {4}
Access: Toolbox, Math, 6. List, 2. Intersect
See Also: Difference, MAKELIST, CONCAT
Sorts a list of numbers in ascending order. In CAS mode, you can use SORT on sequences. Complex numbers are not sorted (logically).
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
SORT(list of numbers)
Home Mode - RPN Entry
1: list of numbers SORT, press Enter
The list is sorted automatically.
CAS Mode
sort(list of numbers) or sort(sequence of numbers)
Output: A list or sequence, sorted in ascending order.
Examples:
SORT({-7,9,-11,2}) returns {-11,-7,2,9}
Notes: Attempting to use SORT on vectors will return “Error: Bad argument type”.
Access: Toolbox, Math, 6. List, 3. SORT
See Also: REVERSE
Returns all the unique elements from a set of lists. Difference can be the thought of as the inverse of Intersection.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
Difference(list 1, list 2, list 3, … , list n)
Home Mode - RPN Entry
n: list n … 2: list 2 1: list 1 Difference(n), press Enter
CAS Mode
Difference(list 1, list 2, list 3, … ,list n)
Output: A list. If there is no unique element, the list will be empty.
Examples:
Let L1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, L2 = {2, 4, 6, 8, 10}, and L3 = {1, 4, 9, 16} Difference(L1, L2) returns {1,3,5,7,9} Difference(L1, L3) returns {2, 3, 5, 6, 7, 8, 10, 16} Difference(L1, L2, L3) returns {3, 5, 7, 4, 16}
Access: Toolbox, Math, 6. List, 4. Difference
See Also: Intersect, MAKELIST, CONCAT
Sorts a list of numbers in ascending order. In CAS mode, you can use SORT on sequences. Complex numbers are not sorted (logically).
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
SORT(list of numbers)
Home Mode - RPN Entry
1: list of numbers SORT, press Enter
The list is sorted automatically.
CAS Mode
sort(list of numbers) or sort(sequence of numbers)
Output: A list or sequence, sorted in ascending order.
Examples:
SORT({-7,9,-11,2}) returns {-11,-7,2,9}
Notes: Attempting to use SORT on vectors will return “Error: Bad argument type”.
Access: Toolbox, Math, 6. List, 3. SORT
See Also: REVERSE
Reverses the order of the list elements in the list. In CAS mode, this Reverse on sequences.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
REVERSE(list)
Home Mode - RPN Entry
1: list REVERSE, press Enter
The order of the elements are reversed automatically.
CAS Mode
REVERSE(list) or REVERSE(sequence)
Output: A list or sequence, sorted in ascending order.
Examples:
REVERSE({8,2,3,1}) returns {1, 3, 2, 8}
Use REVERSE and SORT to sort a list of numbers in descending order: REVERSE(SORT({7, 3, 11, 14, 2})) returns {14, 11, 7, 3, 2}
Access: Toolbox, Math, 6. List, 5. REVERSE
See Also: SORT
CONCAT is the concatenate command. CONCAT joins a set of lists and numbers and puts all of its arguments into one list.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
CONCAT(list or number, list or number, …)
Home Mode - RPN Entry
n: list or number … 2: list or number 1: list or number CONCAT(n), press Enter
CAS Mode
CONCAT(list or number or algebraic expression, list or number or algebraic expression, …)
Output: In Home Mode, a combined list of elements. In CAS Mode, a sequence of combined elements.
Examples:
Let L1 = {-1 , 0 , 1}. CONCAT(-2, L1) returns {-2, -1, 0, 1} CONCAT(L1, 2) returns {-1, 0, 1, 2} CONCAT(-2, L1, 2) returns {-2, -1, 0, 1, 2}
Combining lists: CONCAT({1, 3}, {6, 7}) returns {1, 3, 6, 7}
Access: Toolbox, Math, 6. List, 6. CONCAT
See Also: Intersect, MAKELIST, Difference
List Position: Returns the first position of which an element's list occurs. If the desired element is not in the left, POS returns 0.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
POS(list, desired element)
Home Mode - RPN Entry
2: list 1: desired element POS, press Enter
CAS Mode
POS(list, desired element)
Output: see description above
Examples:
Let L1 = {-1 , 0 , 1, 2, -1}. POS(L1, 1) returns 3. 1 is in position #3. POS(L1, 3) returns 0. 3 is not in L1. POS(L1, -1) returns 1. -1 occurs twice, positions #1 and #5. POS returns the first position the element is encountered.
Access: Toolbox, Math, 6. List, 7. POS
See Also: Intersect, Difference
Size command: Returns the number of elements of a list.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
SIZE(list)
Home Mode - RPN Entry
1: list SIZE, press ENTER
CAS Mode
SIZE(list)
Output: see description above
Examples:
SIZE({7,9,6}) returns 3
Access: Toolbox, Math, 6. List, 8. SIZE
See Also: POS
Calculates the difference between sequential elements. The resulting list will have one less element than the original list.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
∆LIST(list)
Home Mode - RPN Entry
1: list ∆LIST, press ENTER
CAS Mode
∆LIST(list of numbers and/or algebraic expressions)
Output: see description above
Examples:
∆LIST({8,9,5,6}) returns {1, -4, 1}
In CAS Mode: ∆LIST({8,9*x,5,6*x²}) returns {9*x-8, 5-9*x, 6*x²-5}
Access: Toolbox, Math, 6. List, 9. ∆LIST
See Also: ΣLIST, ΠLIST
Calculates the sum of all the list's elements.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
ΣLIST(list)
Home - RPN Entry
1: list ΣLIST, press ENTER
CAS Mode
ΣLIST(list of numbers and/or algebraic expressions)
Output: see description above
Examples:
ΣLIST({8,9,2}) returns 19
In CAS Mode: ΣLIST({1,x,x²}) returns 1+x+x²
Access: Toolbox, Math, 6. List, A. ΣLIST [press the Vars key]
See Also: ∆LIST, ΠLIST
Calculates the product of all the list's elements.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor
ΠLIST(list)
Home Mode - RPN Entry
1: list ΠLIST, press ENTER
CAS Mode
ΠLIST(list of numbers and/or algebraic expressions)
Output: see description above
Examples:
ΠLIST({8,9,2}) returns 144
In CAS Mode: ΠLIST({1,x,x²}) returns x*x^2 or x^3 when CAS is set to Maximum Simplification
Access: Toolbox, Math, 6. List, B. ΠLIST [press the Template key]
See Also: ∆LIST, ΣLIST
Creates a sequence based on the expression, start point, end point, and increment. The increment can be omitted. The expression can be a constant.
The increment can be negative if start point > end point.
seq can create a sequence of constants, and is more flexible than MAKELIST.
Syntax
Input:
Home Mode - Algebraic Entry Home Mode - Textbook Entry CAS Mode Program Editor
seq(expression, variable, start point, end point, increment)
If increment = 1, it can be left out: seq(expression, variable, start point, end point) OR seq(expression, x =start point..end point) (CAS Mode only)
If you want a vector with a copy of expression, such as a vector filled with the same constant: seq(expression, number of copies)
Home Mode - RPN Entry
5: Expression in single quotes 4: Variable in single quotes 3: Start Point 2: End Point 1: Increment seq(5), press Enter
If increment = 1, it can be left out: 4: Expression in single quotes 3: Variable in single quotes 2: Start Point 1: End Point seq(4), press Enter
Generate a vector of constants: 2: constant 1: number of copies seq(2), press Enter
Output: A vector.
Examples:
A list of constants: seq(4,4) returns [4, 4, 4, 4]
A sequence generated with of increment of 1: seq(X!, X, 1, 6) returns [1, 2, 6, 24, 120, 720]
A sequence generated with a specified increment: seq(X!, X, 1, 6, 2) returns [1, 6, 120]
A sequence generated with a negative increment (start point > end point). seq(X!, X, 6, 1, -1) returns [720, 120, 24, 6, 2, 1]
Notes: If increment is positive, the generation of the sequence stops when variable ≥ end point.
If increment is negative, the generation of the sequence stops when variable ≤ end point.
Access: Catalog: Toolbox, Ctlg
See Also: MAKELIST
Return to the Prime Programming Page: Prime Programming Language (PPL)