Pages

Tuesday, 31 March 2009

Sebuah Cerita

Rabu yang lalu, tanggal 25 Maret 2009 terjadilah sebuah kejadian yang tak disangka untuk terjadi yang menjadikan aku sedikit jadi koreksi diri. Waah wagu banget kalimatku yaaa begitu deh donk jadinya bikin seru kantor di hari Rabu yang sepi, kelabu dan lesu karena besok Kamisnya libur dan tentu saja Jumatnya jadi harpitnas yang banyak dimanfaatkan orang untuk berlibur panjang, sekedar istirahat, ngaso panjang or pulkam.

Jadi begini nih teman kejadiannya, di saat diriku ribet dengan berbagai berkas dan file, dan tak menghiraukan keadaan sekitar, yaa ceritanya sok sibuk gitu, dan finally final dengan semuanya itu, ku palingkan mukaku ke hal yg membuat rilex, yaitu online hehe biasa. Lagi asik2 brows dan mysoju-an, ternyata ada rquest di FB dr temen sekolah. Wah ternyata ga nyangka banget bisa ketemuan di situs ajaib ini, ga lama eykeh confirm deh, ga lama juga kita ngobs. Lumayan seru dan ga penting siih obrolan kita, dan kita tuker no hp. Nah begitu temen eykeh sms, dan aku mo ngecek hp, eng ing eng … hp was not there, padahal aku yakin bgt it was on my desk. Waaah belum bingung tuh waktu itu, biasa aja, paling dibawa suami nih pikirku, lha wong dia tadi barusan dari ruangan ini. Dah gitu si temenku yg di FB ini bilang kok hp ku ga ada respon, jangan-jangan … Ga pikir lama aku samperin aja suami di ruangannya, tanya about si hp, ternyata ga dibawa sama misoa. Balik ke ruanganku, cari sana sini, dibantu staff ga ada juga, di MC2 ga ada suara, padahal kan dering banget tuh hpku “belahan jiwaku”nya Yovie n the Nuno. Akhirnya aku panggil lagi suamiku, mi mi suami sini deh hehe … eeh yang lain nya ikutan, lha wong it was just that words kok yang lain jadi pada ikutan nimbrung dan bingung rame2, pada MC2 juga. Waah bukan guwe banget bikin rame orang rebut berdatangan. “Husy husy pergi pergi jangan pd nimbrung disini” kataku, waah ga sopan bgt diriku padahal ada org2 senior dan atasan disitu, habis saking ga enaknya bikin bingung orang2. Waaah istighfar deh aku, Astaghfirullahal adzim, dan kupersilakan orang2 untuk kembali ke ruangannya. Well kutenangkan diriku dan kuingat2 apa saja yg kulakukan hari ini. Kurekonstruksi sedikit demi sedikit sambil komat kamit alfatihah, al insyiroh … buka laci2 meja, file2 di lemari, ku ulangi lagi. Ada juga temen yang bilang kalo lagi ada yg jail, ada yg bilang jatuh mungkin, tp dihub alhamdulillah masih bisa, pada MC2 gitu. Then aku buka lagi lemari file2 pegawai, ku ambil file2 yang tadi ku buka, akhirnya … ternyata kecepit di salah satu binder file pegawai. Ooo Ya Allah

OMG Alhamdulillah, ternyata masih rejekiku. Jadinya happy ending deh, tp embarrasing hehehe.. kupikir lagi padahal tadi kayanya udah dicari disitu deh …

Hikmah dari semua itu :

Jangan teledor huhuhu

Be focus Buuuu

Pokoke koreksi diri, aku tahu Allah masih sayang padaku.

Kurang istighfar juga sih slama ini, padhl min. kan 70/day.

Ya gitu deh donk, malu siih, tapi alhamdulillah, segala puji hanya milik Allah ^_^

Sragen.. Panassss...

HUH??!! Panasnya Sragentina memang tidak sepanas Wonosari..
Tapi panasnya Sragn cukup membuat keringat bercucuran bak orang mandi..

Awalnya bingung masu tinggal dimana tapi ketika melalui hari demi hari sampai saat ini sudah seminggu lebih stand by di Sragen ternyata aksyik juga..

Sempat ga betah dengan suasana di Sragen yang jauh dr Jogja.. api apa mau dikata, sudah menjadi tugas dan tanggung jawab akhirnya dilaksanakan dengan penuh ikhlas dan sabar..

