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.[1]
Magic squares
Magic squares have been studied for over 2000 years. In 2007, the idea of studying the water retention on a magic square was proposed.[2] In 2010, a competition at Al Zimmermann's Programing Contests[3] produced the presently known maximum retention values for magic squares order 4 to 28.[4] Computing tools used to investigate and illustrate this problem are found here.[5][6][7][8]
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.[2]
|
|
|
|
Maximum-retention magic squares for orders 7-9 are shown below:[4]
|
|
|
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.[2]
|
|
|
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:[4]
|
|
The most-perfect magic squares require all (n-1)^2 or in this case all 121 2x2 planar subsets to have the same sum. ( a few examples flagged with yellow background, red font). Areas completely surrounded by larger numbers are shown with a blue background.[9]
![]() |
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 [5] 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.[2]
|
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 ( in this case 7 cells on each edge) [3] The second image is doctored, shading in the top and bottom 37 values.
The figure below is a 17x17 Luo-Shu format magic square.[10] 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 (151-7=144 units retained). Water rained into this cell exits the square at the yellow 10 cell.
|
|
Mario Mamzeris invented his own method for constructing odd order magic squares. His Order 19 associative magic square is shown below.[11]
In the 21 x 21 magic square below all the even numbers form dams and ponds and all the odd numbers provide exit paths.[12]
![]() |
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.
1 | 5 | 259 | 659 | 257 | 713 | 712 | 282 | 256 | 283 | 657 | 255 | 656 | 284 | 726 | 725 | 254 | 285 | 654 | 253 | 286 | 55 | 673 | 674 | 471 | 645 | 7 | 3 |
9 | 640 | 664 | 25 | 717 | 26 | 27 | 716 | 715 | 714 | 28 | 668 | 29 | 744 | 30 | 31 | 730 | 743 | 50 | 681 | 680 | 679 | 51 | 52 | 678 | 206 | 646 | 11 |
265 | 665 | 355 | 722 | 496 | 618 | 71 | 484 | 95 | 121 | 721 | 400 | 774 | 418 | 130 | 176 | 293 | 541 | 749 | 479 | 106 | 175 | 389 | 148 | 230 | 682 | 43 | 644 |
663 | 14 | 724 | 356 | 313 | 513 | 75 | 189 | 198 | 449 | 213 | 775 | 87 | 478 | 539 | 139 | 326 | 60 | 451 | 750 | 461 | 566 | 141 | 442 | 638 | 477 | 677 | 276 |
266 | 720 | 164 | 572 | 354 | 226 | 491 | 171 | 512 | 117 | 776 | 247 | 244 | 503 | 435 | 85 | 629 | 406 | 144 | 634 | 751 | 592 | 462 | 125 | 134 | 514 | 44 | 672 |
711 | 15 | 565 | 116 | 100 | 357 | 579 | 112 | 637 | 777 | 108 | 469 | 433 | 546 | 80 | 559 | 525 | 468 | 526 | 227 | 146 | 752 | 368 | 557 | 328 | 212 | 46 | 671 |
710 | 16 | 153 | 174 | 222 | 119 | 353 | 627 | 778 | 64 | 297 | 456 | 544 | 474 | 178 | 473 | 410 | 563 | 515 | 331 | 403 | 387 | 753 | 402 | 569 | 304 | 45 | 670 |
709 | 17 | 70 | 325 | 168 | 509 | 445 | 779 | 166 | 366 | 401 | 83 | 92 | 482 | 129 | 338 | 408 | 492 | 585 | 529 | 369 | 298 | 424 | 754 | 582 | 519 | 676 | 275 |
267 | 719 | 156 | 103 | 455 | 531 | 780 | 391 | 358 | 537 | 76 | 142 | 367 | 309 | 522 | 245 | 320 | 437 | 632 | 386 | 545 | 497 | 224 | 123 | 755 | 161 | 675 | 277 |
264 | 718 | 444 | 600 | 508 | 781 | 196 | 553 | 65 | 352 | 488 | 344 | 624 | 104 | 216 | 551 | 98 | 616 | 370 | 294 | 233 | 101 | 416 | 490 | 109 | 756 | 47 | 652 |
662 | 18 | 723 | 417 | 782 | 310 | 564 | 606 | 420 | 483 | 359 | 518 | 548 | 246 | 475 | 58 | 628 | 385 | 571 | 69 | 149 | 223 | 335 | 235 | 86 | 113 | 733 | 274 |
263 | 669 | 218 | 783 | 127 | 429 | 581 | 77 | 399 | 136 | 88 | 351 | 602 | 538 | 636 | 635 | 371 | 220 | 74 | 570 | 99 | 633 | 543 | 498 | 502 | 173 | 48 | 727 |
661 | 19 | 784 | 407 | 179 | 184 | 195 | 609 | 393 | 495 | 203 | 567 | 360 | 576 | 394 | 384 | 388 | 137 | 625 | 154 | 523 | 229 | 489 | 485 | 219 | 314 | 738 | 279 |
268 | 748 | 597 | 307 | 505 | 615 | 441 | 315 | 583 | 562 | 194 | 542 | 446 | 350 | 372 | 588 | 316 | 443 | 120 | 162 | 89 | 102 | 560 | 317 | 110 | 329 | 737 | 272 |
729 | 20 | 521 | 177 | 232 | 340 | 128 | 411 | 152 | 122 | 334 | 241 | 605 | 383 | 361 | 412 | 578 | 202 | 619 | 73 | 611 | 549 | 589 | 587 | 432 | 568 | 736 | 278 |
262 | 746 | 68 | 580 | 242 | 187 | 558 | 183 | 398 | 601 | 594 | 182 | 373 | 296 | 460 | 349 | 332 | 556 | 205 | 419 | 614 | 323 | 547 | 586 | 207 | 114 | 735 | 273 |
269 | 745 | 458 | 131 | 111 | 78 | 337 | 610 | 532 | 612 | 622 | 382 | 59 | 365 | 554 | 448 | 362 | 613 | 82 | 574 | 172 | 493 | 466 | 126 | 145 | 630 | 734 | 280 |
261 | 747 | 158 | 465 | 598 | 221 | 459 | 214 | 524 | 167 | 374 | 608 | 533 | 409 | 319 | 330 | 595 | 348 | 181 | 428 | 305 | 453 | 584 | 199 | 61 | 765 | 33 | 651 |
660 | 21 | 773 | 536 | 561 | 94 | 345 | 165 | 204 | 381 | 621 | 528 | 447 | 211 | 500 | 135 | 452 | 342 | 363 | 301 | 396 | 527 | 185 | 225 | 764 | 306 | 666 | 281 |
270 | 694 | 517 | 772 | 392 | 431 | 312 | 240 | 375 | 190 | 617 | 151 | 91 | 324 | 333 | 520 | 231 | 215 | 511 | 347 | 540 | 238 | 97 | 763 | 413 | 707 | 49 | 650 |
260 | 693 | 105 | 405 | 771 | 550 | 295 | 380 | 302 | 336 | 311 | 620 | 234 | 133 | 427 | 197 | 516 | 150 | 90 | 607 | 364 | 425 | 762 | 486 | 67 | 530 | 703 | 271 |
53 | 692 | 300 | 163 | 631 | 770 | 376 | 191 | 157 | 552 | 414 | 415 | 555 | 422 | 626 | 590 | 339 | 507 | 79 | 188 | 147 | 761 | 430 | 308 | 436 | 132 | 702 | 54 |
683 | 22 | 397 | 423 | 535 | 379 | 769 | 155 | 421 | 494 | 322 | 454 | 390 | 217 | 510 | 623 | 107 | 200 | 591 | 186 | 760 | 341 | 346 | 593 | 237 | 115 | 24 | 696 |
684 | 23 | 228 | 118 | 377 | 575 | 303 | 768 | 327 | 534 | 487 | 573 | 438 | 472 | 457 | 599 | 464 | 439 | 143 | 759 | 604 | 138 | 160 | 72 | 395 | 124 | 32 | 697 |
480 | 691 | 209 | 378 | 440 | 504 | 140 | 501 | 767 | 81 | 201 | 159 | 404 | 210 | 467 | 577 | 57 | 169 | 758 | 193 | 426 | 470 | 93 | 596 | 639 | 180 | 701 | 499 |
648 | 258 | 695 | 299 | 192 | 208 | 481 | 321 | 318 | 766 | 463 | 96 | 63 | 506 | 84 | 236 | 239 | 757 | 343 | 708 | 450 | 243 | 170 | 434 | 603 | 706 | 62 | 641 |
10 | 649 | 38 | 690 | 39 | 37 | 689 | 688 | 687 | 40 | 732 | 36 | 742 | 741 | 740 | 739 | 731 | 41 | 667 | 35 | 705 | 42 | 34 | 13 | 704 | 66 | 643 | 12 |
2 | 6 | 647 | 287 | 686 | 685 | 288 | 252 | 251 | 658 | 289 | 728 | 250 | 249 | 290 | 248 | 291 | 655 | 292 | 653 | 56 | 698 | 699 | 700 | 476 | 642 | 8 | 4 |
Jarek Wroblewski March 24, 2010 |
This is a 32x32 panmagic square. Dwane Campbell using binary construction methods produced this interesting water retention example.[13] 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.[citation needed]
![]() |
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.[14][15][16]
In hydrology, one is concerned with runoff and formation of catchments.[17] The boundary between different drainage basin (watersheds in North America) forms a drainage divide with a fractal dimension of about 1.22.[18] [19] [20]
The retention problem can be mapped to standard percolation.[21][22][23] 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(p) with varying fractions of levels p in the lowest state:
- R5 = R2(1/5) + R2(2/5) + R2(3/5) + R2(4/5)
Typical two-level systems 1,2 with p = 0.2, 0.4, 0.6, 0.8 are shown on the right (blue: wet, green: dry, yellow: spillways bordering wet sites). 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(p) 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(p) by R2(p)/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* ≈ (p - pc)−ν 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 > R3 for L ≥ 52:[21]
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.[23]
Algorithms
The following time line shows the application of different algorithms that have expanded the size of the square that can be evaluated for retention
2007 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 (negative values are set to a retention value of 0). The number of neighbor-avoiding walks to be evaluated grows exponentially with the square size and thus limits this methodology to L < 6.[2]
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.[21] 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 (clusters of low-level sites touching the boundary). 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 (up to 109), but computing time considerations limits L to the order of 107.[24]
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.
|
|
|
|
|
See also
References
- ↑ https://oeis.org/A303295 OEIS A303295
- ↑ 2.0 2.1 2.2 2.3 2.4 Craig Knecht, http://www.knechtmagicsquare.paulscomputing.com
- ↑ 3.0 3.1 Al Zimmermann http://www.azspcs.net/Contest/MagicWater/FinalReport
- ↑ 4.0 4.1 4.2 Harvey Heinz, http://www.magic-squares.net/square-update-2.htm#Knecht
- ↑ 5.0 5.1 Harry White, http://budshaw.ca/Download.html
- ↑ Walter Trump http://www.trump.de/magic-squares/
- ↑ Johan Ofverstedt,http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-176018
- ↑ Hasan M., Masbaul Alam Polash M. (2020) An Efficient Constraint-Based Local Search for Maximizing Water Retention on Magic Squares. In: Hitendra Sarma T., Sankar V., Shaik R. (eds) Emerging Trends in Electrical, Communications, and Information Technologies. Lecture Notes in Electrical Engineering, vol 569. Springer, Singapore
- ↑ Sloane, N. J. A., ed. "Sequence A270205 (Number of 2 X 2 planar subsets in an n X n X n cube)". OEIS Foundation. https://oeis.org/A270205.
- ↑ Harvey Heinz,http://www.magic-squares.net/square-update.htm
- ↑ https://www.oddmagicsquares.com
- ↑ "Area Mapping". http://budshaw.ca/Download.html#highlight.
- ↑ http://magictesseract.com
- ↑ Chayes, J. T.; L. Chayes; C. M. Newman (1985). "The stochastic geometry of invasion percolation". Communications in Mathematical Physics 101 (3): 383–407. doi:10.1007/BF01216096. Bibcode: 1985CMaPh.101..383C.
- ↑ Damron, Michael; Artëm Sapozhnikov; Bálint Vágvölgyi (2009). "Relations between invasion percolation and critical percolation in two dimensions". Annals of Probability 37 (6): 2297–2331. doi:10.1214/09-AOP462.
- ↑ van den Berg, Jacob; Antal Járai; Bálint Vágvölgyi (2007). "The size of a pond in 2D invasion percolation". Electronic Communications in Probability 12: 411–420. doi:10.1214/ECP.v12-1327. Bibcode: 2007arXiv0708.4369V.
- ↑ Tetzlaff, D.; McDonnell, J. J.; Uhlenbrook, S.; McGuire, K. J.; Bogaart, P. W.; Naef, F.; Baird, A. J.; Dunn, S. M. et al. (2011). "Conceptualizing catchment processes: simply too complex?". Hydrological Processes 22 (11): 1727–1730. doi:10.1002/hyp.7069. Bibcode: 2008HyPr...22.1727T.
- ↑ Fehr, E.; D. Kadau; N. A. M. Araújo; J. S. Andrade Jr; H. J. Herrmann (2011). "Scaling Relations for Watersheds". Physical Review E 84 (3): 036116. doi:10.1103/PhysRevE.84.036116. PMID 22060465. Bibcode: 2011PhRvE..84c6116F.
- ↑ Schrenk, K. J.; N. A. M. Araújo; J. S. Andrade Jr; H. J. Herrmann (2012). "Fracturing Ranked Surfaces". Scientific Reports 2: 348. doi:10.1038/srep00348. PMID 22470841. Bibcode: 2012NatSR...2E.348S.
- ↑ Fehr, E.; D. Kadau; J. S. Andrade Jr; H. J. Herrmann (2011). "Impact of Perturbations on Watersheds". Physical Review Letters 106 (4): 048501. doi:10.1103/PhysRevLett.106.048501. PMID 21405368. Bibcode: 2011PhRvL.106d8501F.
- ↑ 21.0 21.1 21.2 Knecht, Craig; Walter Trump; Daniel ben-Avraham; Robert M. Ziff (2012). "Retention capacity of random surfaces". Physical Review Letters 108 (4): 045703. doi:10.1103/PhysRevLett.108.045703. PMID 22400865. Bibcode: 2012PhRvL.108d5703K. https://arxiv.org/trackback/1110.6166.
- ↑ Baek, Seung Ki; Beom Jun Kim (2012). "Critical Condition of the Water-Retention Model". Physical Review E 85 (3): 032103. doi:10.1103/PhysRevE.85.032103. PMID 22587136. Bibcode: 2012PhRvE..85c2103B.
- ↑ 23.0 23.1 Schrenk, K. J.; N. A. M Araújo; R. M. Ziff; H. J. Herrmann (2014). "Retention capacity of correlated surfaces". Physical Review E 89 (6): 062141. doi:10.1103/PhysRevE.89.062141. PMID 25019758. Bibcode: 2014PhRvE..89f2141S.
- ↑ Hoshen, Joseph (1998). "On the application of the enhanced Hoshen-Kopelman algorithm for image analysis". Pattern Recognition Letters 19 (7): 575–584. doi:10.1016/S0167-8655(98)00018-x.
Further reading
- Pickover, Clifford (2002). The Zen of Magic Squares, Circles, and Stars: An Exhibition of Surprising Structures Across Dimensions. Princeton, NJ: Princeton University Press. ISBN 978-0-691-11597-9.
- Stauffer, Dietrich; Aharony, A. (1994). Introduction to Percolation Theory. London Bristol, PA: Taylor & Francis. ISBN 978-0-7484-0253-3.
External links
- https://commons.wikimedia.org/wiki/Category:Associative_magic_squares_of_order_4
- Hugo Pfoertner. OEIS sequence A201126 (Maximum water retention of a magic square of order n), with links to magic square pictures
- Hugo Pfoertner. OEIS sequence A201127 (Maximum water retention of a semi-magic square of order n)
- Discussion site for Al Zimmermann's Programming Contests
- Item on Futility Closet
- OEIS sequence A261798 (Maximum water retention of an associative magic square of order n)
- OEIS sequence A268311 (Number of free polyominoes that form a continuous path of edge joined cells spanning an n X n square in both dimensions)—Polyominoe enumeration and lake patterns
- OEIS sequence A275359 (Maximum incarceration of numbers in an n X n X n number cubes with full incarceration volumes)—Upgrade the model from 2D to 3D
- [1] Nature 2018
- [2] Water retention histogram as a computing problem
- http://oeis.org/A331507/ Maximum number of ponds