Home Up

Instructions
Instructions Generator Applications Theory Algorithm Other Sites

 

 

WIN 32

 

The software used to generate magic squares and hyper cubes is written in JAVA.

JAVA defines two types of programs: applications and applets.  Programs that operate inside a web browser are known as applets.  Programs that operate in a java virtual machine (JVM) are known as applications.  A JVM is a software program that controls the execution of JAVA applications.

This website supports both applets and applications.  However, you must download the JAVA runtime environment (JRE) to use either.  The JRE for Windows 95, Windows 98, and NT 4.0 (or higher) is available at http://java.sun.com/products/jdk/1.2/jre

***************************

There is one more option for generating Magic Squares and Hyper Cubes.  That is to download the java development kit (JDK).  This is a large file, but it will allow you to write your own JAVA programs, and modify the source code for the Magic Squares and Hyper Cubes program.  You can download the JDK from http://java.sun.com/products/jdk/1.2/

    

If you have downloaded the JDK, you can generate magic squares and hypercubes by downloading the generator software from this site:

  1. Download the file magic.jar
  2. Extract 9 "class" files.  (by executing "jar xvf magic.jar").
  3. Run the generator (by executing "java HyperMagic01")

Alternatively, you can download and compile the JAVA source code for the application,

or the source code for the applet.

The following are instructions for the application:

  1. Compile the source code (by executing "javac HyperMagic01.java")
  2. Run the generator (by executing "java HyperMagic01")

If you would like to run or modify the applet, duplicate the HTML code on the "generator.htm" page from this web.

When executing the commands above, don't use the quotation marks and pay attention to upper and lower case letters.  If you have problems, let me know at Charlie.Kelly@broadband-inc.com.

Required Inputs

Dimensions: An ordinary magic square has 2 dimensions.  A magic cube has three dimensions.  Magic hyper-cubes have 4 or more dimensions.
Row Size:  The number of cells in each row of the hyper-cube.  3 is the row size for an ordinary magic square in the form of a "tic-tac-toe" that has three rows and three columns.   Row Size should be an odd number.  If you use an even number, the program will increase your value by 1.
Offset: The default offset is calculated so that the "middle cell" will be zero, and the sum for each row, column, and principal diagonal will also be zero.  To generate a "standard" magic square, select the "custom" button and set the offset to 1.
Generator Button: After you input the number of dimensions, click the "Make Magic" button to generate your magic hyper-cube.
 
Row and Column Summations
Using the "default" offset, each row and column sums to zero.  This makes it easier to see the symmetry in tables.  It is especially useful for seeing the symmetry in hyper-cubes.  You can convert these cubes to a "standard" format by setting the "custom" offset to 1.   For example, generate a magic square with 2 dimensions and 3 cells per row.   You can convert this to the "ordinary" magic square by adding 5 to each cell.  Please see the "Theory" page in this web for further explanations.
Timing
A magic square with 2 dimensions and 1001 cells per row contains 1,002,001 cells.   It takes approximately 15 seconds to generate this magic square on a Pentium II running at 266 MHz.  The slowest part of the process is downloading the program and initializing your browser for JAVA.
 
Output
The output is presented in a table.   There is one line of space between each two dimensional object.  Two lines of space between each three dimensional object and n lines of space between each n+1 dimensional object.  The first column in the table uses "****" as a separator.  The number of lines between tables indicates separation between n-dimensional objects.  (There are n-1 lines containing "****" between n-dimensional objects.)