Bener apa kata wa1, Sragen kotanya teduh banyak pohon tapi kalau siang panas kayak ikan bakar gitu. Tapi sepanas-panasnya Sragen lebih panas Wonosari, kipas ajaibnya tyo pingin kubawa ke Sragen nich kalau gini caranya,, (mumpung tyo masuk Grhasia.. ga tau ngapain disana..wakakak)

Sragen oh Sragen..
Baru sebulan disini udah ga betah, kalau di wonosari masih bisa balik jogja tapi disini ga bisa!!
Dua jam lebih perjalanan sragen-jogja cukup memakan waktu apalagi lewat solo yang banyak jalan ga jelas tau-tau muncul dimana gitu!!??

tapi untunglah ga pernah kesasar, sekali kesasar malah ditilang polisi!!?? SIAL..??!!

Baru sebulan, gimana ntar sampe 8 bulan lamanya disini.. hiks sedih..??!!

Apapaun yang terjadi pokoke harus semangat...semangat...SE MA NGAT??!!

Fakta Hedonisme di balik April Mop

April mop atau April Fool Day's adalah salah satu bagian budaya barat yang sampai saat ini masih menjadi tradisi yang tak pernah usang dikalangan remaja muda. Tradisi April Mop dimana disaat itu boleh dilakukan pembohongan atau penipuan terhadap teman-teman dianggap hal yang menarik dan lucu. Kesan yang muncul terhadap April Mop menimbulkan kegelamoran bahkan lebih ekstrim lagi dikatakan jika tidak merayakan April Mop terkesan ga gaul atau ketinggalan zaman.

Penjungkar balikan fakta April Mop meruntuhkan hegemoni aqidah calon-calon intelektual bangsa. Tersayat oleh budaya dan tradisi sosial yang mengalami distorsi menyebabkan racun sistemik yang kronis dan sukar untuk diobati. April mop yang sudah menjadi tradisi ini semakin menarik remaja ke dalam jurang antisosial yang terjal.

Sejarah mencatat, April Mop merupakan penipuan dan pembantaian masal umat muslim yang dilakukan oleh kaum Salib. Adalah Tariq bin Ziyad, salah seorang revolusioner, mujaddid yang dengan perjuangan atas asma Allah mampu menaklukan wilayah Spanyol dan sekitarnya. Spanyol yang sebelum masa penaklukan oleh Tariq bin Ziyad adalah daerah dengan penuh dengan kegelapan dengan hadirnya perubahan radikal menjadikan negara muslim selama 6 abad lamanya. Kesantunan dan kesalehan yang dilakukan oleh raja-raja Islam disana menyebabkan semakin bertambahnya rakyat yang masuk Islam. Suasana dipenuhi dengan lantunan Al Quran dan merdunya suara-suara adzan semakin menambah semarak ketenangan dan keteduhan ISlam di cordoba.

Tahun berganti tahun, kaum salib ingin mendaptkan kembali daerah yang sempat menjadi landscape kaum salib. Dengan berbagai cara dan selalu gagal akhirnya kaum salib mencari akal dengan cara memasukkan penyusup ke Spanyol. Begitu mengetahui kelemahan kaum muslim dengan cara memasukkan alkohol dan mempengaruhi kaum mudanya dengan kesenangan dan kemewahan. Dengan cara lain yaitu dengan memasukkan seorang ulama palsu untuk mendoktrin dengan berbagai tuduhan dan susupan yang menggoyahkan aqidah.

Hingga sampai pada saatnya, ketika Islam lemah. Kaum salib masuk dan membunuh serta membantai kaum muslim yang terjadi pada tgl 1 April 1498. Muslim yang masuk kerumah kemudian dibujuk untuk keluar rumah dengan menyediakan kapal untuk kaum muslim meninggalkan Spanyol hari itu juga, jika tidak tidak akan diberikan bantuan. Kaum muslim sempat tidak percaya dengan bantuan tersebut. Namun akhirnya luluh juga sehingga pada akhirnya mereka takluk dengan men gikuti perintah penguasa salib saat itu. Ketika akan memasuki kapal, muslimin kemudian dihunuskan pedang ke leher dan badan mereka dibunuh dan dibantai, kapal kemudian dibakar sampai laut saat itu berwarna merah darah. Rumah-rumah tempat mereka tinggal dibakar begitu juga orang yang ada didalamnya.

