I have created a small blog post related to Idempotent matrices with Julia.
Idempotent matrices in Julia
Please provide your feedback.
You could show that rank(A)=tr(A)=4.
Here is another direction: What if you wanted to have a rank 3 idempotent matrix? How would you find a vector
v such that
u'*v = 0 so that we can make a
B with rank(B) = 3 and
B^100 ≈ B?
Very nice. I like your 100 Julia Excercises too!
I feel the sentence
Idempotent matrices behave like identity matrices when raised to a power n
is a bit misleading. They do only after being applied once.
I think your example demonstrates Julia’s natural math syntax nicely and if that’s all you want, then I say well done.
If you want to go a step further and showcase what Julia can do, you could define a
IdempotentMatrix<:AbstractMatrix type and specialize all kinds of linear algebra on it. Most importantly of course matrix powers, but also eigenvalues, trace, determinant…
I admit that I’ve thought about this for approximately five minutes, so maybe there is good reason not to
What would be a correct sentence which will clearly show the behaviour of idempotent matrices when raised to a power?
P^2 = P explains it tbh.
I’m with @jacobusmmsmit in this. The definition is perfectly understandable. IMHO the sentence could be left out entirely.
Cross posted to Idempotent matrices in Julia - Julia Community