# Tag Info

9

JavaScript, 58 bytes a=>a.some((r,y)=>r.some((c,x)=>(r/(r=c)==a[x][x])/-y--<c)) Try it online! When c==0 r/(r=c) is NaN or Infinity; (r/(r=c)==a[x][x]) is false (r/(r=c)==a[x][x])/-y-- is 0 or NaN (r/(r=c)==a[x][x])/-y--<c is false When y==0 (cells on main diagonal) and c>=1 (r/(r=c)==a[x][x])/-y-- is NaN or Infinity (r/(r=c)==a[x][x])...

7

Jelly, 14 13 bytes ŒDµḢ=Ɲo@ƑḢ>FẠ Try it online! -1 because I actually thought to check if the input can contain negative integers ŒDµ Consider the diagonals of the input matrix. Ḣ Pop the main diagonal; Ɲ for each pair of its adjacent elements = are they equal? (Especially note ...

5

Rattle, 111 bytes |sI^>s[[PgI#1I#s2=#-#1[^0[^1g2[^0=q]][1g2[^0[^1=q]P=#4<s<=#3-sg0>I~<I~s_3P=#4+<s<=#3sg0>I~<I~<[^~=q]]]]g1]]=1 Try it Online! Needless to say, Rattle is not built to handle matrices and this approach is pretty brute-force. However, this code really shows off most of Rattle's features! Explanation | ...

5

APL (Dyalog Classic), 59 bytes {a b c d←⍵⋄l,2 1∘.○¯3○b÷⍨a-⍨l←2÷⍨a+d(+,-).5*⍨(4×b×c)+×⍨a-d} Derivation of formula for eigenvalues:  det|A-\lambda I|=0 \\ det\left|\begin{pmatrix} a & b \\ c & d \end{pmatrix}- \begin{pmatrix} \lambda & 0 \\ 0 & \lambda \end{pmatrix}\right|=0 \\ det\left|\begin{pmatrix} a-\lambda & b \\ c & d-\lambda ...

4

K (ngn/k), 14 bytes {y(+/x*)'/=#x} Try it online! -2 bytes thanks to @coltim on the k tree. The inner train multiplies x on the right side of the current matrix (instead of left side). Why (+/x*)' is also a matmul: (+/(e f;g h)*)' (a b;c d) ( (+/(e f;g h)*) a b; (+/(e f;g h)*) c d ) ( +/ (ae af;bg bh) ; +/ (ce cf;dg dh) ) ((ae+bg) (af+bh); (ce+dg) (cf+dh)) ...

4

Python 3, 69 bytes lambda m,n:re.sub(f"(.)({10**~-n}\\1)*(0%r|$)"%{n},"",m)>"" import re Try it online! input is a flatened string of the matrix and its size output False for Jordan and True for not jordan Edit: as it wasn't specified when I post this answer, my solution only works for matrix with single digits elements How ... 2 Jelly, 11 bytes L=þZḋþ³ƊƓ¡ Try it online! A more modern update to Dennis' answer, be sure to give that an upvote. Additionally, this is a 9 byte answer that takes the dimensions of the matrix as the first 2 command line args and the matrix as the third. Both take the power via STDIN. How it works L=þZḋþ³ƊƓ¡ - Main link. Takes A on the left L - ... 2 Julia, 27 24 a$n=round.(exp(log(a)n)) I am not sure what is allowed, but... julia> a 5×5 Matrix{Int64}: 35 18 40 37 77 31 5 45 23 73 62 67 29 85 97 20 9 83 70 65 2 13 53 59 52 julia> round.(exp(log(a)5)) ≈ a^5 true 24 thanks to @MarcMush.

2

R, 96 93 83 75 67 bytes function(m,k,j=1:k^2%%(k+1),x=m[!j])any(m[j>1],diff(diag(m))&x,x>1) Try it online! Takes input as matrix and it's size. Outputs inverted TRUE/FALSE values.

1

Wolfram Mathematica, 150 144 137 69 bytes With[{m=#,l=Length@#,d=Diagonal},Union@@Join[m~d~#&/@2~Range~l~Join~-Range@l,{If[#2==1,#1,#2]}&~MapThread~{Differences@d@m,m~d~1}]=={0}]& I know... I don't like it either! But this was the shortest code that I could think of, and I'm definitely not an expert. Please take it with a huge grain of salt and ...

1

R, 98 86 bytes function(x,y,+=array)aperm(apply(x,1:2,*,y)+c(w<-dim(y),v<-dim(x)),c(1,3,2,4))+v*w Try it online! Reimplementation of .kronecker and outer for matrices. I do think there's a golfier approach out there, maybe using apply? 6 bytes golfed using apply and array thanks to Dominic van Essen! The builtins are %x% for kronecker(A,B,"*&...

1

Python 3, 128 bytes def f(A,n):r=range(len(A));return n and[[sum(A[i][j]*x[i]for i in r)for j in r]for x in f(A,n-1)]or[[i==j for i in r]for j in r] Try it online!

1

CSASM v2.5.0.2, 306 bytes func a: dup dup ldelem 0 pop $3 ldelem 1 pop$4 ldelem 2 pop $5 dup dup ldelem 0 pop$a ldelem 1 pop $1 ldelem 2 pop$2 push $1 push$5 mul push $2 push$4 mul sub push $2 push$3 mul push $a push$5 mul sub push $a push$4 mul push $1 push$3 mul sub push 3 newarr f32 pop $a push$a swap stelem 2 push $a swap stelem 1 push$a swap ...

1

TI-BASIC, 75 73 71 bytes -4 bytes thanks to @MarcMush Not 71 characters -- TI-BASIC is tokenized. :Prompt A,B :Disp {ʟA(2)ʟB(3)-ʟA(3)ʟB(2),ʟA(3)ʟB(1)-ʟA(1)ʟB(3),ʟA(1)ʟB(2)-ʟA(2)ʟB(1 There's a decent chance I could make this smaller; this is just a minified version of something I keep on my graphing calculator. Usage example: pgrmX A=?{1,2,3} B=?{0,1,0} ...

1

APL (Dyalog Extended), 11 bytes {⍵ ⍵⍴1,⍵/0} Try it online! Just for fun dfn submission ⍵/0 replicate ⍵ zeros 1, prepend a 1 ⍵ ⍵⍴ mold to ⍵×⍵ square So like for left argument 4 it will construct 1 0 0 0 0 And molding cycles from the beginning so, it will generate 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 the 4×4 identity matrix.

Only top voted, non community-wiki answers of a minimum length are eligible