Creates an NxN magic square.
MAGIC(n)
n - An integer. The number of output rows and columns.
A square matrix.
a = magic(3)
a == {{8, 1, 6},
{3, 5, 7},
{4, 9, 2}}
colsum(a) == {{15, 15, 15}}
colsum(a’) == {{15, 15, 15}}
sum(diag(a)) == 15
density(magic(523));turbo

produces an interesting density plot.
A magic square is a square matrix where the sum of each row equals the sum of each column and also equals the sum of the main diagonal.
MAGIC(2) does not produce a true magic square since a 2x2 magic square does not exist.
For n <= 0, MAGIC returns the empty matrix.