Composite Calligraphy Notes

This whole thing is Craig Knecht's invention and achievement - water retention, water writing, automating the process, etc.

In early July, 2014 Craig suggested the idea of water writing the American Declaration of Independence in a magic square. At the time, that seemed absurdly ambitious. A major problem with the character squares was noise, (unwanted water). Eliminating the noise would require 4 complete alphabets of magic square letters, (one draining in each direction - left, right, up, down). Craig was undaunted by this monumental challenge and started cranking them out! Also, the declaration contains almost 9000 characters; there was no way to view a square big enough to contain that much text as retained water.

Less than 2 months later, the goal is achieved! All the alphabets are completed and included in the program. A Declaration of Independence text file from the Internet is 174 lines with a total of 8893 characters. The resulting composite magic square is order 1914. Editing the file to make longer text lines could reduce this order.

For viewing, the program writes the square to a Text.html file as a table without the square numbers. The cells are without borders and the cell width and height are specified as 0.5 pixel. See example.

Most browsers can slowly open a file with a very big table, (square order 1500 plus). Google Chrome, Mozilla Firefox, Opera, and Safari are ok; Internet Explorer is no good.

Caution: Avoid trying to open a big Text.html file with Internet Explorer 9 and earlier. It can tie up the computer and be very difficult to close, even from the Task Manager, if you can get that started.

CompleteSquare Notes

Suggested input: runs 10, iterations 1000.


Craig Knecht suggested starting the search for pairs to swap in only the rows and columns with the smallest and biggest sums. This gave a huge reduction in run times, in proportion to the order of the square: 88% for order 32, 97% for order 100.

With this reduced search, there is some drop in success rates starting at about order 24. This reduction can be magnified when the input square has many specified numbers. To compensate for this, the program sometimes elects to use a full square search or to retry with a full search if the reduced search is unsuccessful.

The program has many other performance improvements. Notably, for starting associative squares, only half the values are randomly placed, (with their complements), and the square symmetry is maintained throughout the search.

Added Feature

If the input square is filled with the numbers 1 to n2, that is used as the starting square.

Sample Results

Typical success results, (input square all 0):

runs: 10, iterations: 1000

             Semimagic             Magic             Associative
         ----------------     ----------------     ----------------
    n   squares loops  sec   squares loops  sec   squares loops  sec
  ----- ------- ----- -----  ------- ----- -----  ------- ----- -----
    4      10     29   0.0      10     72   0.0      10     35   0.0  
    5      10     28   0.0      10    194   0.0      10     61   0.0

    8      10     60   0.0      10    215   0.0      10    145   0.0
    9      10     67   0.0      10    224   0.0      10    125   0.0

   15      10    119   0.0      10    249   0.0      10    212   0.0
   16      10    129   0.0      10    244   0.0      10    237   0.0

   24      10    213   0.1      10    306   0.1       9    317   0.1
   25      10    218   0.1      10    313   0.2       9    333   0.1

   31      10    301   0.2       9    363   0.4       9    401   0.3
   32      10    306   0.2      10    361   0.3       9    417   0.3

   48       9    433   1.0       8    480   1.9       6    477   1.6
   49       9    402   1.2       8    546   1.9       6    485   1.8

iterations: 3000

   49      10    536   1.4      10    739   2.2      10    977   2.3

iterations: 6000

  100      10   1572  31.3      10   1815  39.7      10   1858  43.9

where: loops = actual iterations per square
       sec   = Win32 time per square, (seconds)

GetType Notes

For magic squares:

Self-complement is not added to the properties list for associative squares; all associative squares are self-complementary.

Pandiagonal by default means 2-way; otherwise, it is qualified as 1-way.

Bent diagonal and zigzag always imply pan-n-way in the directions of the bends. By default, they mean 4-way - up, down, left, and right. If not 4-way, they are qualified as 3-way, 2-way, or 1-way.

Zigzag squares are further classified as zigzagk, for k = 2,3,4,... where k refers to the number of cells from trough to crest of a wave. By default, zigzag refers to zigzag2.

V zigzagAk is supported for k=3,4,...n. By default, V zigzagA means V zigzagA3.
Note that if a square is V zigzagAj for a specific value j, it is V zigzagAk for k = j, 2j-1, 3j-2,... Only the smallest such k is reported. Also, because V zigzagA2 is the same as V zigzag2, V zigzagA2 is not reported.

Compactk is supported for k=2,3,4,...n/2. By default, compact means compact2.
Note that a compactk square is automatically compact for multiples of k, (but not vice versa). Only the smallest such k reported.

Parity types were added in response to a request from Craig Knecht to find some of the patterns he had identified with program HighlightSquare:

axial parity
Cells opposite left-right of the middle and/or up-down from the middle have the same parity.
By default means 2-way; otherwise, qualified as 1-way.
symmetric parity
Cells symmetrically opposite from the center have the same parity.
transpose parity
Square[row][column]&1 matches Square[column][row]&1.

Here, types are exclusive of their "more magic" kinds. Semimagic does not include magic, pandiagonal 1-way does not include pandiagonal, and so on.

For Latin squares, see notes: Here, LS exclude DLS, and axial symmetric exclude double axial symmetric.

Orthogonal pair is reported only for adjacent orthogonal squares. In the detail file, orthogonal pair refers to that square and the immediately preceding square.

Ultramagic is reported for diagonal Latin squares that are associative and pandiagonal or weakly pandiagonal.

CopySquaresByType Notes

The type lists are comma separated lists of types like those output by GetType. To input an empty exclude list hit .

Types must be separated by commas. Upper/lower case is important. The order of items in a list is not important.

Squares that match all of the include list, but do not match all of the exclude list, are copied.

Most-perfect is accepted for "pandiagonal, complete, compact".

Ultramagic is accepted for "associative, pandiagonal".

For prime number squares include prime or other in the list with associative, pandiagonal, etc.

For diagonal Latin squares, add diagonal Latin or DLS when specifying associative, pandiagonal, or ultramagic.

Enter include type list: diagonal Latin, associative
Enter include type list: dls, ass
Enter include type list: ass dls
Enter include type list: diagonal Latin, pandiagonal
Enter include type list: dls, pan
Enter include type list: pan dls
Enter include type list: pls
Enter include type list: diagonal Latin, ultramagic
Enter include type list: dls, ult
Enter include type list: ult dls

For compactk, squares are copied only if they are not also compactj where j is a factor of k.
Similarly, for V zigzagAk, squares are copied only if they are not also V zigzagAj where k is any of 2j-1, 3j-2,...


Upper/lower case is not important but abbreviation words may not be reordered.

Many abbreviations are recognized, for example:

adjacent corner: adj cor
associative: ass, ass DLS
axial symmetric: axi, sym, sym LS, sym DLS
bent diagonal 1-way: bent 1
bordered: bord

bordering: bord ring
center symmetric: cent, csym, csym LS, csym DLS
compactk: compa k
complete: compl
concentric: con

diagonal Latin: dia, DLS
double axial symmetric: dou, dsym, dsym LS, dsym DLS
Latin: lat, LS
natural \diagonal: nbd, nat dia
near pandiagonal: near pan

normal magic: magic
orthogonal pair: ort, OLS, ODLS
pandiagonal: pan, pan DLS, PLS, Knut
self-complement: self comp
self-orthogonal: self ort, SOLS, SODLS

ultramagic: ult, ult DLS
weakly pandiagonal: weak, WPLS
U zigzag 2-way: Uzig 2-way, Uzig 2 2
V zigzagk 2-way: Vzig k 2
V zigzagAk 2-way: VzigA k 2

CopySquaresByType examples, (modified consoles):