# TI-Lists/List Operation Functions

There are several kinds of functions that use or create lists. These functions are found in the LIST menus. The LIST menus are accessed by the 2nd function of the STAT key. It is just below the DEL key. Move over to the right one or two times to access the List menus.

There are several kinds of functions that use or create lists. These functions are found in the LIST menus. The LIST menus are accessed by the 2nd function of the STAT key. It is just below the DEL key. The functions that create new lists or change existing ones are found in the LIST OPS menu.

## Functions that change lists.[edit | edit source]

The functions in this section change existing lists.

### dim([edit | edit source]

The list dimension function (**2nd LIST OPS 3**) has several uses. It will tell you the length of a list (how many elements are in the list.)

- {1,3,5,7,9,11} STO> L1
- {1 3 5 7 9 11}

- dim(L1)
- 6

- dim({1,5})
- 2

The result of a dim( expression is a single number.

By storing a number in the dim( of a list you can create a new list with a certain number of elements or change the length of an existing list.

Creating a new list, fills it with elements that are all zero.

- 3 STO> dim(L1)
- 3

- L1
- {0 0 0}

A list can be made shorter thus deleting elements on the end, or longer thus adding elements with zero value onto the end.

- {2,4,6,8,10} STO> L1
- {2 4 6 8 10}

- 3 STO> dim(L1)
- 3

- L1
- {2 4 6}

- 6 STO> dim(L1)
- 6

- L1
- {2 4 6 0 0 0}

### Sorting[edit | edit source]

The sorting functions **SortA(** and **SortD(** are the first functions in the List Ops menu: (**2nd LIST OPS 1**) and (**2nd LIST OPS 2**). These functions sort the elements of the specified list. The first does an ascending sort (smallest item first); the second does a descending sort (largest item first).

These functions will not work on lists given with curly brackets. The parameter in the parentheses must be a list name. This is because the calculator operates on this list in memory as it is rearranged. The previous order of items is no longer available. Sorting does not create a new list.

- {3,6,2,4} STO> L1
- {3 6 2 4}

- SortA(L1)
- Done

- L1
- {2 3 4 6}

A decreasing sort works in a similar way.

- {6,8,2,9,4} STO> L2
- {6 8 2 9 4}

- SortD(L2)
- Done

- L2
- {9 8 6 4 2}

### Fill([edit | edit source]

This function (**2nd LIST OPS 4**) changes the specified list variable by replacing each element with the same value.

This function will not work on a list given with curly brackets. The parameter in the parentheses must be a list name. The previous items are no longer available. Filling does not create a new list.

- {2,7,4,5} STO> L1
- {2 7 4 5}

- Fill(-3,L1)
- Done

- L1
- {-3 -3 -3 -3}

You can start with all zeros.

- 5 STO> dim(L3)
- 5

- L3
- {0 0 0 0 0}

- Fill(4,L3)
- Done

- L3
- {4 4 4 4 4}

## Functions that create new lists[edit | edit source]

The functions in this section create a new list. The new list is available in the Answer variable. If the list will be used later it should be stored in a list variable.

### seq([edit | edit source]

The sequence function (**2nd LIST OPS 5**) creates a list based on an expression and a range of values for the variable in the expression.

The first example makes a list based on 3x + 5, where x takes on the values from 1 through 6.

- seq(2X+3,X,1,6)
- {5 7 9 11 13 15}

Notice that the first parameter is the expression. The second parameter is the variable that assumes the range of values. The third and fourth parameters are the beginning and ending values for the range. The numbers in the range can be incremented by an amount other than 1, by using an optional fifth parameter.

There are several ways to create the same list as in the first example. Since the expression is linear, the range can be used to produce it.

- seq(N,N,5,15,2)
- {5 7 9 11 13 15}

The expression can contain any mathematical calculation, and the parameters for the range can be negative or decimals.

- seq(round(sin(θ),2),θ,-0.7,π/8,0.3)
- {-.64 -.39 -.1 .2}

Since this function creates a new list, if you want do something else with it, you must either use **Ans** or **STO>** it to a list variable.

We can do the first example again in several steps.

- seq(J,J,1,6)
- {1 2 3 4 5 6}

- Ans * 2
- {2 4 6 8 10 12}

- Ans + 3
- {5 7 9 11 13 15}

Here's another example that stores the non-rounded list:

- seq(1/R,R,1,6) STO> L1
- (1 .5 .33333333...

- round(L1,2)
- {1 .5 .33 .25 .2 .17}

### cumSum([edit | edit source]

The cumulative sum function (**2nd LIST OPS 6**) adds up the items in the list and creates a new list with the partial sums. The first item in the new list is the same as the first item in the original list. The second item in the new list is the sum of the first two items in the original list. The third item in the new list is the sum of the first three items in the original list. And so on. The last item in the new list is the sum of the entire original list.

- cumSum({1,2,3,4,5,6})
- {1 3 6 10 15 21}

- cumSum(Ans) STO> L1
- {1 4 10 20 35 56}

Once again, if the new list is to be used rather than just observed, it must be stored, or used immediately from the Ans variable.

### ΔList([edit | edit source]

The list difference function (**2nd LIST OPS 7**) subtracts adjacent list items and forms a list of the differences. This new list will be one item shorter than the original.

- L1
- {1 4 10 20 35 56}

- ΔList(L1)
- {3 6 10 15 21}

- ΔList(Ans)
- {3 4 5 6}

- ΔList(Ans)
- {1 1 1}

- ΔList(Ans)
- {0 0}

Using this function on a list with only one element will result in an error.

### augment([edit | edit source]

The list connecting function (**2nd LIST OPS 9**) has two list parameters. The result is a list with the two lists connected together.

- {1,2 3} STO> L1
- {1 2 3}

- {6,7,8,9} STO> L2
- {6 7 8 9}

- augment(L1,L2)
- {1 2 3 6 7 8 9)

- augment(L2,L1)
- {6 7 8 9 1 2 3}

- augment({10,14,8},L1)
- {10 14 8 1 2 3}

- augment(Ans,{5,1,7}) STO> L3
- {10 14 8 1 2 3 5 1 7}

The new list must be stored if it is to be used later.

- SortA(L3)
- Done

- L3
- {1 1 2 3 5 7 8 10 14}

## Links[edit | edit source]

- Previous: Arithmetic

- Back to: TI-Lists