![]() |
Exploring Matrices - Cleve Moler on Mathematics and Computing
I have spent much of my career attempting to bring abstract linear algebra and practical matrix computation closer together. This project is my latest effort.
[IMG]https://blogs.mathworks.com/cleve/files/color_qubes.gif[/IMG] [B]Contents[/B] [LIST][*][URL="https://www.labfans.com/bbs/#862d3707-08ab-4f98-b6b5-8519a1ca5714"]Linear Algebra[/URL][*][URL="https://www.labfans.com/bbs/#2bb5a235-2606-4fc4-8fb9-895fa4ecd0f6"]Exploring Matrices[/URL][*][URL="https://www.labfans.com/bbs/#8f6c5ed9-84f0-4d7a-8623-647cd51ec32a"]YouTube Videos[/URL][*][URL="https://www.labfans.com/bbs/#04a16066-74ef-4bc0-9f76-6adf08169b5f"]Matrix Multiplication[/URL][*][URL="https://www.labfans.com/bbs/#61cd6c37-950d-45d3-b242-2473583e2d32"]Rotation and Scaling[/URL][*][URL="https://www.labfans.com/bbs/#6755ad13-6fad-4809-b913-482cefe2bdd4"]Computer Graphics[/URL][*][URL="https://www.labfans.com/bbs/#c9c5db07-30d0-4ec9-a247-1aa22ebe674a"]Matrices and Cubes[/URL][*][URL="https://www.labfans.com/bbs/#f876c336-f973-470c-820f-e9cce53937dd"]Simulink[/URL][*][URL="https://www.labfans.com/bbs/#494d0331-abe4-48b1-870f-0802b7faefd0"]AI and Gorillas[/URL][*][URL="https://www.labfans.com/bbs/#55574243-bb0a-4df9-87b9-24c054cb4e5d"]Software[/URL][*][URL="https://www.labfans.com/bbs/#14e0a7e1-65fa-47d4-86d3-d25dcaeb381a"]Thanks[/URL][*][URL="https://www.labfans.com/bbs/#2fd3bd2b-0327-4b06-aa93-8efdaa9b34c5"]Dedication[/URL][/LIST][B]Linear Algebra[/B] Over fifty years ago, as a sophomore contemplating a major in mathematics, I took a course entitled Survey of Modern Algebra. We used a now-classic textbook by MacLane and Birkhoff that featured abstract theorems about groups, rings, fields, vector spaces and linear algebra. I remember that the colorful terms [I]alias[/I] and [I]alibi[/I] had something to do with change of basis and change of position, but I have never seen those terms again. The next year, I took Numerical Analysis. We did some of the homework on a Burroughhs 205 Datatron and I wrote a machine language program to solve simultaneous linear equations. I was hooked. I did not realize at the time that the two courses were about the same magnificent idea -- the [I]matrix[/I]. [B]Exploring Matrices[/B] Exploring Matrices is a multi-media project. Short videos, blog posts, interactive MATLAB software and self-study exercises investigate applications of matrices. The material is intended for students in an undergraduate course in linear algebra or computational science. However, anyone using matrices should find topics that interest them. The first release of Exploring Matrices has six modules. All of the modules feature animated MATLAB displays and four of the modules include interactive MATLAB "apps". The modules are: [LIST][*]Matrix Multiplication[*]Rotation and Scaling[*]Computer Graphics[*]Matrices and Cubes[*]Simulink[*]AI and Gorillas[/LIST][B]YouTube Videos[/B] An introduction, and six videos ranging in length from one to six minutes, are available on YouTube at [URL]https://youtube.com/playlist?list=PLn8PRpmsu08oGNmtBfFOmgVC0TlXDaLDJ[/URL]. The first four of these videos feature animations produced by our four MATLAB apps -- Multiply, Rotate, Grafix, and Qube. The other two videos describe two applications, simulation of control systems and neural networks for facial recognition (of gorillas). [B]Matrix Multiplication[/B] Some viewers may just be learning the mechanics of matrix multiplication. Other viewers will have encountered it years ago. The traditional algorithm for computing the product of two matrices involves inner products between the rows of the first matrix and the columns of the second. A less familiar algorithm, which involves linear combinations of the columns of the first matrix, is often more efficient and informative. The two approaches produce the same final result from intermediate terms in different orders. Here is one frame from the animation of these two algorithms generated by our Multiply app. The highlighted element in the first matrix moves across the rows or down the columns. [IMG]https://blogs.mathworks.com/cleve/files/Multy.png[/IMG] [B]Rotation and Scaling[/B] Our first matrices are 2-by-2. We see how the matrix $$R \ = \\left( \begin{array}{rr} \cos{\theta} & \sin{\theta} \\ -\sin{\theta} & \cos{\theta} \end{array} \right)$$ rotates points by the angle $\theta$, measured in degrees. We also see how the matrix $$S \ = \\left( \begin{array}{rr} \sigma & 0 \\ 0 & \sigma \end{array} \right)\ \ \ \ \ \ \ \$$ makes objects larger and smaller. The two can be combined with matrix multiplication. For more operations in higher dimensions, matrix multiplication provides a unifying framework. Here is one frame from the animation of rotation and scaling generated by the Rotate app. The first panel displays a 2-by-2 rotation matrix, the second panel displays a 2-by-2 diagonal scaling matrix, and the third panel displays their product. [IMG]https://blogs.mathworks.com/cleve/files/Rotate.png[/IMG] [B]Computer Graphics[/B] Operations with the 4-by-4 matrices that are at the heart of modern computer graphics employ a system known as "homogeneous coordinates". The leading 3-by-3 submatrix produces rotation and scaling in three dimensions. The fourth column produces translations. Here is one frame from an animation of rotation about the x-axis generated by the Grafix app. This is often called "pitch". Rotation about the y- and z-axes are "roll" and "yaw", [IMG]https://blogs.mathworks.com/cleve/files/Graphics.png[/IMG] [B]Matrices and Cubes[/B] Rubik's Cube, named for its inventor, Ernő Rubik, a Hungarian professor of architecture, is the greatest mathematical puzzle of all time. Our digital simulation of the puzzle, Qube, is powered by rotation matrices. The model consists of 27 identical copies of a single small [I]cubelet[/I] whose sides are colored red, white, blue, yellow, orange and green. Initially, all cubelets have the same orientation. A [I]move[/I] is the simultaneous rotation of the nine cubelets in one of the six faces, by 90° or 180°, clockwise or counterclockwise. This leads to $4.3 \times 10^{19}$ possible configurations for a scrambled cube. The object of the puzzle is to return a scrambled cube to the initial state. Most people are interested in solving the puzzle rapidly, but I am more interested in the number of moves required. [IMG]https://blogs.mathworks.com/cleve/files/Qube_frame.png[/IMG] [B]Simulink[/B] MATLAB's companion product, Simulink, is a block diagram programming environment used to design and simulate systems with multidomain models and to automatically generate the code required to operate embedded processors. Matrices are involved in dozens of different ways by Simulink, but most users rarely see operations at that detailed level. Our Simulink module shows a model of an automobile being driven on a test track and displays the pitch, roll and yaw recorded by the matrix connecting the coordinate system for the automobile to the coordinate system for the track. [IMG]https://blogs.mathworks.com/cleve/files/Simulink.png[/IMG] [B]AI and Gorillas[/B] This is a personal story about a project in the early stages of development. My wife and I first visited gorillas in the Volcano National Park of Rwanda twelve years ago. An American primatologist named Dian Fossey had studied the gorillas between 1966 and her murder by poachers in 1985. Her book [I]Gorillas in the Mist[/I] was very popular and was the basis for a critically acclaimed 1988 Hollywood movie starring Sigourney Weaver. We have become good friends with the people in the [URL="https://www.gorilladoctors.org/"]Gorilla Doctors[/URL] organization. These African and American veterinarians attend to the health of the roughly 1,000 gorillas in the park. Most of the gorillas have African names like "Inkundwa" and "Maisha". We envision a gorilla facial recognition system that is available on cell phones and tablets so that new guides and doctors can learn the names of their patients. Inception-v3 is a convolutional neural network (CNN) that is widely used for image processing. We have a version of the network pretrained on more than a million images from the ImageNet database. This publicly available system knows nothing about gorillas. We must do additional training using photos of our unique subjects. This is where matrices are applied. Training a CNN involves determining the values of thousands of weights and coefficients. The digital photos, regarded as vectors, and repeatedly multiplied by circulant matrices where each row is a shifted copy of the other rows. Importantly, a modern CNN also contains some nonlinear layers. Here is one photo from a small test collection. Indundwa appears to have his own selfie stick. [IMG]https://blogs.mathworks.com/cleve/files/Gorillas.png[/IMG] [B]Software[/B] Self-extracting MATLAB source archives of our four apps are available at these links. [LIST][*][URL="https://blogs.mathworks.com/cleve/files/Multiply.m"]Multiply[/URL][*][URL="https://blogs.mathworks.com/cleve/files/Rotate.m"]Rotate[/URL][*][URL="https://blogs.mathworks.com/cleve/files/Grafix.m"]Grafix[/URL][*][URL="https://blogs.mathworks.com/cleve/files/Qube.m"]Qube[/URL][/LIST][B]Thanks[/B] Thanks to Jackson Kustell, Josh Bethoney and Heather Gorr from MathWorks and Jan Ramer and Mike Cranfield from Gorilla Doctors. [B]Dedication[/B] We dedicate the Gorillas project to the memory of [URL="https://www.marylandzoo.org/news-and-updates/2023/08/mourning-the-loss-of-dr-mike-cranfield"]Mike Cranfield, DMV[/URL]. Mike was Executive Director of the Mountain Gorillas Veterinary Project in Rwanda from 1999 until 2014. Before Rwanda, he held various positions at the Maryland Zoo in Baltimore. In June, Mike sent us a disc drive containing over 14,000 photographs of gorillas he had taken in Rwanda. We are now sorting and organizing the photos to provide specialized training of the facial recognition neural net. In August, Mike was hospitalized from an apparent attack of West Nile Virus, He passed away on August 27. Ironically, after years of working safely in the mountain jungles of Central Africa, he probably acquired the virus from a mosquito bite at his family's cabin in Canada. [RIGHT][COLOR=gray][I] [URL="javascript:grabCode_155487671fcc45aabb2371a037046c7a()"][I]Get the MATLAB code (requires JavaScript)[/I][/URL] Published with MATLAB® R2023a [/I][/COLOR][/RIGHT] |
所有时间均为北京时间。现在的时间是 05:01。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.