Description Usage Arguments Value Note Author(s) See Also Examples
Returns all rowsums, all columnsums, and all (broken) diagonal sums of a putative magic square.
1 |
m |
The square to be tested |
func |
Function, with default |
... |
Further arguments passed to |
Returns a list of four elements. In the following, “sums” means “the result of applying func()”.
rowsums |
All n row sums |
colsums |
All n column sums |
majors |
All n broken major diagonals (northwest-southeast).
First element is the long (unbroken) major diagonal, tested by
|
minors |
All n broken minor diagonals (northeast-southwest). First element is the long (unbroken) minor diagonal. |
If func()
returns a vector, then the allsums()
returns a
list whose columns are the result of applying func()
. See third
and fourth examples below.
Used by is.magic()
et seq.
The major and minor diagonals would benefit from being recoded in C.
Robin K. S. Hankin
is.magic
,is.semimagic
,is.panmagic
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.