magic: create and investigate magic squares

a collection of efficient, vectorized algorithms for the creation and investigation of magic squares and hypercubes, including a variety of functions for the manipulation and analysis of arbitrarily dimensioned arrays. The package includes methods for creating normal magic squares of any order greater than 2. The ultimate intention is for the package to be a computerized embodiment all magic square knowledge, including direct numerical verification of properties of magic squares (such as recent results on the determinant of odd-ordered semimagic squares). Some antimagic functionality is included. The package also serves as a rebuttal to the often-heard comment "I thought R was just for statistics".

Install the latest version of this package by entering the following in R:
install.packages("magic")
AuthorRobin K. S. Hankin
Date of publication2013-11-20 00:55:43
Maintainer"Robin K. S. Hankin" <hankin.robin@gmail.com>
LicenseGPL-2
Version1.5-6

View on CRAN

Man pages

adiag: Binds arrays corner-to-corner

allsubhypercubes: Subhypercubes of magic hypercubes

allsums: Row, column, and two diagonal sums of arrays

apad: Pad arrays

apl: Replacements for APL functions take and drop

aplus: Generalized array addition

arev: Reverses some dimensions; a generalization of rev

arot: Rotates an array about two specified dimensions

arow: Generalized row and col

as.standard: Standard form for magic squares

cilleruelo: A class of multiplicative magic squares due to Cilleruelo and...

circulant: Circulant matrices of any order

cube2: A pantriagonal magic cube

diag.off: Extracts broken diagonals

do.index: Apply a function to array element indices

eq: Comparison of two magic squares

fnsd: First non-singleton dimension

force.integer: Integerize array elements

Frankenstein: A perfect magic cube due to Frankenstein

hadamard: Hadamard matrices

hendricks: A perfect magic cube due to Hendricks

hudson: Pandiagonal magic squares due to Hudson

is.magic: Various tests for the magicness of a square

is.magichypercube: magic hypercubes

is.ok: does a vector have the sum required to be a row or column of...

is.square.palindromic: Is a square matrix square palindromic?

latin: Random latin squares

lozenge: Conway's lozenge algorithm for magic squares

magic: Creates magic squares

magic.2np1: Magic squares of odd order

magic.4n: Magic squares of order 4n

magic.4np2: Magic squares of order 4n+2

magic.8: Regular magic squares of order 8

magic.constant: Magic constant of a magic square or hypercube

magiccube.2np1: Magic cubes of order 2n+1

magiccubes: Magic cubes of order 3

magichypercube.4n: Magic hypercubes of order 4n

magic.package: Magic squares and hypercubes; arbitrary dimensioned array...

magicplot: Joins consecutive numbers of a magic square.

magic.prime: Magic squares prime order

magic.product: Product of two magic squares

minmax: are all elements of a vector identical?

notmagic.2n: An unmagic square

nqueens: N queens problem

Ollerenshaw: A most perfect square due to Ollerenshaw

panmagic.4: Panmagic squares of order 4

panmagic.6npm1: Panmagic squares of order 4n, 6n+1 and 6n-1

panmagic.8: Panmagic squares of order 8

perfectcube5: A perfect magic cube of order 5

perfectcube6: A perfect cube of order 6

process: Force index arrays into range

recurse: Recursively apply a permutation

sam: Sparse antimagic squares

shift: Shift origin of arrays and vectors

strachey: Strachey's algorithm for magic squares

subsums: Sums of submatrices

transf: Frenicle's equivalent magic squares

Functions

adiag Man page
allsubhypercubes Man page
allsums Man page
another_incidence Man page
another_latin Man page
apad Man page
apl Man page
apldrop Man page
apldrop<- Man page
apltake Man page
apltake<- Man page
aplus Man page
arev Man page
arot Man page
arow Man page
ashift Man page
as.standard Man page
bernhardsson Man page
bernhardssonA Man page
bernhardssonB Man page
cilleruelo Man page
circulant Man page
cube2 Man page
diag.off Man page
do.index Man page
eq Man page
\%eq\% Man page
fnsd Man page
force.integer Man page
Frankenstein Man page
ge Man page
\%ge\% Man page
gt Man page
\%gt\% Man page
hadamard Man page
hendricks Man page
hudson Man page
incidence Man page
inc_to_inc Man page
is.2x2.correct Man page
is.alicehypercube Man page
is.antimagic Man page
is.associative Man page
is.bree.correct Man page
is.centrosymmetric Man page
is.circulant Man page
is.diagonally.correct Man page
is.hadamard Man page
is.heterosquare Man page
is.incidence Man page
is.incidence.improper Man page
is.latin Man page
is.latinhypercube Man page
is.magic Man page
is.magichypercube Man page
is.mostperfect Man page
is.nasik Man page
is.normal Man page
is.ok Man page
is.pandiagonal Man page
is.panmagic Man page
is.perfect Man page
is.persymmetric Man page
is.regular Man page
is.sam Man page
is.semimagic Man page
is.semimagic.default Man page
is.semimagichypercube Man page
is.sparse Man page
is.square.palindromic Man page
is.stam Man page
is.standard Man page
is.standard.toroidal Man page
is.totally.antimagic Man page
is.totally.heterosquare Man page
is.ultramagic Man page
latin Man page
le Man page
\%le\% Man page
lozenge Man page
lt Man page
\%lt\% Man page
magic Man page
magic.2np1 Man page
magic.4n Man page
magic.4np2 Man page
magic.8 Man page
magic.constant Man page
magiccube.2np1 Man page
magiccubes Man page
magichypercube.4n Man page
magic-package Man page
magicplot Man page
magic.prime Man page
magic.product Man page
magic.product.fast Man page
minmax Man page
ne Man page
\%ne\% Man page
notmagic.2n Man page
nqueens Man page
Ollerenshaw Man page
panmagic.4 Man page
panmagic.4n Man page
panmagic.6nm1 Man page
panmagic.6np1 Man page
panmagic.6npm1 Man page
panmagic.8 Man page
perfectcube5 Man page
perfectcube6 Man page
process Man page
recurse Man page
rlatin Man page
sam Man page
shift Man page
strachey Man page
subsums Man page
sylvester Man page
take Man page
transf Man page
unincidence Man page
Spark Online Training by Edureka

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.