Manuals/calci/MAGICSQUARE

Revision as of 03:38, 1 April 2014 by Devika (talk | contribs)
MAGICSQUARE(ss,fn,gi,p2i)


  • is the size of the magic square.
  • is the first number.
  • is the gamma increment.
  • is the plus2 increment.

Description

  • This function gives the table value of magic quares.
  • A magic square is containing the set of numbers which is arranged in same number of rows and columns such that the sum of each row,column and the front and back main diagonals are the same value.
  • There are many ways to find the magic square values.
  • Also all the values are existing for magic square other than the 2x2 matrix.
  • Because it is impossible to construct the magic square of size 2.
  • Let the order of the magic square is n.
  • According to that the magic square is of three main types:
  1. Odd number. 
  2. Singly even 
  3. Doubly even.
  • Let the magic square of order n.
  • 1. Odd number: It means that the magic square with the order of odd numbers.
  • To determine the sum of any normal magic square we use the formula:  .
  • 2. Singly even : It means the number which is divisible by 2 but not by 4.
  • There is no magic square constructed by 2x2 square matrix , so singly even magic square is constructed for 6,10,14 and so on.
  • So the formula for generating the singly even numbers is: .
  • The formula for magic sum for the singly even magic square is: .
  • 3.Doubly even: It means the number which is divisible by 4.
  • So doubly even square is constructed for 4,8,12 and so on.
  • The formula for magic sum for the doubly even magic square is: .
  • In  ,  is the starting number which is indicating the numbers have to start from.
  •   is the gamma increment and   is the plus 2 increment.
  • The formulas for the magic square is:
  • Let square size=M,First number=F,Gamma increment=GI,and Plus two increment=PI.
*Pure Sum=(1/2)(M)(M^2+1).
*First number total=M(F-1). 
*CT=1+2+..M.
*Gamma increment total(GIT)=(CT-M){M(GI-1)}.
*PIT(Plus2 Increment Total )=(CT-M)(PI-1).                    
*SET(singly even total)=(M*M/2)(PI-GI) for singly even, 0 otherwise. 
*Calculated Magic Sum = PS + FT + GIT + PIT + SET 

Examples

1.MAGICSQUARE(3)

2 7 6
9 5 1
4 3 8