Peritiwa kemenangan kaum salib atas muslim tgl 1 April tersebut dirayakan sebagai April Mop.

Fakta hedonisme dibalik April Fool Days merupakan ajaran iblis yang sedikit demi sedikit mengikis dan menghanguskan aqidah Islam. Pemutar balikan fakta yang menyebabkan manusia khususnya remaja terlena dengan dunia yang sementara.

Semoga kita dilindungi dari godaan syetan yang terkutuk!!??..


Tuesday, 24 March 2009

The Beauty of Mathematics and the Love of God

Here is an interesting and lovely way to look at the beauty of mathematics, and of God, the sum of all wonders.


1 x 8 + 1 = 9
12 x 8 + 2 = 98
123 x 8 + 3 = 987
1234 x 8 + 4 = 9876
12345 x 8 + 5 = 987
65
123456 x 8 + 6 = 987654
1234567 x 8 + 7 = 9876543
12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321


1 x 9 + 2 = 11
12 x 9 + 3 = 111
123 x 9 + 4 = 1111
1234 x 9 + 5 = 11111
12345 x 9 + 6 = 111111
123456 x 9 + 7 = 1111111
1234567 x 9 + 8 = 11111111
12345678 x 9 + 9 = 111111111
123456789 x 9 +10= 1111111111


9 x 9 + 7 = 88
98 x 9 + 6 = 888
987 x 9 + 5 = 8888
9876 x 9 + 4 = 88888
98765 x 9 + 3 = 888888
987654 x 9 + 2 = 8888888
9876543 x 9 + 1 = 88888888
98765432 x 9 + 0 = 888888888

Brilliant, isn’t it?


And look at this symmetry:

1 x 1 = 1
11 x 11 = 121
111 x 111 = 12321
1111 x 1111 = 1234321
11111 x 11111 = 123454321
111111 x 111111 = 12345654321
1111111 x 1111111 = 1234567654321
11111111 x 11111111 = 123456787654321
111111111 x 111111111 = 12345678987654321

Now, take a look at this…

101%

From a strictly mathematical viewpoint:

What Equals 100%?

What does it mean to give MORE than 100%?

Ever wonder about those people who say they are giving more than 100%?

We have all been in situations where someone wants you to

GIVE OVER 100%.

How about ACHIEVING 101%?

What equals 100% in life?

Here’s a little mathematical formula that might help

Answer these questions:

If:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Is represented as:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26.

If:

H-A-R-D-W-O-R- K

8+1+18+4+23+15+18+11 = 98%

And:

K-N-O-W-L-E-D-G-E

11+14+15+23+12+5+4+7+5 = 96%

But:

A-T-T-I-T-U-D-E

1+20+20+9+20+21+4+5 = 100%

THEN, look how far the love of God will take you:

L-O-V-E-O-F-G-O-D

12+15+22+5+15+6+7+15+4 = 101%

Therefore, one can conclude with mathematical certainty that:

While Hard Work and Knowledge will get you close, and Attitude will
Get you there, It’s the Love of God that will put you over the top!

- http://darvish.wordpress.com -

N e s t e d M a g i c S q u a r e s
Algorithm by: Samavedula Sita Rama Sastry



Nested Magic Squares are magic squares with the special property that each sub-magic square within the original square is also magical, i.e the rows, columns, and diagonals add up to the same number (although to a number different than the original sum,... obviously)

For example, in the 8 x 8 magic square:

14    56    55    54    53     7     8    13
1     24    16    45    44    43    23    64
63    15    40    26    27    37    50     2
62    48    29    35    34    32    17     3
4     47    33    31    30    36    18    61
5     19    28    38    39    25    46    60
59    42    49    20    21    22    41     6
52     9    10    11    12    58    57    51


the inner 6 x 6 square

24    16    45    44    43    23
15    40    26    27    37    50
48    29    35    34    32    17
47    33    31    30    36    18
19    28    38    39    25    46
42    49    20    21    22    41


is also magical and the magic sum is 195. This nested nature persists all the way to the inner 4 x 4 square.

