Magic Square Construction Algorithm N × N

Поделиться
HTML-код
  • Опубликовано: 19 ноя 2024

Комментарии •

  • @mohamedatef3526
    @mohamedatef3526 3 года назад +3

    Thank you so much. This tutorial is the best. I would like to add just a little thing; The transpose of the magic square matrix follows the same properties discussed at the beginning of the video.

  • @patricepavelus4534
    @patricepavelus4534 2 года назад

    This is a really great video. I really hope that teachers in highschools explained this well. Thank you.

  • @b-designer
    @b-designer 3 года назад +3

    thank you soo much for your help, i've been searching for someone who can explain it like you. thx

    • @cesarl.c.847
      @cesarl.c.847 3 года назад

      Hello... to try other video with good explain, also can you to download Excel file to resolve Square Magic 3x3 and 5x5. To Find on RUclips as: Creación Cuadrado Mágico lado impar - Creating Magic Square odd side.

  • @giannizamora7247
    @giannizamora7247 3 года назад +5

    This was an amazing explanation, thank you!! also the clockwise and counterclockwise visualization helps to memorize the approach to this problem

  • @nhlamuloreply5342
    @nhlamuloreply5342 3 года назад +3

    You have explained this method in a very simple and understanding way, thank you so much Mr

  • @SivaKumar-sw6fb
    @SivaKumar-sw6fb Год назад

    Thank you for amazing explanation. Your teaching skill is very good.

  • @jmvarquez
    @jmvarquez 5 лет назад +2

    I tried the algorithm and it is very well explained(it runs). and I did it 100% ... keep it up

  • @amanwehib8367
    @amanwehib8367 2 года назад

    You have made it easier to program in computer language. Thank you for that.

  • @personanongrata7976
    @personanongrata7976 6 месяцев назад +1

    Well done, sir! And many thanks. Subscribed!

  • @nhanthien36
    @nhanthien36 2 года назад

    thank teacher, i from VietNam. This video very useful, i love it

  • @kiliankiel1250
    @kiliankiel1250 4 года назад +2

    Thank you for that very detailed and very precise explanation!

  • @BradenBest
    @BradenBest 6 лет назад +12

    This algorithm is incorrect as it does not fully map the domain for magic squares {x ∈ Z : x > 2} (the set of all integers greater than 2). Instead, it maps {2x + 1 : x ∈ Z : x > 0} (the set of all positive odd integers), which is _half_ of the problem domain. The title and premise of this video, on the other hand, incorrectly state that the domain is the expected {x ∈ Z : x > 2}. A good programmer does not implement only half of a solution. Imagine if Windows only did _half_ of what you need it to do. Imagine if your favorite game ended abruptly at the _halfway_ point. Imagine if your OS kernel only allocated _half_ of the resources you requested. Imagine if the write syscall only wrote _half_ of the text you put in. Imagine if your lazy employee only did _half_ of the work you assigned to them. Oh wait, you're already doing that.
    I wouldn't even be criticizing you if the title wasn't misleading.
    That said, click here to see my implementation: gist.github.com/bradenbest/af3c83230e11cf1b5aaeb05598398df6
    Not only did I fully (as of this edit) implement the problem domain (it works with any n > 2 that doesn't overflow when n^2 or n(n^2+1)/2 are applied), but I did it using a 1 dimensional array.
    That might seem crazy, but 1D arrays afford a lot of advantages over 2D arrays, especially when it comes to filling, copying and allocating space for them.
    The 4n + 2 orders were the most complicated to implement. I based my algorithm on this article: www.1728.org/magicsq3.htm

    • @BradenBest
      @BradenBest 6 лет назад +2

      Also, rules iii. and iv. are overcomplicating things. The index can be expressed as `(n + i) mod n` where i is the index.
      Where n = 3 and % represents modulo division...
      (n + -3) % n = 0 % 3 = 0
      (n + -2) % n = 1 % 3 = 1
      (n + -1) % n = 2 % 3 = 2
      (n + 0) % n = 3 % 3 = 0
      (n + 1) % n = 4 % 3 = 1
      (n + 2) % n = 5 % 3 = 2
      (n + 3) % n = 6 % 3 = 0
      As you can see, the expression correctly maps each value such that it "wraps" in both directions.

  • @ravideshmukh33
    @ravideshmukh33 3 года назад

    Sir you are teaching simple things in hard manner

  • @ck4721
    @ck4721 2 года назад

    Wow what a clear explanation 🙏🙏👍👍👍👍👍👍 super super sir 👍👍👍👍

  • @biswajeet9826
    @biswajeet9826 3 года назад

    Better presentation and eye contact makes it more interesting.

  • @surajtopal9940
    @surajtopal9940 3 года назад

    Thanks a lot sir ji , I have learn lot of thing from your channel

  • @zehrxsyed
    @zehrxsyed 4 года назад +1

    thank you very much for such a good and detailed explanation sir.

  • @____phenixx_____
    @____phenixx_____ 4 года назад

    Sir. Very very Tq for this one am not having any word to explain about my happiness tqtqqqq

  • @mrkhunt.
    @mrkhunt. 4 года назад

    Brilliant Algorithm and explanation!

  • @Ankit13555
    @Ankit13555 6 лет назад +18

    Explanation was really good BUT ...........my interest is to know keenly that how you deduce to reach upto this algo///////

  • @airineivlad6559
    @airineivlad6559 3 года назад +1

    God bless you my friend

  • @abdullahiabdislaan
    @abdullahiabdislaan 2 года назад

    Thanks bro, well expalined.....

  • @JustMarkTheScot
    @JustMarkTheScot 2 года назад

    Very well explained, thank you!

  • @sarthakkar5130
    @sarthakkar5130 6 лет назад +9

    For a 3x3 matrix there will be 8 magic squares ,you just explained how to make one.What about the other 7 magic squares?

    • @santhanam2855
      @santhanam2855 6 лет назад +2

      rotation, reverse and mirroring. The same rule is available for left-top shifts,right-bottom and left-bottom shifts as well as the top-right shifts shown in this video.

  • @adarshgupta106
    @adarshgupta106 3 года назад

    Awesome explanation sir

  • @77YuvrajSingh77
    @77YuvrajSingh77 4 года назад +9

    sir please do a video on algorithm of magic square of even order(eg 4,6,8,etc).

    • @sehajdhawan6619
      @sehajdhawan6619 3 года назад

      The magic matrix only exist for odd values of n.

  • @niliba6194
    @niliba6194 4 года назад +1

    Thank you for the perfect explanation 🙏🏻

    • @cesarl.c.847
      @cesarl.c.847 3 года назад

      Hi... to review other video, also can you to download Excel file to resolve Square Magic 3x3 and 5x5. To Find on RUclips as: Creación Cuadrado Mágico lado impar - Creating Magic Square odd side. Grettings.

  • @7736385759
    @7736385759 3 года назад

    I have felt this method very as a complicated one.

  • @whitegalactico7152
    @whitegalactico7152 4 года назад

    Superb sir . U r a genius

  • @CamilaMartinez-vm4bj
    @CamilaMartinez-vm4bj 3 года назад

    This was so good, thank you

  • @jimmywere473
    @jimmywere473 5 лет назад +1

    You are a great Teacher. Thank you. Please do a video on dijkstra's algorithm.

  • @tanjil.ahmmed
    @tanjil.ahmmed 2 года назад

    Loved the video

  • @opethfloyd9429
    @opethfloyd9429 4 года назад

    This video was very helpful. Thank you so much.

  • @ramyaj3637
    @ramyaj3637 4 года назад

    Awesome explanation....

  • @MegaCreep1234
    @MegaCreep1234 4 года назад

    nice job bro. It helps me a lot

  • @ChanchalDass
    @ChanchalDass Год назад

    Can you give some examples of 4x4 and 5x5 algi=orithm. I think there is some problem in the given algorithm for 4x4 magic square.

  • @VishnuKumar-fo2rl
    @VishnuKumar-fo2rl Год назад

    Thanks for your explanation first
    but this only works with odd n values, not for even values,
    can you make a video on that?

  • @thayaparanselladurai3731
    @thayaparanselladurai3731 6 лет назад +4

    This technic doesn't support to even number order magic squares such as 4 X 4, 6 X 6 and etc. can you post for the even number order magic squares.

    • @buddhaeyes
      @buddhaeyes 5 лет назад

      yes this shit is not working.

    • @gorgenyilmaz8711
      @gorgenyilmaz8711 4 года назад +1

      @@buddhaeyes you could give some respect for his effort.

    • @Alexander-io5pl
      @Alexander-io5pl 3 года назад

      I guess for those even-degree cases, the four adjustment cases have some recursion relationship, for example when we violate the 4th case, then i++, j-=2, then we violate 1st, or 2nd case again. Perhaps we need to recursively check the violation until we get a full valid (i, j). Just a guess...

  • @muralinagarajan8305
    @muralinagarajan8305 11 месяцев назад

    Using your formula for creating magic squares, I feel it is possible to derive the magic sum. Can you show the same ?! Another clarification i have is, what happens if the common difference between subsequent numbers is more than one ?? And, how will the formula for the magic sum be affected if the common difference is more than one ??

  • @himanshukhare9285
    @himanshukhare9285 6 лет назад +4

    It is not working for four dimensional matrix please suggest how to do it for 4 dimensional matrix

    • @BradenBest
      @BradenBest 6 лет назад

      surely you mean "magic square of order 4", not "4-dimensional matrix", which means something completely different.
      en.wikipedia.org/wiki/File:Double-even_magic_construction.png
      www.math.wichita.edu/~richardson/mathematics/magic%20squares/even-ordermagicsquares.html

    • @areebahmadsiddiqui2648
      @areebahmadsiddiqui2648 5 лет назад

      it is for only odd

  • @narayananseshagirirao2569
    @narayananseshagirirao2569 5 лет назад

    Beautiful explanation. Thanks for the useful information

  • @Atrainn234
    @Atrainn234 2 месяца назад

    my question now is where did the formulas come from

  • @ChanchalDass
    @ChanchalDass Год назад

    0 1 2 3
    0 8 3 9 14 34
    1 2 12 13 7 34
    2 11 16 6 1 34
    3 15 5 4 10 34
    58 36 36 32 32 36
    With the given rule, I have created this magic square. But all sum is not same. Kindly correct me if I am wrong.

  • @VeraDongmo-ql1lu
    @VeraDongmo-ql1lu 6 месяцев назад

    Very instructive🤔🤔

  • @__DYNAX_Tech__
    @__DYNAX_Tech__ 4 года назад

    It will really helpful 👍

  • @SandhyaSingh-zb9sk
    @SandhyaSingh-zb9sk 3 года назад

    Nicely explained

  • @pratyakshsaini2870
    @pratyakshsaini2870 3 года назад

    how do i come with with this from basic brute force solution?

  • @sarahhakeam9896
    @sarahhakeam9896 Год назад

    that was great thank you

  • @radhakrishna4364
    @radhakrishna4364 Год назад +1

    Sir try it for 4x4 squares it is not working for 4x4 squares

  • @natesh1
    @natesh1 6 лет назад +1

    Nice one. Keep making videos like this....

  • @monikaparmar2061
    @monikaparmar2061 4 года назад +1

    Only works for the odd squares. Misleading Title.

  • @sayantanray9595
    @sayantanray9595 4 года назад

    Nice explanation!!!

  • @falconhomefalconhome3784
    @falconhomefalconhome3784 5 лет назад

    Well done I hope you will do more good video like this thanks.

  • @aminhadidchi2817
    @aminhadidchi2817 5 лет назад +4

    thanks ,but this algorithm do not working with 4×4

  • @reelsofharshitha3742
    @reelsofharshitha3742 3 года назад +1

    is this algorithm works on 4x4, 5x5?

  • @ishitaarora439
    @ishitaarora439 4 года назад

    great explanation!thanks

  • @rocketmik65
    @rocketmik65 2 года назад +1

    HND A Class best class

  • @engrsyedadilsardar6047
    @engrsyedadilsardar6047 5 лет назад

    It is for finding the sum of 15 from all sides will u please tell me that how to make a magic square to get the sum of 45 or 47.

  • @parulmogre2200
    @parulmogre2200 4 года назад

    very helpful.. Thank you

  • @adnanalkarfan2277
    @adnanalkarfan2277 3 года назад

    If im using bfs or dfs can i consider every move a relative(the moves in this video) like (i,j) to (i-1)(j+1)

  • @_inspireverse___
    @_inspireverse___ 4 года назад

    Very nice sir

  • @prathameshchavan2812
    @prathameshchavan2812 5 лет назад

    Ok, so I have to pick upper right cell to write next number and if that cell is occupied then pick left cell instead to write next number. Nice.

  • @rhytham5427
    @rhytham5427 5 лет назад +1

    Sir please post a video on how to check a magic square

  • @shivamtyagi3554
    @shivamtyagi3554 4 года назад

    sir tell me the code if position is occupied...plz... i hope you give the answer shortly

  • @saruncse85
    @saruncse85 4 года назад

    Thank you Vivekanand for the explaination. How did you conclude these formula's?

  • @esseandessence4421
    @esseandessence4421 4 года назад

    What is the theory behind it

  • @abhishekdeepu2003
    @abhishekdeepu2003 4 года назад

    Sir please make a video on how to construct a magic cube of order 3x3x3.

  • @nsfuntus3698
    @nsfuntus3698 3 года назад

    this is awesome

  • @mostafashams5280
    @mostafashams5280 3 года назад

    Thank you so much

  • @mordiabukarat3985
    @mordiabukarat3985 6 лет назад +1

    thank you sir.your teaching skills are amazing.can you please upload video of converting binary tree to sum tree only if values are greater for the relevant node ? recursivley ? it is very confuse . thank you

  • @sajidpattakkal1338
    @sajidpattakkal1338 4 года назад

    Is the video of 4×4 matrix available?
    If so please send.

    • @vikashkumargupta4876
      @vikashkumargupta4876 3 года назад

      It's not possible to create a magic square of any number except prime.
      All the best👍🏻

  • @dhanalakshmisenthilkumar7991
    @dhanalakshmisenthilkumar7991 5 лет назад

    nice explanation

  • @selvamani9937
    @selvamani9937 5 лет назад +1

    This method not working 4*4

  • @amouzoukevo2054
    @amouzoukevo2054 3 года назад

    thank you for all

  • @koketjosethobja1960
    @koketjosethobja1960 3 года назад

    Thanks a lot.

  • @hunterofendermen367
    @hunterofendermen367 2 года назад

    So I'm curious how does "3 by 2 equal 1" 3 minus 2 is 1 but he has a division symbol and 3 divided by 2 is 1.5, not 1. Can someone help me understand this??

    • @yuvarajyv5772
      @yuvarajyv5772 2 года назад

      Bro we using integer key word that can take only real numbers so 0.5 is neglated

    • @ChanchalDass
      @ChanchalDass Год назад

      @@yuvarajyv5772 Can take only integers

  • @hemanthkommaraju1888
    @hemanthkommaraju1888 6 лет назад

    good sir.will u please make a video on printing all subarray integers in an Array

  • @adityapaithon6499
    @adityapaithon6499 6 лет назад +1

    Nice tutorial.
    But Explain how you got those steps too

    • @Abhishekvlogs-1.0
      @Abhishekvlogs-1.0 5 лет назад

      Geeks for geeks but u can't understand by seeing it

  • @gameelevator1579
    @gameelevator1579 4 года назад

    Best video

  • @AjayKumar-ls8oi
    @AjayKumar-ls8oi 3 года назад +1

    4:30 how 3/2 is 1?
    3/2 isn't 1.5?

    • @b-designer
      @b-designer 3 года назад +1

      division of integer

    • @AjayKumar-ls8oi
      @AjayKumar-ls8oi 3 года назад

      @@b-designer 👍yup..Thank you bro..

    • @b-designer
      @b-designer 3 года назад +1

      @@AjayKumar-ls8oi u'r welcm

  • @tanmaydeo4487
    @tanmaydeo4487 4 года назад

    Please make a video on Page Ranking Algorithm

  • @jorawarsanghi1266
    @jorawarsanghi1266 2 года назад

    Who made these rules.

  • @abdourashad7555
    @abdourashad7555 3 года назад

    Thanks v much

  • @JaiChavan
    @JaiChavan 3 года назад

    Thanks. Jai Hind.

  • @saisrikar7987
    @saisrikar7987 6 лет назад

    sir please make more videos daily

  • @yaswanthvysyaraju5319
    @yaswanthvysyaraju5319 6 лет назад

    please explain the algorithm how u make these rules

    • @vitsils6621
      @vitsils6621 6 лет назад

      if we have a square 5x5 what is the position for 7 ? I've got (0;0) However 2 already has (0;0) That means 7 has (1;-2) ?

  • @komalashar6131
    @komalashar6131 5 лет назад +1

    Share 4 by 4 matrix

  • @scanadith
    @scanadith 3 года назад

    Great

  • @menelik1020
    @menelik1020 5 лет назад

    Excelente... muchas gracias...

  • @srinidhiii
    @srinidhiii 6 лет назад

    thanks very much sir.please explain the code for rotation of matrix.

  • @rahulkumargupta1718
    @rahulkumargupta1718 5 лет назад

    sir, undoubtedly, algorithm explained by you is appreciabble. i am facing problem while costructiong a magic sq. of order 4........
    as entry is becoming (2,-2).......what to do at this point ,,,,,,,,,

    • @rahulkumargupta1718
      @rahulkumargupta1718 5 лет назад

      and one more thingwhn i m matching with the available magic sq., the starting point itself is not correct

    • @ShivaShiva-gj1ib
      @ShivaShiva-gj1ib 4 года назад

      @@rahulkumargupta1718 there is no unique magick square

    • @ShivaShiva-gj1ib
      @ShivaShiva-gj1ib 4 года назад

      @@rahulkumargupta1718 and algorithm i is only for odd order matrix

  • @FrozenByTheSun
    @FrozenByTheSun 6 лет назад

    Thank you

  • @nitishghosh646
    @nitishghosh646 4 года назад

    Thank u sir

  • @jonchakoyu
    @jonchakoyu 5 лет назад +1

    Magic square would have explained still better. And this is not the only method. There are more than ten programmable methods.

    • @yuvarajyv5772
      @yuvarajyv5772 2 года назад

      What is other method will you give please 🥺

  • @johnclawed
    @johnclawed 5 лет назад +1

    This is the common method for odd squares, but it doesn't work for even squares.

  • @gunachanduappari8983
    @gunachanduappari8983 5 лет назад

    I want this code

  • @jobbinejoseph8398
    @jobbinejoseph8398 4 года назад

    This will not work if N is even !!

  • @dhanalakshmisenthilkumar7991
    @dhanalakshmisenthilkumar7991 5 лет назад

    sir can u send the answer for square matrix -4,1,6,3,-1,-5,2,-3,2 for using these numbers

  • @sarathatchukola4669
    @sarathatchukola4669 4 года назад

    Tq sir

  • @jagnandansingh4881
    @jagnandansingh4881 3 года назад

    22 ans. आना चाहिए बताओ plz.