magic                 package:matlab                 R Documentation

_M_A_T_L_A_B _m_a_g_i_c _f_u_n_c_t_i_o_n

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

     Create a magic square.

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

     magic(n)

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

       n: numeric scalar specifying dimensions for the result

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

     The value of the characteristic sum for a magic square of order
     'n' is sum(1:n^2)/n. The order 'n' must be a scalar greater than
     or equal to 3; otherwise, the result will be either a nonmagic
     square, or else the degenerate magic squares 1 and [].

_V_a_l_u_e:

     Returns an 'n'-by-'n' matrix constructed from the integers '1'
     through N^2 with equal row and column sums.

_N_o_t_e:

     A magic square, scaled by its magic sum, is doubly stochastic.

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

     P. Roebuck, roebuck@mdanderson.org

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

     'ones', 'zeros'

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

     magic(3)

