Algosim documentation: IsNilpotent

IsNilpotent

Tests if a matrix is nilpotent.

Syntax

Description

If A is a matrix, then IsNilpotent(A, ε) returns true iff A is nilpotent, that is, iff it is square and there exists a positive integer k such that A^k = 0. Floating-point comparisons are made with epsilon ε.

Examples

A ≔ ❨❨2, -3, -2, -1, 2❩, ❨2, 0, -2, 2, 2❩, ❨-3, -2, -1, -2, 1❩, ❨-1, -2, 1, -3, -1❩, ❨-3, -2, -1, -3, 2❩❩
⎛ 2  −3  −2  −1   2⎞
⎜ 2   0  −2   2   2⎟
⎜−3  −2  −1  −2   1⎟
⎜−1  −2   1  −3  −1⎟
⎝−3  −2  −1  −3   2⎠
IsNilpotent(A)
true
N, c ≔ 1000000, 0; for(i, 1, N, if(IsNilpotent(RandomIntMatrix(3, −3, 4)), inc(c))); c/N
0.000306	(=153/500000)

See also