Learn how an adjacency matrix can be used to calculate adjacent cells within magic squares in this video tutorial by Charles Kelly. These are explained in the context of computer science and data science to technologists and students in preparation for ma
- [Instructor] We'll develop three Python classes…to solve our problem of generating magic squares.…These classes are an adjacency matrix,…which is used to determine the value in a cell…from the value in an adjacent cell.…A magic characteristics class,…which holds values, such as the center cell value,…the center cell coordinates, the origin coordinates,…and the polynomial base.…I'll explain all of these as we encounter them.…And a magic cube class, which is used for construction…and a dictionary of components within a magic square…or magic cube.…
This diagram illustrates the structure…of an adjacency matrix.…Given the value of a cell in a magic square,…an adjacency matrix will enable us to calculate the value…in an adjacent square.…For most algorithms that are used to create magic squares…this is a very difficult calculation.…This would seem to be a "chicken or egg" problem,…if we were going to calculate the value in a cell…based upon the value in a different cell.…
However, there're certain starter cells…within a magic square that are very easy to calculate.…
- Using Jupyter Notebook
- Creating NumPy arrays from Python structures
- Slicing arrays
- Using Boolean masking and broadcasting techniques
- Plotting in Jupyter notebooks
- Joining and splitting arrays
- Rearranging array elements
- Creating universal functions
- Finding patterns
- Building magic squares and magic cubes with NumPy and Python
Skill Level Intermediate
2. Create NumPy Arrays
3. Index, Slice, and Iterate
4. Plots: Matplotlib and Pyplot
5. Manipulate Arrays
6. Short Examples
7. Extended Examples
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.