Arrays

Arrays are essentially lists containing many values. Arrays are written as a comma separated list of values in between square brackets.

"A" equals [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ]

An array can contain values of any type as long as all of the types are the same. That means (for example), that you can have an array of matrices as long as each matrix is the same size.

CorrectIncorrect
left bracket, 1 , 2 , right bracketleft bracket, 1 , Start 2 by 2 matrix, Row 1: 1, 0; Row 2: 0, 1, End matrix , right bracket
left bracket, Start 2 by 2 matrix, Row 1: 1, 0; Row 2: 0, 1, End matrix , Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix , right bracketleft bracket, Start 1 by 2 matrix, Row 1: 1, 2, End matrix , Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix , right bracket

You can access the nth value in an array by typing A[n], where n is the value you want to access. Note that array indices start at 0, meaning that the first element of the array will be accessed as A[0].

"A" equals left bracket, 2 , 4 , 6 , 8 , right bracket
"A" left bracket, 0 , right bracketequals 2

Using arrays in math expressions

You can use arrays in math expressions like you would regular values. An operation between an array and a single value is applied to each entry of the array, and so are functions and powers:

left bracket, 1 , 2 , 3 , right bracket positive 10equals left bracket, 11 , 12 , 13 , right bracket
left bracket, 1 , 2 , 3 , right bracket squaredequals left bracket, 1 , 4 , 9 , right bracket

The single value does not have to be a number. For example, multiplying an array of numbers by a point gives an array of points, each one scaled by a different entry. Since they are points, they are all drawn in the graph:

left bracket, 1 , 2 , 3 , right bracket times Start 2 by 1 matrix, Row 1: 1; Row 2: 2, End matrixequals left bracket, Start 2 by 1 matrix, Row 1: 1; Row 2: 2, End matrix , Start 2 by 1 matrix, Row 1: 2; Row 2: 4, End matrix , Start 2 by 1 matrix, Row 1: 3; Row 2: 6, End matrix , right bracket

An operation between two arrays is applied entrywise: the first entry of one array pairs with the first entry of the other, the second with the second, and so on.

left bracket, 1 , 2 , 3 , right bracket times left bracket, 4 , 5 , 6 , right bracketequals left bracket, 4 , 10 , 18 , right bracket

If the arrays have different lengths, the result is as long as the shortest one and the leftover entries are ignored:

left bracket, 1 , 2 , 3 , 4 , right bracket positive left bracket, 10 , 20 , right bracketequals left bracket, 11 , 22 , right bracket

Multidimensional arrays

Multidimensional arrays (aka arrays of arrays) are supported, as long as all of the arrays are the same length.

CorrectIncorrect
left bracket, left bracket, 1 , 2 , right bracket , left bracket, 3 , 4 , right bracket , right bracketleft bracket, left bracket, 1 , right bracket , left bracket, 2 , 3 , right bracket , right bracket

2d arrays are displayed in the output as a 2d grid where each element becomes a row

[ [ 1 , 2 ] , [ 3 , 4 ] ]equals Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix

Higher dimensional arrays are written as nested versions of these grids.

[ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] ]equals left bracket, Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix , Start 2 by 2 matrix, Row 1: 5, 6; Row 2: 7, 8, End matrix , right bracket

Indexing a multidimensional array works the same way as indexing a 1 dimensional array, returning the nth element in the outer array. That means that indexing a 2D array once will return a row.

"A" equals [ [ 1 , 2 ] , [ 3 , 4 ] ]equals Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix
"A" [ 0 ]equals left bracket, 1 , 2 , right bracket

You can do this multiple times to get more specific elements

"A" equals [ [ 1 , 2 ] , [ 3 , 4 ] ]equals Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix
"A" [ 0 ] [ 1 ]equals 2

Math expressions treat nested arrays the same way as flat ones: an operation with a single value applies to every entry, all the way down. Using a 1D array and a 2D array together in the same expression is an error, since there is no way to pair their entries up. Index the deeper array down to a matching depth first (for example A[0]).

Creating arrays using the for operator

The for operator works the same way as the Start sum from to , end sum, operator, but instead of summing all of the terms together, it saves them to an array. This allows you you to write long arrays as a short expression instead of handwriting them. The bounds are inclusive meaning that the upper and lower bounds are included in the run.

You can write the for operator by typing for and setting the top and bottom fields.

Recording of the calculator performing the steps described above

For operators can be nested to create multi-dimensional arrays. Below is an example of how this could be used to create a grid of points:

Start for from "j" equals negative 3 to 3, end for, Start for from "k" equals negative 3 to 3, end for, Start 2 by 1 matrix, Row 1: "j" ; Row 2: "k" , End matrix