Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Show menu

MAGIC matrix function


MAGIC(n) creates a n × n matrix with as elements the integers 1 through n2, with equal row and column sums.

The argument n must be larger than 2.

If n=1 then the function returns the scalar {1}; if n=2 then a nonmagic square matrix is returned.



See also

Recommended book

Book cover

Matrix Algebra Useful for Statistics
Shayle R. Searle, Andre I. Khuri

Buy from Amazon

This book addresses matrix algebra that is useful in the statistical analysis of data as well as within statistics as a whole. The material is presented in an explanatory style rather than a formal theorem-proof format and is self-contained.