Water retention on mathematical surfaces
Water retention on mathematical surfaces is the catching of water in ponds on a surface of cells of various heights on a regular array such as a square lattice, where water is rained down on every cell in the system. The boundaries of the system are open and allow water to flow out. Water will be trapped in ponds, and eventually all ponds will fill to their maximum height, with any additional water flowing over spillways and out the boundaries of the system. The problem is to find the amount of water trapped or retained for a given surface. This has been studied extensively for two mathematical surfaces: magic squares and random surfaces. The model can also be applied to the triangular grid.
Magic squares
have been studied for over 2000 years. In 2007, the idea of studying the water retention on a magic square was proposed. In 2010, a competition at Al Zimmermann's Programing Contests produced the presently known maximum retention values for magic squares order 4 to 28. Computing tools used to investigate and illustrate this problem are found here.There are 4,211,744 different retention patterns for the 7×7 square. A combination of a lake and ponds is best for attaining maximum retention. No known patterns for maximum retention have an island in a pond or lake.
Maximum-retention magic squares for orders 7-9 are shown below:
The figures below show the 10x10 magic square. Is it possible to look at the
patterns above and predict what the pattern for maximum retention for
the 10x10 square will be? No theory has been developed that
can predict the correct combination of lake and ponds for all orders, however some principles do apply.
The first color-coded figure
shows a design principle of how the largest available numbers are placed around
the lake and ponds. The second and third figures
show promising patterns that were tried but did not achieve
maximum retention.
1 | 50 | 66 | 46 | 86 | 54 | 77 | 74 | 48 | 3 |
53 | 68 | 97 | 91 | 78 | 40 | ||||
67 | 98 | 96 | 76 | ||||||
58 | 93 | 92 | 75 | ||||||
85 | 99 | 56 | |||||||
55 | 95 | 89 | 82 | ||||||
71 | 90 | 100 | 79 | ||||||
70 | 88 | 87 | 83 | 47 | |||||
43 | 73 | 72 | 94 | 84 | 65 | 42 | |||
2 | 57 | 49 | 69 | 62 | 81 | 80 | 39 | 61 | 5 |
1 | 45 | 79 | 53 | 87 | 83 | 55 | 72 | 27 | 3 |
51 | 80 | 95 | 89 | 74 | 31 | ||||
78 | 90 | 94 | 73 | ||||||
48 | 97 | 91 | 41 | ||||||
85 | 82 | ||||||||
86 | 88 | ||||||||
66 | 99 | 96 | 58 | ||||||
70 | 98 | 92 | 75 | ||||||
18 | 71 | 100 | 93 | 77 | 50 | ||||
2 | 44 | 69 | 47 | 81 | 84 | 63 | 76 | 35 | 4 |
Several orders have more than one pattern for maximum retention. The figure below shows the two patterns for the 11x11 magic square with the apparent maximum retention of 3,492 units:
1 | 55 | 81 | 69 | 103 | 47 | 83 | 64 | 99 | 67 | 2 |
59 | 89 | 106 | 111 | 102 | 100 | 48 | ||||
82 | 119 | 117 | 98 | |||||||
73 | 107 | 112 | 101 | 68 | ||||||
104 | 121 | 84 | ||||||||
105 | 108 | 75 | ||||||||
74 | 109 | 120 | 90 | |||||||
86 | 115 | 114 | 96 | 65 | ||||||
77 | 91 | 116 | 118 | 94 | ||||||
6 | 87 | 92 | 113 | 110 | 97 | 95 | 44 | |||
4 | 62 | 71 | 85 | 72 | 79 | 88 | 63 | 93 | 51 | 3 |
1 | 36 | 97 | 69 | 86 | 74 | 64 | 89 | 90 | 62 | 3 |
68 | 99 | 101 | 108 | 109 | 92 | 53 | ||||
98 | 118 | 116 | 91 | 50 | ||||||
77 | 100 | 113 | 117 | 82 | ||||||
87 | 121 | 114 | 70 | |||||||
79 | 105 | 104 | ||||||||
75 | 106 | 102 | ||||||||
88 | 120 | 110 | 57 | |||||||
76 | 96 | 107 | 119 | 83 | ||||||
18 | 95 | 111 | 115 | 112 | 85 | 65 | ||||
4 | 16 | 93 | 94 | 73 | 80 | 103 | 78 | 84 | 44 | 2 |
The most-perfect magic squares require all ^2 or in this case all 121 2x2 planar subsets to have the same sum..
Areas completely surrounded by larger numbers are shown with a blue background.
Before 2010 if you wanted an example of a magic square larger than 5×5 you had to follow clever construction rules that provided very isolated examples. The 13x13 pandiagonal magic square below is such an example. Harry White's CompleteSquare Utility allows anyone to use the magic square as a potter would use a lump of clay. The second image shows a 14x14 magic square that was molded to form ponds that write the 1514 - 2014 dates. The animation notes how the surface was sculptured to fill all ponds to capacity before the water flows off the square. This square honors the 500th anniversary of Durer's famous magic square in Melencolia I.
This figure also provides an example of a square and its complement that have the same pattern of retention.
There are 137 order 4 and 3,254,798 order 5 magic squares that do not retain water.
212 | 198 | 200 | 202 | 204 | 206 | 208 | 13 | 12 | 10 | 8 | 6 | 4 | 2 | 210 |
27 | 186 | 174 | 176 | 178 | 180 | 182 | 39 | 38 | 36 | 34 | 32 | 30 | 184 | 199 |
25 | 51 | 164 | 154 | 156 | 158 | 160 | 61 | 60 | 58 | 56 | 54 | 162 | 175 | 201 |
23 | 49 | 71 | 146 | 138 | 140 | 142 | 79 | 78 | 76 | 74 | 144 | 155 | 177 | 203 |
21 | 47 | 69 | 87 | 132 | 126 | 128 | 93 | 92 | 90 | 130 | 139 | 157 | 179 | 205 |
19 | 45 | 67 | 85 | 99 | 122 | 118 | 103 | 102 | 120 | 127 | 141 | 159 | 181 | 207 |
17 | 43 | 65 | 83 | 97 | 107 | 116 | 109 | 114 | 119 | 129 | 143 | 161 | 183 | 209 |
15 | 41 | 63 | 81 | 95 | 105 | 111 | 113 | 115 | 121 | 131 | 145 | 163 | 185 | 211 |
215 | 189 | 167 | 149 | 135 | 125 | 112 | 117 | 110 | 101 | 91 | 77 | 59 | 37 | 11 |
217 | 191 | 169 | 151 | 137 | 106 | 108 | 123 | 124 | 104 | 89 | 75 | 57 | 35 | 9 |
219 | 193 | 171 | 153 | 96 | 100 | 98 | 133 | 134 | 136 | 94 | 73 | 55 | 33 | 7 |
221 | 195 | 173 | 82 | 88 | 86 | 84 | 147 | 148 | 150 | 152 | 80 | 53 | 31 | 5 |
223 | 197 | 64 | 72 | 70 | 68 | 66 | 165 | 166 | 168 | 170 | 172 | 62 | 29 | 3 |
225 | 42 | 52 | 50 | 48 | 46 | 44 | 187 | 188 | 190 | 192 | 194 | 196 | 40 | 1 |
16 | 28 | 26 | 24 | 22 | 20 | 18 | 213 | 214 | 216 | 218 | 220 | 222 | 224 | 14 |
16 x 16 associative magic square retaining 17840 units. The lake in the first image looks a little uglier than common. Jarek Wroblewski notes that good patterns for maximum retention will have equal or near equal number of retaining cells on each peripheral edge The second image is doctored, shading in the top and bottom 37 values.
The figure below is a 17x17 Luo-Shu format magic square.
The Luo-Shu format construction method seems to produce a maximum number of ponds. The drainage path for the cell in green is long eventually
spilling off the square at the yellow spillway cell.
The figure to the right shows what information can be derived from looking at the actual water content for each cell.
Only the 144 values are highlighted to keep the square from looking too busy.
Focusing on the green cell with a base value 7, the highest obstruction on the path out is its neighbor cell
with the value of 151. Water rained into this cell exits the square at the yellow 10 cell.
137 | 282 | 121 | 266 | 105 | 250 | 89 | 234 | 73 | 218 | 57 | 202 | 41 | 186 | 25 | 170 | 9 |
10 | 138 | 283 | 267 | 251 | 235 | 219 | 203 | 187 | 154 | |||||||
155 | 139 | 284 | 268 | 252 | 236 | 220 | 204 | 171 | 27 | |||||||
28 | 156 | 140 | 285 | 269 | 253 | 237 | 221 | 188 | 172 | |||||||
173 | 157 | 141 | 286 | 270 | 254 | 238 | 205 | 189 | 45 | |||||||
46 | 174 | 158 | 142 | 287 | 271 | 255 | 222 | 206 | 190 | |||||||
191 | 175 | 159 | 143 | 288 | 272 | 239 | 223 | 207 | 63 | |||||||
64 | 192 | 176 | 160 | 144 | 289 | 256 | 240 | 224 | 208 | |||||||
209 | 193 | 177 | 161 | 145 | 273 | 257 | 241 | 225 | 81 | |||||||
82 | 210 | 194 | 178 | 162 | 146 | 274 | 258 | 242 | 226 | |||||||
227 | 211 | 195 | 179 | 163 | 147 | 275 | 259 | 243 | 99 | |||||||
100 | 228 | 212 | 196 | 180 | 164 | 148 | 276 | 260 | 244 | |||||||
245 | 229 | 213 | 197 | 181 | 165 | 149 | 277 | 261 | 117 | |||||||
118 | 246 | 230 | 214 | 198 | 182 | 166 | 150 | 278 | 262 | |||||||
263 | 247 | 231 | 215 | 199 | 183 | 167 | 151 | 279 | 135 | |||||||
136 | 264 | 248 | 232 | 216 | 200 | 184 | 168 | 7 | 152 | 280 | ||||||
281 | 120 | 265 | 104 | 249 | 88 | 233 | 72 | 217 | 56 | 201 | 40 | 185 | 24 | 169 | 8 | 153 |
00 | ||||||||||||||||
128 | ||||||||||||||||
127 | 128 | |||||||||||||||
127 | 128 | 127 | ||||||||||||||
127 | 127 | 128 | 127 | |||||||||||||
127 | 127 | 128 | 127 | 127 | ||||||||||||
127 | 127 | 127 | 128 | 127 | 127 | |||||||||||
127 | 127 | 127 | 128 | 127 | 127 | 127 | ||||||||||
127 | 127 | 127 | 127 | 127 | 127 | 127 | ||||||||||
127 | 127 | 127 | 127 | 127 | 127 | |||||||||||
127 | 127 | 127 | 127 | 127 | ||||||||||||
127 | 127 | 127 | 127 | |||||||||||||
127 | 127 | 127 | ||||||||||||||
127 | 127 | |||||||||||||||
127 | ||||||||||||||||
00 |
Mario Mamzeris invented his own method for constructing odd order magic squares. His Order 19 associative magic square is shown below.
The computer age now allows for the exploration of the physical properties of magic squares of any order. The figure below shows the largest magic square studied in the contest. For L > 20 the number of variables/ equations increases to the point where it makes the pattern for maximum retention predictable.
This is a 32x32 panmagic square. Dwane Campbell using binary construction methods produced this interesting water retention example. The GET TYPE utility applied to this square shows that it has the following properties: 1) normal magic 2) pandiagonal 3) bent diagonal two way 4) self-complement.
Random surfaces
Another system in which the retention question has been studied is a surface of random heights. Here one can map the random surface to site percolation, and each cell is mapped to a site on the underlying graph or lattice that represents the system. Using percolation theory, one can explain many properties of this system. It is an example of the invasion percolation model in which fluid is introduced in the system from any random site.In hydrology, one is concerned with runoff and formation of catchments. The boundary between different drainage basin forms a drainage divide with a fractal dimension of about 1.22.
The retention problem can be mapped to standard percolation.
For a system of five equally probable levels, for example, the amount of water stored R5 is just the sum of the water stored in two-level systems R2 with varying fractions of levels p in the lowest state:
Typical two-level systems 1,2 with p = 0.2, 0.4, 0.6, 0.8 are shown on the right. The net retention of a five-level system is the sum of all these. The top level traps no water because it is far above the percolation threshold for a square lattice, 0.592746.
The retention of a two-level system R2 is the amount of water connected to ponds that do not touch the boundary of the system. When p is above the critical percolation threshold p c, there will be a percolating cluster or pond that visits the entire system. The probability that a point belongs to the percolating or "infinite" cluster is written as P∞ in percolation theory, and it is related to R2 by R2/L2 = p − P∞ where L is the size of the square. Thus, the retention of a multilevel system can be related to a well-known quantity in percolation theory.
To measure the retention, one can use a flooding algorithm in which water is introduced from the boundaries and floods through the lowest spillway as the level is raised. The retention is just the difference in the water level that a site was flooded minus the height of the terrain below it.
Besides the systems of discrete levels described above, one can make the terrain variable a continuous variable say from 0 to 1. Likewise, one can make the surface height itself be a continuous function of the spatial variables. In all cases, the basic concept of the mapping to an appropriate percolation system remains.
A curious result is that a square system of n discrete levels can retain more water than a system of n+1 levels, for sufficiently large order L > L*. This behavior can be understood through percolation theory, which can also be used to estimate L* ≈ −ν where ν = 4/3, p = i*/n where i* is the largest value of i such that i/n < pc, and pc = 0.592746 is the site percolation threshold for a square lattice. Numerical simulations give the following values of L*, which are extrapolated to non-integer values. For example, R2 < R3 for L ≤ 51, but R2 > R''3 for L ≥ 52:
n | n+1 | L* | Retention at L* |
2 | 3 | 51.12 | 790 |
4 | 5 | 198.1 | 26000 |
7 | 8 | 440.3 | 246300 |
9 | 10 | 559.1 | 502000 |
12 | 13 | 1390.6 | 428850 |
14 | 15 | 1016.3 | 2607000 |
As n gets larger, crossing become less and less frequent, and the value of L* where crossing occurs is no longer a monotonic function of n.
The retention when the surface is not entirely random but correlated with a Hurst exponent H is discussed in.
Algorithms
The following time line shows the application of different algorithms that have expanded the size of the square that can be evaluated for retention2007 Define all neighbor-avoiding walks from each interior cell to the exterior and then sort all those paths for the least obstruction or cell value. The least obstruction value minus the interior cell value provides the water retention for that interior cell. The number of neighbor-avoiding walks to be evaluated grows exponentially with the square size and thus limits this methodology to L < 6.
2009 Flooding algorithm - water is introduced from the boundaries and floods through the lowest spillway as the level is raised. The retention is just the difference in the water level that a site was flooded minus the height of the terrain below it. The flooding algorithm allows for the evaluation of water retention up to L < 10,000. This algorithm is similar to Meyer's flooding algorithm that has been used in analysis of topographical surfaces.
2011 With the realization that an n-level system can be broken down into a collection of two-level systems with varying probabilities, standard percolation algorithms can be used to find the retention as simply the total number of sites at the lower level minus the draining regions. A novel application of the Hoshen-Kopelman algorithm in which both rows and columns are added one at a time allows L to be very large, but computing time considerations limits L to the order of 107.
Paths that drain water off the square, used in the neighbor-avoiding walk algorithm
The panel below from left to right shows: 1) the three unique interior positions for the 5×5 square; 2 & 4) correct paths off the square in grey for the interior corner cell in red; 3) incorrect path in grey as the water cannot travel on the diagonals; 5) this path is correct but there is a short-circuit possible between the grey cells. Neighbor-avoiding walks define the unique or non-redundant paths that drain water off the square.