Arrays Help¶
ORIGIN¶
In the context of arrays the origin is the starting index of the elements. The default is 0. This value can be changed in the document settings.
Element operator¶
The element operator \(A_{ \textcolor{RoyalBlue}{⏹}}\) can be used to set or retrieve a value or values.
Important
Notice that the index items are not subscripts but rather element operators. In Symbolical they are shown as blue to indicate the difference.
You can insert them with the ‘[’ key or by clicking the icon [] in the right Matrices dock.
Setting a element with the operator is done like this:
Attention
Notice that the by default the index of ORIGIN is 0. As such in this case we are setting the second element in the array A.
A value from the Array can be gotten like this \(v:=A_{ \textcolor{RoyalBlue}{1}} = 42\)
Ranges for arrays¶
The range operator can be used to specify a list of element items. The element operator feature can be used to define a single dimensional array like this:
This can be done by typing “R”, “[”, “0”, “;”, “3”, “:”, “5”, “=” sequentially.
The range operator can also be used to get elements like this:
Therefore
Attention
Notice that the recieving array R2 has an unspecified end to the range and a start at 3
Matrix¶
You can create a matrix with the keyboard shortcut Ctrl+M or by pressing the matrix create matrix button in the right dock illustrated with the icon \(\begin{bmatrix} \end{bmatrix}\). This results in a dialog that requires you to choose the size of the matrix.
Once created, the matrix fields can be filled like normal expression fields. By navigating with the keyboard arrow keys, you can put the cursor where you want it, and fill in the fields.
The Matrix elements can also be edited individually, like this \(M_{\textcolor{RoyalBlue}{1,1}} := 2\).
And you can get Matrix elements like this \(v := M_{\textcolor{RoyalBlue}{1,1}} = 2\).
Important
Notice that the index items are not subscripts but rather element operators.
Ranges for matrices¶
Ranges get very useful for matrices when getting and setting data. Lets assign the values of M with:
This also works on the matrix row with:
This works even though the output of \(\text{range(7)}_{\textcolor{RoyalBlue}{2..4}}\) is a column and the receiving end is a row. Symbolical will align your data to the size of the receiving end.
Itemwise indexing¶
Symbolical also supports itemwise indexing when setting and getting data from arrays. This is very useful for when you don’t want Symbolical to use linear algebra on your arrays.
Lets start with a simple example. Let i and j be set as \(i := \text{range}(4)\) and \(j := \text{range}(4)\).
Then lets use i and j as iterators to set the values of M:
Notice that Symbolical now understands that the elements of M needs to be set itemwise from the itterators i and j. Had we not specified the element indexes on M we would have gotten this result:
This is because Symbolical will try to use linear algebra to solve the problem. Since we are multiplying the two arrays it thinks we want to get the dot product. But for that to work the dimensions of the arrays need to match. Lets try Transposing the right side:
Yes that worked. And it even gave the same result.