[seqfan] Re: Q about magic squares as produced by Matlab

Allan Wechsler acwacw at gmail.com
Wed Oct 28 16:51:22 CET 2015


For well-definedness, it would be ideal to get Matlab's algorithm, or at
least an additional characterization of the square that it does return. As
it stands, this sequence treats Matlab's "magic" operator as a black box,
vulnerable to capricious changes in the algorithm.

On Tue, Oct 27, 2015 at 7:19 PM, Neil Sloane <njasloane at gmail.com> wrote:

> Robert, Thanks - that explains everything. I'll follow your advice and
> change the definition
>
> Best regards
> Neil
>
> Neil J. A. Sloane, President, OEIS Foundation.
> 11 South Adelaide Avenue, Highland Park, NJ 08904, USA.
> Also Visiting Scientist, Math. Dept., Rutgers University, Piscataway, NJ.
> Phone: 732 828 6098; home page: http://NeilSloane.com
> Email: njasloane at gmail.com
>
>
> On Tue, Oct 27, 2015 at 6:59 PM, <israel at math.ubc.ca> wrote:
>
> > This is a known issue with Matlab's "magic". The Matlab help file for
> > magic states:
> >
> > -----------------------------
> > M = magic(n) returns an n-by-n matrix
> > constructed from the integers 1 through n^2 with
> > equal row and column sums. The order n must be a scalar greater than
> > or equal to 3.
> >
> > ...
> >
> > Limitations
> > If you supply n less than 3, magic returns
> > either a nonmagic square, or else the degenerate magic squares 1 and [].
> > ---------------------------------
> >
> > In fact magic(2) returns the matrix
> >
> > [ 1 3 ]
> > [ 4 2 ]
> >
> > which does have determinant -10.
> >
> > I guess we could insert the value -10, changing the Name to "a(n) is the
> > determinant of the matrix returned by the Matlab
> > command magic(n)", with a comment to the effect that for n=2 this
> > is not a magic square.  Or delete the 1 (on the grounds that Matlab
> > says n must be >= 3) and make the offset 3.
> >
> > Cheers,
> > Robert
> >
> >
> > On Oct 27 2015, Neil Sloane wrote:
> >
> > Dear Seqfans, Sequence A160523 is
> >> a(n) is the determinant of the magic square of order n produced by
> Matlab.
> >> 1, -360, 0, 5070000, 0, -348052801600
> >> Offset 1 (which must be wrong)
> >> (Matlab) det(magic(n));
> >>
> >> I just received an email from someone saying:
> >>
> >> "det(magic(2)) = -10 and maybe a(2) should be added the sequence."
> >>
> >> and giving the matrix
> >> 1 3
> >>
> >> 4 2
> >>
> >> - which of course is not a magic square of order 2. There are no magic
> >> squares of order 2. But maybe Matlab thinks there are.
> >>
> >> There is clearly something wrong with A160253.
> >>
> >> Could someone who has access to Matlab kindly check it?
> >>
> >>
> >> Best regards
> >> Neil
> >>
> >> Neil J. A. Sloane, President, OEIS Foundation.
> >> 11 South Adelaide Avenue, Highland Park, NJ 08904, USA.
> >> Also Visiting Scientist, Math. Dept., Rutgers University, Piscataway,
> NJ.
> >> Phone: 732 828 6098; home page: http://NeilSloane.com
> >> Email: njasloane at gmail.com
> >>
> >> _______________________________________________
> >>
> >> Seqfan Mailing list - http://list.seqfan.eu/
> >>
> >>
> >>
> > _______________________________________________
> >
> > Seqfan Mailing list - http://list.seqfan.eu/
> >
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>



More information about the SeqFan mailing list