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.
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.
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
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.
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.
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.
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 ??
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
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...
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.
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??
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
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 ,,,,,,,,,
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.
This is a really great video. I really hope that teachers in highschools explained this well. Thank you.
This was an amazing explanation, thank you!! also the clockwise and counterclockwise visualization helps to memorize the approach to this problem
one question why is does n equal 3 ?
@@elianarthur6553 n is numeber of row and columns
thank you soo much for your help, i've been searching for someone who can explain it like you. thx
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.
Thank you for amazing explanation. Your teaching skill is very good.
Well done, sir! And many thanks. Subscribed!
Thank you for that very detailed and very precise explanation!
You have made it easier to program in computer language. Thank you for that.
I tried the algorithm and it is very well explained(it runs). and I did it 100% ... keep it up
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
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.
Explanation was really good BUT ...........my interest is to know keenly that how you deduce to reach upto this algo///////
He is following a book, Introduction to Algorithm
@@Justdailylife Hi. Author of the book?
gfg
@@guillermodarioacostacabrer2291 CLRS
4:30 how 3/2 is 1?
3/2 isn't 1.5?
division of integer
@@b-designer 👍yup..Thank you bro..
@@AjayKumar-ls8oi u'r welcm
You have explained this method in a very simple and understanding way, thank you so much Mr
thank teacher, i from VietNam. This video very useful, i love it
Wow what a clear explanation 🙏🙏👍👍👍👍👍👍 super super sir 👍👍👍👍
For a 3x3 matrix there will be 8 magic squares ,you just explained how to make one.What about the other 7 magic squares?
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.
thank you very much for such a good and detailed explanation sir.
sir please do a video on algorithm of magic square of even order(eg 4,6,8,etc).
The magic matrix only exist for odd values of n.
thanks ,but this algorithm do not working with 4×4
Yes.
I also want to know why
This is only for odd order, not an Even order
Thank you for the perfect explanation 🙏🏻
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.
Sir you are teaching simple things in hard manner
Brilliant Algorithm and explanation!
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 ??
is this algorithm works on 4x4, 5x5?
my question now is where did the formulas come from
It is not working for four dimensional matrix please suggest how to do it for 4 dimensional matrix
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
it is for only odd
Thanks a lot sir ji , I have learn lot of thing from your channel
Better presentation and eye contact makes it more interesting.
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.
yes this shit is not working.
@@buddhaeyes you could give some respect for his effort.
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...
Sir. Very very Tq for this one am not having any word to explain about my happiness tqtqqqq
Thanks for your explanation first
but this only works with odd n values, not for even values,
can you make a video on that?
Sir try it for 4x4 squares it is not working for 4x4 squares
Superb sir . U r a genius
This video was very helpful. Thank you so much.
Very well explained, thank you!
Thanks bro, well expalined.....
God bless you my friend
This was so good, thank you
how do i come with with this from basic brute force solution?
nice job bro. It helps me a lot
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.
You are a great Teacher. Thank you. Please do a video on dijkstra's algorithm.
What is the theory behind it
Beautiful explanation. Thanks for the useful information
Awesome explanation sir
I have felt this method very as a complicated one.
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)
Awesome explanation....
It will really helpful 👍
Who made these rules.
Thank you Vivekanand for the explaination. How did you conclude these formula's?
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.
Is the video of 4×4 matrix available?
If so please send.
It's not possible to create a magic square of any number except prime.
All the best👍🏻
Well done I hope you will do more good video like this thanks.
Loved the video
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.
Very instructive🤔🤔
sir tell me the code if position is occupied...plz... i hope you give the answer shortly
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??
Bro we using integer key word that can take only real numbers so 0.5 is neglated
@@yuvarajyv5772 Can take only integers
Sir please post a video on how to check a magic square
thank you for all
Nice tutorial.
But Explain how you got those steps too
Geeks for geeks but u can't understand by seeing it
great explanation!thanks
Nice explanation!!!
that was great thank you
good sir.will u please make a video on printing all subarray integers in an Array
please explain the algorithm how u make these rules
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) ?
Nicely explained
Sir please make a video on how to construct a magic cube of order 3x3x3.
Nice one. Keep making videos like this....
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
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 ,,,,,,,,,
and one more thingwhn i m matching with the available magic sq., the starting point itself is not correct
@@rahulkumargupta1718 there is no unique magick square
@@rahulkumargupta1718 and algorithm i is only for odd order matrix
very helpful.. Thank you
This method not working 4*4
HND A Class best class
this is awesome
Only works for the odd squares. Misleading Title.
Please make a video on Page Ranking Algorithm
Thank you so much
Very nice sir
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.
nice explanation
Thanks a lot.
Share 4 by 4 matrix
Excelente... muchas gracias...
Great
thanks very much sir.please explain the code for rotation of matrix.
Thanks v much
Best video
I want this code
sir please make more videos daily
This is the common method for odd squares, but it doesn't work for even squares.
Thank u sir
iska code kha hain
This will not work if N is even !!
sir can u send the answer for square matrix -4,1,6,3,-1,-5,2,-3,2 for using these numbers
Thank you
Magic square would have explained still better. And this is not the only method. There are more than ten programmable methods.
What is other method will you give please 🥺
Thanks. Jai Hind.
Tq sir