Learn R Programming

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

magic (version 1.3-20)

create and investigate magic squares

Description

a collection of efficient, vectorized algorithms for the creation and investigation of magic squares, including 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

20,463

Version

1.3-20

License

GPL

Maintainer

Robin Hankin

Last Published

November 16th, 2022

Functions in magic (1.3-20)

lozenge

Conway's lozenge algorithm for magic squares
process

Force index arrays into range
apad

Pad arrays
is.ok

does a vector have the sum required to be a row or column of a magic square?
force.integer

Integerize array elements
arow

Generalized row and col
is.magic

Various tests for the magicness of a square
magichypercube.4n

Magic hypercubes of order 4n
allsubhypercubes

Subhypercubes of magic hypercubes
cube2

A pantriagonal magic cube
Frankenstein

A perfect magic cube due to Frankenstein
notmagic.2n

An unmagic square
magiccube.2np1

Magic cubes of order 2n+1
Ollerenshaw

A most perfect square due to Ollerenshaw
hendricks

A perfect magic cube due to Hendricks
fnsd

First non-singleton dimension
strachey

Strachey's algorithm for magic squares
panmagic.8

Panmagic squares of order 8
hudson

Pandiagonal magic squares due to Hudson
allsums

Row, column, and two diagonal sums of arrays
magicplot

Joins consecutive numbers of a magic square.
arot

Rotates an array about two specified dimensions
circulant

Circulant matrices of any order
magic.product

Product of two magic squares
magic

Creates magic squares
panmagic.4

Panmagic squares of order 4
magic.4n

Magic squares of order 4n
magiccubes

Magic cubes of order 3
magic.prime

Magic squares prime order
as.standard

Standard form for magic squares
perfectcube6

A perfect cube of order 6
eq

Comparison of two magic squares
magic.8

Regular magic squares of order 8
subsums

Sums of submatrices
is.magichypercube

magic hypercubes
apl

Replacements for APL functions take and drop
diag.off

Extracts broken diagonals
minmax

are all elements of a vector identical?
magic.4np2

Magic squares of order 4n+2
is.square.palindromic

Is a square matrix square palindromic?
recurse

Recursively apply a permutation
magic.2np1

Magic squares of odd order
shift

Shift origin of arrays and vectors
arev

Reverses some dimensions; a generalization of rev
adiag

Binds arrays corner-to-corner
magic.constant

Magic constant of a magic square
perfectcube5

A perfect magic cube of order 5
transf

Frenicle's equivalent magic squares