Comparison of two magic squares
Compares two magic squares according to Frenicle's method. Mnemonic is the old Fortran “.GT.” (for “Greater Than”) comparison et seq.
To compare magic square
a with magic square
elements are compared in rowwise order:
a[1,1] is compared with
b[1,2], up to
a[n,n]. Consider the first element that is different, say
The generalization to hypercubes is straightforward: comparisons are carried out natural order.
1 2 3 4 5 6 7 8 9 10 11 12
First magic square
Second magic square
Rather clumsy function definition due to the degenerate case of
testing two identical matrices (
min(NULL) is undefined).
The two arguments are assumed to be matrices of the same size. If not, an error is given.
Robin K. S. Hankin
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.