The page describes an algorithm to generate "nested magic squares" of even and odd sided dimensions. The algorithm was developed by Sri. S. S. R. Sastry. Although the algorithm for generating odd sided magic squares is much simpler, it was the algorithm for even sided magic squares which was developed first. For even sided magic squares, the methodology differs slightly for "double even sided magic squares" (i.e when dimension is divisible by 4) and "single even sided magic squares" (i.e when dimension is divisible by 2 but not by 4).

Tomas Ullrich jr. (tom_ullrich AT hotmail DOT com) has an excellent implementation of this algorithm on in Excel. Download the Excel file or the zipped version of the same.

Matlab files which implement the algorithm are also given.

A few other Matlab files are provided here as general utilitles:

  • ismagic.m: For checking whether a general n x n matrix is a simple magic square (nested-ness and other special properties are not checked). If its not a magic square, returns why not.
·         » help ismagic
·          
·            function [ismag, whynot] = ismagic(square)
·            square: square to be checked for "magicness"
·            ismag: 1 if magical, 0 if not
·            whynot: if ismag == 0, then
·              whynot returns the reason why ismagic fails
·              whynot = 1 : not all elements from 1 to n^2 uniquely used.
·                     = 2 : not all rows and columns add up to the same number
  • writemag.m For writing a general n x n matlab matrix as a ASCII file. Useful because the standard save function writes things as double precision digits instead of integers. I'm pretty sure I could have set some options, but small enough function...
·         » help writemag
·          
·              function writemag(magicsquare, fname)
  • tablemag.m For generating html tables of magic squares. It also paints each nested square differently to illustrate the nested nature of the square. For example, a 7 x 7 square is rendered as:

10

48

46

45

6

8

12

1

18

36

35

16

20

49

3

13

28

21

26

37

47

43

33

23

25

27

17

7

41

31

24

29

22

19

9

39

30

14

15

34

32

11

38

2

4

5

44

42

40

  • Note however that the html code for the tables tends to be bloated. For example, the 7 x 7 square above takes 64 lines of html to render.
·         » help tablemag
·          
·             function tablemag(magicsquare, fname)
  • colorstring.m This file is used by tablemag.m and should be placed in the same directory. This function takes a matlab colormap entry of the form [r g b] where 0 <= r,g,b <= 1 and returns a string which can be used as a colorname string for html documentation.
·         » help colorstring
·          
·             function colstr = colorstring(colarray)
·             takes a matlab colormap entry of the form colarray = [r g b], 
·             where 0 <= r,g,b <= 1 and returns a string which can be used 
·             as a colorvalue attribute in html.
·             For example,
·                 colorstring([0.2, 0.9, 0.6]) = '33e699'

Algorithm for even sided magic squares

Consider the construction of a magic square of dimension n x n where n is divisible by 2. We differentiate between 2 cases. When n is divisble by 4, i.e double even square and when n is not divisible by 4 i.e, single even square. The construction differs only slightly between these 2 cases. In both cases, the middle (n-2) x (n-2) square is filled with (n-2)^2 numbers from the middle of {1,...,n^2}. The periphery of the n x n square is filled with the first 2n-2 and last 2n-2 numbers from {1,...,n^2}. Here we describe how the first 2n-2 numbers i.e, from {1,..., 2n-2} are filled. The last 2n-2 numbers are filled opposing these so that the sum of opposing numbers is 1+n^2.

  1. The periphery consists of the following numbers:
    • Sp := {1, ..., 2 n - 2 }
    • Lp := {n^2 - 2 n + 3, ..., n^2}
  2. In the following steps, we describe how to fill the numbers in Sp into the matrix. The numbers in Lp automatically follow in such a way that opposing numbers sum up to n^2 + 1.
  3. Place 1 just below the top left corner
  4. If n is a single even number i.e, not divisible by 4, then place 2 just to the right of the top left corner.
  5. Fill in the next n-3 numbers in a sort of zig-zag pattern as shown in Figures 1 and 2.
0   0   0   0   0   0   0   0
1   0   0   0   0   0   0   0
0   0   0   0   0   0   0   2
0   0   0   0   0   0   0   3
4   0   0   0   0   0   0   0
5   0   0   0   0   0   0   0
0   0   0   0   0   0   0   6
0   0   0   0   0   0   0   0

Fig. 1: Filling in numbers from 2 to n-2 when
n is divisible by 2. (Here, n = 8)

