Learn R Programming

⚠️There's a newer version (1.6-1) of this package.Take me there.

magic (version 1.3-24)

create and investigate magic squares

Description

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). The package also serves as a rebuttal to the often-heard comment "I thought R was just for statistics".

Copy Link

Version

Install

install.packages('magic')

Monthly Downloads

27,868

Version

1.3-24

License

GPL

Maintainer

Robin Hankin

Last Published

November 16th, 2022

Functions in magic (1.3-24)

apad

Pad arrays
eq

Comparison of two magic squares
arot

Rotates an array about two specified dimensions
magiccube.2np1

Magic cubes of order 2n+1
process

Force index arrays into range
hendricks

A perfect magic cube due to Hendricks
arev

Reverses some dimensions; a generalization of rev
as.standard

Standard form for magic squares
apl

Replacements for APL functions take and drop
magic.prime

Magic squares prime order
is.magichypercube

magic hypercubes
magic.4np2

Magic squares of order 4n+2
transf

Frenicle's equivalent magic squares
allsums

Row, column, and two diagonal sums of arrays
magic.2np1

Magic squares of odd order
cube2

A pantriagonal magic cube
recurse

Recursively apply a permutation
is.square.palindromic

Is a square matrix square palindromic?
arow

Generalized row and col
minmax

are all elements of a vector identical?
lozenge

Conway's lozenge algorithm for magic squares
magic-package

Magic squares and hypercubes; arbitrary dimensioned array manipulation
panmagic.8

Panmagic squares of order 8
perfectcube5

A perfect magic cube of order 5
perfectcube6

A perfect cube of order 6
allsubhypercubes

Subhypercubes of magic hypercubes
strachey

Strachey's algorithm for magic squares
magic.product

Product of two magic squares
magic.8

Regular magic squares of order 8
magiccubes

Magic cubes of order 3
Frankenstein

A perfect magic cube due to Frankenstein
Ollerenshaw

A most perfect square due to Ollerenshaw
subsums

Sums of submatrices
magic

Creates magic squares
circulant

Circulant matrices of any order
diag.off

Extracts broken diagonals
panmagic.4

Panmagic squares of order 4
magic.constant

Magic constant of a magic square
hudson

Pandiagonal magic squares due to Hudson
fnsd

First non-singleton dimension
magicplot

Joins consecutive numbers of a magic square.
magichypercube.4n

Magic hypercubes of order 4n
magic.4n

Magic squares of order 4n
adiag

Binds arrays corner-to-corner
shift

Shift origin of arrays and vectors
is.ok

does a vector have the sum required to be a row or column of a magic square?
notmagic.2n

An unmagic square
is.magic

Various tests for the magicness of a square
force.integer

Integerize array elements