strachey                package:magic                R Documentation

_S_t_r_a_c_h_e_y'_s _a_l_g_o_r_i_t_h_m _f_o_r _m_a_g_i_c _s_q_u_a_r_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Uses Strachey's algorithm to produce magic squares of singly-even
     order.

_U_s_a_g_e:

     strachey(m, square=magic.2np1(m))

_A_r_g_u_m_e_n_t_s:

       m: magic square produced of order 'n=2m+1'

  square: magic square of order '2m+1' needed for Strachey's method. 
          Default value gives the standard construction, but the 
          method will work with any odd order magic square

_D_e_t_a_i_l_s:

     Strachey's method essentially places four identical magic squares
     2m+1 together to form one of n=4m+2.  Then 0,n^2/4/n^2/2,3n^2/4 is
     added to each square; and finally, certain squares are swapped
     from the top subsquare to the bottom subsquare.

     See the final example for an illustration of how this works, using
     a zero matrix as the submatrix.    Observe how some 75s are
     swapped with some 0s, and some 50s with some 25s.

_A_u_t_h_o_r(_s):

     Robin K. S. Hankin

_S_e_e _A_l_s_o:

     'magic.4np2','lozenge'

_E_x_a_m_p_l_e_s:

      strachey(3)
      strachey(2,square=magic(5))

      strachey(2,square=magic(5)) %eq%  strachey(2,square=t(magic(5)))
      #should be FALSE

      #Show which numbers have been swapped:
      strachey(2,square=matrix(0,5,5))

      #It's still magic, but not normal:
       is.magic(strachey(2,square=matrix(0,5,5)))

