November 2017
Beginner
316 pages
6h 40m
English
Just like arrays, there are different operations that can be performed on matrices:
# a 3x2 matrixjulia> A = [2 4; 8 16; 32 64]3×2 Array{Int64,2}: 2 4 8 1632 64
We can change the shape of a matrix using the reshape() function:
julia> reshape(A,2,3)2×3 Array{Int64,2}:2 32 168 4 64
This converts a 3x2 matrix to a 2x3 matrix:
# same could be achieved using the transpose functionjulia> transpose(A)2×3 Array{Int64,2}:2 32 168 4 64
Operations such as addition and multiplication are also valid, with some restrictions:
julia> B = [1 1 2; 3 5 8]2×3 Array{Int64,2}:1 1 23 5 8# adding both the matricesjulia> transpose(A)+B2×3 Array{Int64,2}: 3 9 34 7 21 72
This operation is performed successfully. Now, let’s try the multiplication ...
Read now
Unlock full access