Difference between revisions of "Element Command"
From GeoGebra Manual
Line 6: | Line 6: | ||
;Element[Matrix, Row, Column] | ;Element[Matrix, Row, Column] | ||
:Yields the element of the matrix in the given row and column. | :Yields the element of the matrix in the given row and column. | ||
− | :{{example| 1=<div><code><nowiki>Element[{{1, 3, 2}, {0, 3, -2}}, 2, 3]</nowiki></code> gives ''-2'', the third element of the second row of | + | :{{example| 1=<div><code><nowiki>Element[{{1, 3, 2}, {0, 3, -2}}, 2, 3]</nowiki></code> gives ''-2'', the third element of the second row of <math>\begin{pmatrix}1&3&2\\0&3&-2\end{pmatrix}</math>.</div>}} |
;Element[List L, Index1, Index2, ...] | ;Element[List L, Index1, Index2, ...] | ||
:Provided L is ''n''-dimensional list, one can specify up to ''n'' indices to obtain an element (or list of elements) at given coordinates. | :Provided L is ''n''-dimensional list, one can specify up to ''n'' indices to obtain an element (or list of elements) at given coordinates. | ||
Line 14: | Line 14: | ||
;Element[List, Number n] | ;Element[List, Number n] | ||
:Yields the ''n''<sup>th</sup> element of the list. | :Yields the ''n''<sup>th</sup> element of the list. | ||
− | :{{example| 1=<div><code><nowiki>Element[{ | + | :{{example| 1=<div><code><nowiki>Element[{a, b, c}, 2]</nowiki></code> gives ''b'', the second element of ''{a, b, c}''.</div>}} |
;Element[Matrix, Row, Column] | ;Element[Matrix, Row, Column] | ||
:Yields the element of the matrix in the given row and column. | :Yields the element of the matrix in the given row and column. | ||
− | :{{example| 1=<div><code><nowiki>Element[{{ | + | :{{example| 1=<div><code><nowiki>Element[{{a, b, c}, {d, e, f}}, 2, 3]</nowiki></code> gives ''f'', the third element of the second row of<math>\begin{pmatrix}a&b&c\\d&e&f\end{pmatrix}</math>.</div>}} |
Revision as of 12:37, 18 August 2011
- Element[List, Number n]
- Yields the nth element of the list.
- Example:
Element[{1, 3, 2}, 2]
gives 3, the second element of {1, 3, 2}.
- Element[Matrix, Row, Column]
- Yields the element of the matrix in the given row and column.
- Example:
Element[{{1, 3, 2}, {0, 3, -2}}, 2, 3]
gives -2, the third element of the second row of \begin{pmatrix}1&3&2\\0&3&-2\end{pmatrix}.
- Element[List L, Index1, Index2, ...]
- Provided L is n-dimensional list, one can specify up to n indices to obtain an element (or list of elements) at given coordinates.
- Example:Let L={{{1,2},{3,4}},{{5,6},{7,8}}}. Then
Element[L,1,2,1]
returns 3,Element[L,2,2]
returns {7, 8}.
Note: For this command to work, the list or matrix can contain elements of one object type only (e. g. only numbers or only points).
CAS Syntax
- Element[List, Number n]
- Yields the nth element of the list.
- Example:
Element[{a, b, c}, 2]
gives b, the second element of {a, b, c}.
- Element[Matrix, Row, Column]
- Yields the element of the matrix in the given row and column.
- Example:
Element[{{a, b, c}, {d, e, f}}, 2, 3]
gives f, the third element of the second row of\begin{pmatrix}a&b&c\\d&e&f\end{pmatrix}.