0   2   0   0   0   0   0   0   0   0
1   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   3
0   0   0   0   0   0   0   0   0   4
5   0   0   0   0   0   0   0   0   0
6   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   7
0   0   0   0   0   0   0   0   0   8
9   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0

Fig. 2: Filling in numbers from 3 to n-1 when
n is not divisible by 4. (Here, n = 10)

  1. Fill in the first and last cells of the first row with the last 2 numbers from Sp. At this stage, we will have:
13  0   0   0   0   0   0  14
1   0   0   0   0   0   0   0
0   0   0   0   0   0   0   2
0   0   0   0   0   0   0   3
4   0   0   0   0   0   0   0
5   0   0   0   0   0   0   0
0   0   0   0   0   0   0   6
0   0   0   0   0   0   0   0

n = 8

17  2   0   0   0   0   0   0   0  18
1   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   3
0   0   0   0   0   0   0   0   0   4
5   0   0   0   0   0   0   0   0   0
6   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   7
0   0   0   0   0   0   0   0   0   8
9   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0

n = 10

  1. We are now left with some of the numbers from Sp. These have to be filled into the top and bottom rows of the square such that the following conditions are satisfied:
    • An equal number of elements of Sp appear in the top and bottom row. This includes the 2 numbers filled in the top row in the last step, and may also include 2 in the case when n is not divisible by 4.
    • The sum of the numbers in the top and bottom row are equal.

This is accomplished using the matlab function distribute as follows:

    1. We first calculate how many numbers need to be filled in the bottom row. Call this nlow
    2. Calculate how many numbers are remaining from amongst Sp. Call these remain
    3. Calculate the number to which the bottom row should add up at this stage. Call this reqdlowsum
    4. Start with the largest nlow numbers from amongst remain. Call these numbers selected
    5. If sum(selected) > reqdlowsum, move the smallest number of selected to the left till the numbers do add up to reqdlowsum.
    6. If the sum cannot be attained by moving the smallest number amongst selected to the very left, move the next smallest number to the left and so on. Keep repeating till the sum is attained.

Once this distribution is done, we will have used up all the "smaller numbers". For the case, n = 8, we will get the following:

14  0   0   0   0   7   8  13
1   0   0   0   0   0   0   0
0   0   0   0   0   0   0   2
0   0   0   0   0   0   0   3
4   0   0   0   0   0   0   0
5   0   0   0   0   0   0   0
0   0   0   0   0   0   0   6
0   9  10  11  12   0   0   0
  1. The numbers from Lp are then filled in so that the sum of "opposing" numbers is equal to 1 + n2). This will give:
9.  14  56  55  54  53   7   8  13
10.1    0   0   0   0   0   0  64
11.63   0   0   0   0   0   0   2
12.62   0   0   0   0   0   0   3
13.4    0   0   0   0   0   0  61
14.5    0   0   0   0   0   0  60
15.59   0   0   0   0   0   0   6
16.52   9  10  11  12  58  57  51
  1. The algorithm then used recursively to fill in the n-2 x n-2 block of numbers in the middle. In Matlab speak:
18.>> lastsmall = 2*n-2;
19.>> magicsquare(2:n-1, 2:n-1) = evenmagic(n-2) + lastsmall;

Implementation

The following matlab functions implement the algorithm described above:

If you use the matlab files above, please retain the help comments acknowledging the source of the algorithm. I'd also greatly appreciate it if you dropped me a line at srinath_a@usa.net.

Results

The following text files contain some magic squares in plain ascii format. They were tested using the following matlab function ismagic.m

Algorithm for odd sided magic squares

The algorithm for generating odd sided magic squares is much simpler than the one for the even sided magic squares and will directly be explained using 2 examples without any equations. As with the even sided magic squares, because of the nested nature of the square, we only describe the method to fill the periphery. The inner square is filled with a recursize call to the same function. Consider filling a square of dimensions n x n (when n is not divisible by 2)

  1. The periphery consists of the following numbers:
    • Sp := {1, ..., 2 n - 2 }
    • Lp := {n^2 - 2 n + 3, ..., n^2}
  2. In the following steps, we describe how to fill the numbers in Sp into the matrix. The numbers in Lp automatically follow in such a way that opposing numbers sum up to n^2 + 1.
  3. First we fill in all the odd numbers in Sp in the following manner:
    • For n = 9
