Problem: generate diagonal matrix with \(2,4,6,8\) on the diagonal.
Mathematica
Matlab
Maple
A:=LinearAlgebra:-DiagonalMatrix([2,4,6,8]); #or A:=LinearAlgebra:-DiagonalMatrix( [seq(i,i=2..8,2)]);
|
[[2,0,0,0], [0,4,0,0], [0,0,6,0], [0,0,0,8]] |