Skip to main content
20-Turquoise
January 17, 2016
Solved

4x4 Magic Square.

  • January 17, 2016
  • 2 replies
  • 4011 views

Hello, Everyone.

(1).PNG

Is it possible to solve M matrix, the above ?

   Thanks in advance for your time and help.

       Regards.

Best answer by LucMeekes

One can get quite far though:

It's just that the inequality constraint (involving M01 and M03) is not obeyed. Note that I first tried:

But then I got an error message saying it's not allowed inside a solve block.


Luc

2 replies

23-Emerald IV
January 17, 2016

At first glance: no

Reason: your system is over-constrained. You have 16 variables to find, you can have only 16 constraints.

The requirement of a magic square (sums of all 4 rows and of all 4 columns and along the 2 main diagonals must be equal) already gives you at least 4+4+2-1=9 constraints. Now you've added 16 more constraints, totalling 25.

Another constraint from the magic square is that all your variables must be different AND in the range 1 through 16.

Success!

Luc

21-Topaz II
January 22, 2016

Dürer matrix.jpg

25-Diamond I
January 17, 2016

Apart from what Luc already wrote you would have to constraint the matrix elements to be integers - something which Mathcad is not really good at.

So I guess the better option to get a magic square is to write a program following one of the algorithms to build a magic square. There a quite some in print, ususally differing according to the magnitude of the sqare, distinguishing odd or even order and as far as I remember ther is a short algorithm dealing with squares of a mgnitude which is divisable by 4.

What exactly ist the problem you should solve for homework?

WE

LucMeekes23-Emerald IVAnswer
23-Emerald IV
January 17, 2016

One can get quite far though:

It's just that the inequality constraint (involving M01 and M03) is not obeyed. Note that I first tried:

But then I got an error message saying it's not allowed inside a solve block.


Luc

lvl10720-TurquoiseAuthor
20-Turquoise
January 17, 2016

  Thanks for your time and help, Werner and Luc.

  I have just realized my question at the moment about :  Pandiagonal magic square - Wikipedia, the free encyclopedia

(1).PNG (1).PNG

   Is it possible to solve COMPLETE MAGIC SQUARE, and How many solution in this case ?

       Best Regards.

            Loi.