is_nilpotent for NCPolyRingElem
Both the implementation for is_unit and is_nilpotent claim that they work for NCPolyRingElem:
https://github.com/Nemocas/AbstractAlgebra.jl/blob/41d9716d403c83689cd5d08007c8e5c632e317da/src/NCPoly.jl#L812-L816
But I don't think this is true:
- For technical reasons one gets:
julia> is_nilpotent(f)
ERROR: MethodError: no method matching coefficients(::AbstractAlgebra.Generic.NCPoly{AbstractAlgebra.Generic.MatRingElem{BigInt}})
The function `coefficients` exists, but no method is defined for this combination of argument types.
- It seems to be wrong mathematically:
julia> R = matrix_ring(ZZ, 2);
julia> S, y = polynomial_ring(R, "y");
julia> f = R([0 1; 0 0]) * y + R([0 0; 1 0]);
julia> f^2
y
julia> f^3
[0 1; 0 0]*y^2 + [0 0; 1 0]*y
julia> f^4
y^2
julia> f^5
[0 1; 0 0]*y^3 + [0 0; 1 0]*y^2
julia> is_nilpotent(coeff(f, 0)) && is_nilpotent(coeff(f, 1))
true
I think those functions were added by @JohnAAbbott. Is there a reference?
It works if the coefficients are commutative: (a+b)^k = \sum_j binom(k,j)*a^j*b^(k-j)
Your example shows that it may not be true if the coefficients of the polynomial are not pairwise commutative.
I need to think a moment about the case of non-commutative coefficients: the simple change is to restrict to commutative coefficients...
I believe the function is correct in a local ring. Not (yet?) sure how to make it more general.
I think this was resolved by PR #2037 -- can you confirm and close this then?
Yes, it was resolved by PR #2037 so closing