Matrices are an ordered collection of equal length lists separated by commas and surrounded by a pair of square brackets.
Elements of a matrix can be accessed by assigning the matrix to a variable or using the transformation operator. Matrices like lists are 1-indexed in MathStudio meaning the first element starts at index 1.
Matrix rows and elements can be accessed using an integer, range, list of integers or a matrix of integers.
Examples
Creating Matrices
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
[1:3, 4:6, 7:9]
@[3, 3]
@[4, 3, 3]
Set a column to a value
b = @[3, 3]
b(*, 2) = 1
b
Set a submatrix to a value
b = @[4, 4]
b(2..3, 2..3) = 1
b
Set a submatrix to another submatrix
b = @[4, 4]
b(2..3, 2..3) = [[1, 2], [3, 4]]
b
Transpose
[[1, 2, 3]]'
Identity Matrix
Identity(3)
Accessing elements in a matrix
m=[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
m(2, 1)
Accessing a column in a matrix
m=[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
m(*, 2)
Combining matrices using the transformation operator