Hi! I’m trying to find the trace of a matrix:
A = reshape(1:m*n,m,n) with
n=500, by writing
tr(A) which is what the documentation instructs. However, I get the following error:
tr not defined
 top-level scope
I have no idea how to resolve this, as I thought the
tr function was basic to the language and I didn’t need to do anything beforehand to use it. Perhaps that’s where I am going wrong here.
I’d appreciate any help. Thank you!
Try searching the Julia documentation.
julia> using LinearAlgebra
julia> x = randn(10,10)
You need to first issue
using LinearAlgebra (which is its own module).
Welcome to the discussion!
Sometimes, if you are just skimming the documentation online - you might notice at the top of the page it will say something like “Standard Library / Linear Algebra.” The folks writing the examples in the page often don’t issue
using LinearAlgebra, since they assume you have arrived at the page looking for the documentation for the package.