Magic hypercube
In mathematics, a magic hypercube is the k-dimensional generalization of magic squares and magic cubes, that is, an n × n × n ×... × n array of integers such that the sums of the numbers on each pillar as well as on the main space diagonals are all the same. The common sum is called the magic constant of the hypercube, and is sometimes denoted Mk. If a magic hypercube consists of the numbers 1, 2,..., nk, then it has magic number
For k = 4, a magic hypercube may be called a magic tesseract, with sequence of magic numbers given by.
The side-length n of the magic hypercube is called its order. Four-, five-, six-, seven- and eight-dimensional magic hypercubes of order three have been constructed by J. R. Hendricks.
Marian Trenkler proved the following theorem:
A p-dimensional magic hypercube of order n exists if and only if
p > 1 and n is different from 2 or p = 1. A construction of a magic hypercube follows from the proof.
The R programming language includes a module,
library, that will create magic hypercubes of any dimension with n a multiple of 4.Perfect magic hypercubes
If, in addition, the numbers on every cross section diagonal also sum up to the hypercube's magic number, the hypercube is called a perfect magic hypercube; otherwise, it is called a semiperfect magic hypercube. The number n is called the order of the magic hypercube.This definition of "perfect" assumes that one of the older definitions for perfect magic cubes is used. The Universal Classification System for Hypercubes requires that for any dimension hypercube, all possible lines sum correctly for the hypercube to be considered perfect magic. Because of the confusion with the term perfect, nasik is now the preferred term for any magic hypercube where all possible lines sum to S. Nasik was defined in this manner by C. Planck in 1905. A nasik magic hypercube has lines of m numbers passing through each of the mn cells.
Nasik magic hypercubes
A Nasik magic hypercube is a magic hypercube with the added restriction that all possible lines through each cell sum correctly to S = where S is the magic constant, m the order and n the dimension of the hypercube.Or, to put it more concisely, all pan-r-agonals sum correctly for r = 1...n. This definition is the same as the Hendricks definition of perfect, but different from the Boyer/Trump definition.
The term nasik would apply to all dimensions of magic hypercubes in which the number of correctly summing paths through any cell of the hypercube is P =.
A pandiagonal magic square then would be a nasik square because 4 magic line pass through each of the m2 cells. This was A.H. Frost’s original definition of nasik. A nasik magic cube would have 13 magic lines passing through each of its m3 cells. A nasik magic tesseract would have 40 lines passing through each of its m4 cells, and so on.
History
In 1866 and 1878, Rev. A. H. Frost coined the term Nasik for the type of magic square we commonly call pandiagonal and often call perfect. He then demonstrated the concept with an order-7 cube we now class as pandiagonal, and an order-8 cube we class as pantriagonal. In another 1878 paper he showed another pandiagonal magic cube and a cube where all 13m lines sum correctly i.e. Hendricks perfect.He referred to all of these cubes as nasik as a respect to the great Indian Mathematician D R Kaprekar who hails from Deolali in Nasik District in Maharashtra, India.
In 1905 Dr. Planck expanded on the nasik idea in his Theory of Paths Nasik. In the introductory to his paper, he wrote;
In 1917, Dr. Planck wrote again on this subject.
In 1939, B. Rosser and R. J. Walker published a series of papers on diabolic magic squares and cubes. They specifically mentioned that these cubes contained 13m2 correctly summing lines. They also had 3m pandiagonal magic squares parallel to the faces of the cube, and 6m pandiagonal magic squares parallel to the space-diagonal planes.
Notations
in order to keep things in hand a special notation was developed:- : positions within the hypercube
- : vector through the hypercube
As is indicated k runs through the dimensions, while the coordinate i runs through all possible values, when values i are outside the range it is simply moved back into the range by adding or subtracting appropriate multiples of m, as the magic hypercube resides in n-dimensional modular space.
There can be multiple k between brackets, these cannot have the same value, though in undetermined order, which explains the equality of:
Of course given k also one value i is referred to.
When a specific coordinate value is mentioned the other values can be taken as 0, which is especially the case when the amount of 'k's are limited using pe. #k = 1 as in:
j now runs through all the values in .
Further: without restrictions specified 'k' as well as 'i' run through all possible values, in combinations same letters assume same values. Thus makes it possible to specify a particular line within the hypercube
Note: as far as I know this notation is not in general use yet, Hypercubes are not generally analyzed in this particular manner.
Further: "perm" specifies a permutation of the n numbers 0..n-1.
Construction
Besides more specific constructions two more general construction method are noticeable:KnightJump construction
This construction generalizes the movement of the chessboard horses to more general movements. The method starts at the position P0 and further numbers are sequentially placed at positions further until a position is reached that is already occupied, a further vector is needed to find the next free position. Thus the method is specified by the n by n+1 matrix:This positions the number 'k' at position:
C. Planck gives in his 1905 article conditions to create with this method "Path Nasik" hypercubes.
Latin prescription construction
.This method is also specified by an n by n+1 matrix. However this time it multiplies the n+1 vector , After this multiplication the result is taken modulus m to achieve the n hypercubes:
LPk = % m
of radix m numbers. On these LPk's "digit changing" are generally applied before these LPk's are combined into the hypercube:
nHm = k=0Σn-1 LPk mk
J.R.Hendricks often uses modular equation, conditions to make hypercubes of various quality can be found on at several places
Both methods fill the hypercube with numbers, the knight-jump guarantees that every number is present. The Latin prescription only if the components are orthogonal
Multiplication
Amongst the various ways of compounding, the multiplication can be considered as the most basic of these methods. The basic multiplication is given by:nHm1 * nHm2 : nm1m2 = nm1m1n]m2 + m2]m1m2
Most compounding methods can be viewed as variations of the above, As most qualifiers are invariant under multiplication one can for example place any aspectual variant of nHm2 in the above equation, besides that on the result one can apply a manipulation to improve quality. Thus one can specify pe the J. R. Hendricks / M. Trenklar doubling. These things go beyond the scope of this article.
Aspects
A hypercube knows n! 2n Aspectial variants, which are obtained by coordinate reflection and coordinate permutations effectively giving the Aspectial variant:nHm~R perm; R = k=0Σn-1 ; perm a permutation of 0..n-1
Where reflect true iff coordinate k is being reflected, only then 2k is added to R.
As is easy to see, only n coordinates can be reflected explaining 2n, the n! permutation of n coordinates explains the other factor to the total amount of "Aspectial variants"!
Aspectial variants are generally seen as being equal. Thus any hypercube can be represented shown in "normal position" by:
= min
< ; k = 0..n-2
Basic manipulations
Besides more specific manipulations, the following are of more general nature- # : component permutation
- ^ : coordinate permutation
- _2axis : monagonal permutation
- = : digit change
Component permutation
Defined as the exchange of components, thus varying the factor mk in mperm, because there are n component hypercubes the permutation is over these n componentsCoordinate permutation
The exchange of coordinate into , because of n coordinates a permutation over these n directions is required. The term transpose is used with two dimensional matrices, in general though perhaps "coordinate permutation" might be preferable.Monagonal permutation
Defined as the change of into alongside the given "axial"-direction. Equal permutation along various axes can be combined by adding the factors 2axis. Thus defining all kinds of r-agonal permutations for any r. Easy to see that all possibilities are given by the corresponding permutation of m numbers.Noted be that reflection is the special case:
~R = _R
Further when all the axes undergo the same permutation an n-agonal permutation is achieved, In this special case the 'R' is usually omitted so:
_ = _
Digitchanging
Usually being applied at component level and can be seen as given by in '''perm since a component is filled with radix m digits, a permutation over m numbers is an appropriate manner to denote these.Pathfinders
J. R. Hendricks called the directions within a hypercubes "pathfinders", these directions are simplest denoted in a ternary number system as:Pfp where: p = k=0Σn-1 3k <> <ki> ; i ε
This gives 3n directions. since every direction is traversed both ways one can limit to the upper half of the full range.
With these pathfinders any line to be summed over can be specified:
< j1 kθ l0 ; θ ε > ; p,q ε
which specifies all r-agonals, p and q ranges could be omitted from this description. The main r-agonals are thus given by the slight modification of the above:
< j1 k1 l-1 s0 >
Qualifications
A hypercube nHm with numbers in the analytical numberrange has the magic sum:nSm = m / 2.
Besides more specific qualifications the following are the most important, "summing" of course stands for "summing correctly to the magic sum"
- : all main r-agonals are summing.
- : all r-agonals are summing.
- :
- :
In case the hypercube also sum when all the numbers are raised to the power p one gets p-multimagic hypercubes. The above qualifiers are simply prepended onto the p-multimagic qualifier. This defines qualifications as. Here also "2-" is usually replaced by "bi", "3-" by "tri" etc.. The sum for p-Multimagic hypercubes can be found by using Faulhaber's formula and divide it by mn-1.
Also "magic" is usually assumed, the Trump/Boyer cube is technically seen.
Nasik magic hypercube gives arguments for using as synonymous to. The strange generalization of square 'perfect' to using it synonymous to in cubes is however also resolve by putting curly brackets around qualifiers, so means .
some minor qualifications are:
- :
- :
for the complement of is at position .
for squares: is the "modern/alternative qualification" of what Dame Kathleen Ollerenshaw called most-perfect magic square, is the qualifier for the feature in more than 2 dimensions.
Caution: some people seems to equate with instead of. Since this introductory article is not the place to discuss these kind of issues I put in the dimensional pre-superscript n to both these qualifiers consequences of is that several figures also sum since they can be formed by adding/subtracting order 2 sub-hyper cubes. Issues like these go beyond this articles scope.
Magic hyperbeam
A magic hyperbeam is a variation on a magic hypercube where the orders along each direction may be different. As such a magic hyperbeam generalises the two dimensional magic rectangle and the three dimensional magic beam, a series that mimics the series magic square, magic cube and magic hypercube. This article will mimic the magic hypercubes article in close detail, and just as that article serves merely as an introduction to the topic.Conventions
It is customary to denote the dimension with the letter 'n' and the orders of a hyperbeam with the letter 'm'.- Dimension : the amount of directions within a hyperbeam.
- Order : the amount of numbers along kth monagonal k = 0,..., n − 1.
Notations
in order to keep things in hand a special notation was developed:- ; i= ]: positions within the hyperbeam
- : vectors through the hyperbeam
Construction
Basic
Description of more general methods might be put here, I don't often create hyperbeams, so I don't know whether Knightjump or Latin Prescription work here.Other more adhoc methods suffice on occasion I need a hyperbeam.
Multiplication
Amongst the various ways of compounding, the multiplication can be considered as the most basic of these methods. The basic multiplication is given by:abbreviates: m0,..,mn-1. 12 abbreviates: m01m02,..,mn-11mn-12.
Curiosities
all orders are either even or odd
A fact that can be easily seen since the magic sums are:When any of the orders mk is even, the product is even and thus the only way Sk turns out integer is when all mk are even. Thus suffices: all mk are either even or odd.
This is with the exception of mk=1 of course, which allows for general identities like:
- Nmt = Nm,1 * N1,m
- Nm = N1,m * Nm,1
Only one direction with order = 2
since any number has but one complement only one of the directions can have mk = 2.Aspects
A hyperbeam knows 2n Aspectial variants, which are obtained by coördinate reflection effectively giving the Aspectial variant:nB~R ; R = k=0Σn-1 ;
Where reflect true if and only if coordinate k is being reflected, only then 2k is added to R.
In case one views different orientations of the beam as equal one could view the number of aspects n! 2n just as with the magic hypercubes, directions with equal orders contribute factors depending on the hyperbeam's orders. This goes beyond the scope of this article.
Basic manipulations
Besides more specific manipulations, the following are of more general nature- ^ : coördinate permutation
- _2axis : monagonal permutation
Coördinate permutation
The exchange of coördinaat into , because of n coördinates a permutation over these n directions is required. The term transpose is used with two dimensional matrices, in general though perhaps "coördinaatpermutation" might be preferable.Monagonal permutation
Defined as the change of into alongside the given "axial"-direction. Equal permutation along various axes with equal orders can be combined by adding the factors 2axis. Thus defining all kinds of r-agonal permutations for any r. Easy to see that all possibilities are given by the corresponding permutation of m numbers.normal position
In case no restrictions are considered on the n-agonals a magic hyperbeam can be represented shown in "normal position" by:Qualification
Qualifying the hyperbeam is less developed then it is on the magic hypercubes in fact only the k'th monagonal direction need to sum to:for all k = 0..n-1 for the hyperbeam to be qualified
When the orders are not relatively prime the n-agonal sum can be restricted to:
with all orders relatively prime this reaches its maximum: