6.1.6 Getting an element of a sequence or a list
The elements of a sequence have indices beginning at 0 in
Xcas mode and 1 in other modes (see Section 2.5.2).
You can get the an element of index n of a sequence or list by following
the sequence or list with [n]
(see Section 3.2.4).
(Note that head(S) does the same thing as S[0].)
Examples
For lists, the at command
can also be used to get the element at a specific position.
-
at takes two arguments:
-
L, a list.
- n, an integer.
- at(L,n) returns the element of S with index n.
Note.
at cannot be used for sequences, since the second argument
would be merged with the sequence.
Example
or: