magic
Mathematical Programming with Python
https://people.sc.fsu.edu/~jburkardt/classes/...
python_2025/magic/magic.html


magic: using the numpy() library to construct a magic matrix whose rows, columns, diagonals and antidiagonals all have a common sum. Simple commands allow us to check all the sums. We only consider magic matrices with an odd number of rows and columns. The even case is much harder to construct.

Lecture notes:


Last revised on 02 February 2025.