o    0   0   0   0   0   0   0   0   0
o    1   0   0   0   0   0   0   0   0
o    3   0   0   0   0   0   0   0   0
o    5   0   0   0   0   0   0   0   0
o    0   0   0   0   0   0   0   0   9
o    0   0   0   0   0   0   0   0  11
o    0   0   0   0   0   0   0   0  13
o    0   0   0   0   0   0   0   0  15
o    0   0   0   0   7   0   0   0   0

Here, the odd numbers in Sp are {1,3,...,15}. The middle odd number, 7, is placed at the center of the bottom row. The oddnumbers from {1,...,5} are placed in the first clumn starting from the 2nd row, while the odd numbers after the middle odd number, i.e from {9,11,...,15} are placed in the last column as shown.

    • For n = 7, we will have
o    0   0   0   0   0   0   0
o    1   0   0   0   0   0   0
o    3   0   0   0   0   0   0
o    0   0   0   0   0   0   7
o    0   0   0   0   0   0   9
o    0   0   0   0   0   0  11
o    0   0   0   5   0   0   0

Notice that the manner of placing the odd numbers doesnt change from n = 7 to n = 9.

  1. The even numbers are then placed in the first and last row as follows:
    • The last 2 even numbers in Sp are placed in the first and last cells of the first row as shown (the numbers filled in this step are shown in red):
o    14  0   0   0   0   0   0   0  16       10  0   0   0   0   0  12    
o    1   0   0   0   0   0   0   0   0       1   0   0   0   0   0   0
o    3   0   0   0   0   0   0   0   0       3   0   0   0   0   0   0
o    5   0   0   0   0   0   0   0   0       0   0   0   0   0   0   7
o    0   0   0   0   0   0   0   0   9       0   0   0   0   0   0   9
o    0   0   0   0   0   0   0   0  11       0   0   0   0   0   0  11
o    0   0   0   0   0   0   0   0  13       0   0   0   5   0   0   0
o    0   0   0   0   0   0   0   0  15              (n = 7)
o    0   0   0   0   7   0   0   0   0
o     
o                 (n = 9)
    • The remaining even numbers are filled in as shown: (for n = 9)
o    14  0   0   0   0   8  10  12  16 
o    1   0   0   0   0   0   0   0   0
o    3   0   0   0   0   0   0   0   0
o    5   0   0   0   0   0   0   0   0
o    0   0   0   0   0   0   0   0   9 
o    0   0   0   0   0   0   0   0  11 
o    0   0   0   0   0   0   0   0  13 
o    0   0   0   0   0   0   0   0  15 
o    0   2   4   6   7   0   0   0   0

i.e, the first half of the remaining even numbers go in the bottom row while the rest go in the top row as shown above. In exactly the same manner, the remaining even numbers for n = 7

10  0   0   0   6   8  12 
1   0   0   0   0   0   0
3   0   0   0   0   0   0
0   0   0   0   0   0   7 
0   0   0   0   0   0   9 
0   0   0   0   0   0  11 
0   2   4   5   0   0   0
  1. At this stage, we have filled in all the numbers in Sp. The remaining peripheral numbers are filled in so that opposing numbers give a total of 1 + n^2.
    For
    n = 9, we will have:
6.  14  80  78  76  75   8  10  12  16 
7.  1    0   0   0   0   0   0   0  81 
8.  3    0   0   0   0   0   0   0  79 
9.  5    0   0   0   0   0   0   0  77 
10.73   0   0   0   0   0   0   0   9 
11.71   0   0   0   0   0   0   0  11 
12.69   0   0   0   0   0   0   0  13 
13.67   0   0   0   0   0   0   0  15 
14.66   2   4   6   7  74  72  70  68 
  1. The inner square of dimension n-2 x n-2 is filled in with a recursive call to the algorithm. In matlab speak,
16.>> lastsmall = 2*n - 2;
17.>> magicsquare(2:n-1, 2:n-1) = oddmagic(n-2) + lastsmall;

The following matlab function implements the algorithm described above:

If you use the matlab files above, please retain the help comments acknowledging the source of the algorithm. I'd also greatly appreciate it if you dropped me a line at srinath_a@usa.net.

Results

The following text files contain some magic squares in plain ascii format.

Di salin ulang dari sebuah situs