-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automated deployment to update community posts 2023-09-26
- Loading branch information
github-actions
committed
Sep 26, 2023
1 parent
50637aa
commit 4429e00
Showing
1 changed file
with
373 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,373 @@ | ||
--- | ||
author: MathWorks Blogs | ||
author_tag: mathworks | ||
blog_subtitle: Cleve Moler is the author of the first MATLAB, one of the founders | ||
of MathWorks, and is currently Chief Mathematician at the company. He writes here | ||
about MATLAB, scientific computing and interesting mathematics. | ||
blog_title: 'Cleve’s Corner: Cleve Moler on Mathematics and Computing' | ||
blog_url: https://blogs.mathworks.com/cleve | ||
category: mathworks | ||
date: '2023-09-25 17:57:28' | ||
layout: post | ||
original_url: https://blogs.mathworks.com/cleve/2023/09/25/exploring-matrices-exercises/?s_tid=feedtopost | ||
slug: exploring-matrices-exercises | ||
title: Exploring Matrices Exercises | ||
--- | ||
|
||
<div class="content"><!--introduction--><p>Try your hand at a few exercises involving <a href="https://blogs.mathworks.com/cleve/2023/09/11/exploring-matrices">Exploring Matrices</a>.</p> | ||
<!--/introduction--><h3>Contents</h3><div><ul><li><a href="https://feeds.feedburner.com/mathworks/moler#39c51606-0f1d-4f63-a836-a5b7b53bd13b">Qube Simplified</a></li><li><a href="https://feeds.feedburner.com/mathworks/moler#7c52cde6-70d3-4ad5-b1a1-37c5ce6e87cc">Exploring Matrices Exercises</a></li><li><a href="https://feeds.feedburner.com/mathworks/moler#72d1baf3-32a5-43fd-9ee9-d78b0756d365">Matrix Multiplication</a></li><li><a href="https://feeds.feedburner.com/mathworks/moler#5866120b-8ad5-44c6-91d4-7599fdd930ad">Rotations and Scaling</a></li><li><a href="https://feeds.feedburner.com/mathworks/moler#9ee4efdc-6cce-4067-b642-b70c3c75d2c6">Computer Graphics</a></li><li><a href="https://feeds.feedburner.com/mathworks/moler#08826629-b0f9-4a97-a3e3-655f52742c85">Matrices and Cubes</a></li></ul></div> | ||
<h4>Qube Simplified<a name="39c51606-0f1d-4f63-a836-a5b7b53bd13b"></a></h4><p><img alt="" hspace="5" src="https://blogs.mathworks.com/cleve/files/Qube_simplified.png" vspace="5" /> </p> | ||
<p>I have simplified the <tt>Qube</tt> app by removing these four buttons.</p> | ||
<div><ul><li><tt>solve</tt>. The <== key now controls the unscrambling operation.</li></ul></div> | ||
<div><ul><li><tt>scramble</tt>. The ==> key now does six random rotations.</li></ul></div> | ||
<div><ul><li><tt>order</tt>. I never found a satisfactory reference for the group theory of Rubik's cube.</li></ul></div> | ||
<div><ul><li><tt>score</tt>. I never found a use for the nuclear norm.</li></ul></div> | ||
<p>Code for <tt>Qube</tt> dated 9/24/2023 is included in the <a href="https://blogs.mathworks.com/cleve/files/Apps_mzip.m">Apps mzip archive</a>.</p> | ||
<h4>Exploring Matrices Exercises<a name="7c52cde6-70d3-4ad5-b1a1-37c5ce6e87cc"></a></h4><p>Here are a few exercises for <a href="https://blogs.mathworks.com/cleve/2023/09/11/exploring-matrices">Exploring Matrices</a>. The answers are available at <a href="https://blogs.mathworks.com/cleve/files/ExMatAnswers.pdf">ExMatAnswers</a>.</p> | ||
<h4>Matrix Multiplication<a name="72d1baf3-32a5-43fd-9ee9-d78b0756d365"></a></h4><p><b>1.</b> Compute by rows, and by columns.</p> | ||
<p>$$ | ||
\left( | ||
\begin{array}{rrr} | ||
8 & 1 & 6 \\ | ||
3 & 5 & 7 \\ | ||
4 & 9 & 2 | ||
\end{array} | ||
\right) | ||
\left( | ||
\begin{array}{r} | ||
1 \\ | ||
1 \\ | ||
1 | ||
\end{array} | ||
\right) | ||
$$</p> | ||
<p><b>2.</b> Solve for $z$ using inner products of rows, and using linear combinations of columns.</p> | ||
<p>$$ | ||
\left( | ||
\begin{array}{rrr} | ||
1 & 2 & 3 \\ | ||
4 & 5 & 6 \\ | ||
7 & 8 & 9 | ||
\end{array} | ||
\right) | ||
\left( | ||
\begin{array}{r} | ||
1 \\ | ||
z \\ | ||
1 | ||
\end{array} | ||
\right) | ||
\ = \ | ||
\left( | ||
\begin{array}{r} | ||
0 \\ | ||
0 \\ | ||
0 | ||
\end{array} | ||
\right) | ||
$$</p> | ||
<p><b>3.</b> What do the <tt>m</tt>, <tt>n</tt> and <tt>p</tt> buttons on the <tt>Multiply</tt> app do? What are the other buttons and what do they do?</p> | ||
<p><b>4.</b> If <i>A</i> is n-by-n and <i>x</i> is n-by-1, how many multiplications are required to compute <i>A x</i> ?</p> | ||
<p><b>5.</b> If <i>A</i> is m-by-n and <i>B</i> is n-by-p, how many multiplications are required to compute <i>A B</i> ?</p> | ||
<h4>Rotations and Scaling<a name="5866120b-8ad5-44c6-91d4-7599fdd930ad"></a></h4><p><b>1.</b> What is <i>R</i>(30º)?</p> | ||
<p>$$ | ||
R(\theta) \ = \ | ||
\left( | ||
\begin{array}{rr} | ||
\cos{\theta} & \sin{\theta} \\ | ||
-\sin{\theta} & \cos{\theta} | ||
\end{array} | ||
\right) | ||
$$</p> | ||
<p><b>2.</b> Explain <a href="https://xkcd.com/184">https://xkcd.com/184</a>.</p> | ||
<p><b>3.</b> What is the value of $\theta$ ?</p> | ||
<p>$$ | ||
R(\theta) \ = \ | ||
\left( | ||
\begin{array}{rr} | ||
0.8 & 0.6 \\ | ||
-0.6 & 0.8 | ||
\end{array} | ||
\right) | ||
$$</p> | ||
<p><b>4.</b> What is the value of $\theta$ ?</p> | ||
<p><img alt="" hspace="5" src="https://blogs.mathworks.com/cleve/files/theta_exer.png" vspace="5" /> </p> | ||
<p><b>5.</b> Edit a copy of <tt>Rotate.m</tt> and replace the house with a hand. You can use <a href="https://mathworks-my.sharepoint.com/:u:/p/moler/EVREwZQo4ZBLkDggPTky6o4BNIfckvaLQoCDdX4ICjch9A?e=dGA2Y4">my hand</a> or your own hand; see exercise 3.4 in <a href="https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/moler/interp.pdf">Numerical Computing with MATLAB</a> .</p> | ||
<p><img alt="" hspace="5" src="https://blogs.mathworks.com/cleve/files/hand_exer.png" vspace="5" /> </p> | ||
<h4>Computer Graphics<a name="9ee4efdc-6cce-4067-b642-b70c3c75d2c6"></a></h4><p><b>1.</b> Show how homogeneous coordinates and matrix-vector multiplication by <tt>Tx</tt>, <tt>Ty</tt> or <tt>Tz</tt> produce translation.</p> | ||
<p><b>2.</b> What is the range of the rotations used by the pitch, roll, and yaw buttons on the <tt>Grafix</tt> app?</p> | ||
<p><b>3.</b> What color in the beacon on top of the plane? How would you change the beacon's color?</p> | ||
<p><b>4,</b> What is the function of the resolution and offset sliders for the teapot?</p> | ||
<p><b>5,</b> How many times does the bucky ball bounce off the sides of the plot window?</p> | ||
<h4>Matrices and Cubes<a name="08826629-b0f9-4a97-a3e3-655f52742c85"></a></h4><p><b>1.</b> What is the color of central cubelet in the Color Cube?</p> | ||
<p><b>2.</b> What do the "<=" , "<==" , "=>" and "==>" buttons on <tt>Qube</tt> do?</p> | ||
<p><b>3.</b> What is "God's Number" for a 3-by-3-by-3 Rubik's Cube? What are <tt>Q20</tt> and <tt>Q26</tt>? See <a href="https://blogs.mathworks.com/cleve/2022/09/05/rubiks-cube-superflips-and-gods-number">Cleve's Corner 2022/09/05</a>.</p> | ||
<p><b>4.</b> Can you restore the following scrambled cubes with fewer moves than <tt><==</tt>, the unscramble key? Use the quarter-turn metric and reset the cube with <tt>start</tt> or by clicking on <tt>stack</tt> and <tt>Q0</tt>. You might also want to set <tt>speed</tt> to 30 or 45,</p> | ||
<div><ul><li><tt>LRUDFB</tt></li></ul></div> | ||
<div><ul><li><tt>LRL'R'</tt></li></ul></div> | ||
<div><ul><li><tt>FLLLRB</tt></li></ul></div> | ||
<div><ul><li><tt>Q26</tt></li></ul></div> | ||
<div><ul><li>Reset the random number generator by entering <tt>rng(r)</tt> for some small integer <tt>r</tt> in the command window and then generate six random rotations with the <tt>==></tt> key.</li></ul></div> | ||
<!-- | ||
function grabCode_661f86ea0d734810b8ca2514e6ba69c9() { | ||
// Remember the title so we can use it in the new page | ||
title = document.title; | ||
// Break up these strings so that their presence | ||
// in the Javascript doesn't mess up the search for | ||
// the MATLAB code. | ||
t1='661f86ea0d734810b8ca2514e6ba69c9 ' + '##### ' + 'SOURCE BEGIN' + ' #####'; | ||
t2='##### ' + 'SOURCE END' + ' #####' + ' 661f86ea0d734810b8ca2514e6ba69c9'; | ||
b=document.getElementsByTagName('body')[0]; | ||
i1=b.innerHTML.indexOf(t1)+t1.length; | ||
i2=b.innerHTML.indexOf(t2); | ||
code_string = b.innerHTML.substring(i1, i2); | ||
code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--'); | ||
// Use /x3C/g instead of the less-than character to avoid errors | ||
// in the XML parser. | ||
// Use '\x26#60;' instead of '<' so that the XML parser | ||
// doesn't go ahead and substitute the less-than character. | ||
code_string = code_string.replace(/\x3C/g, '\x26#60;'); | ||
copyright = 'Copyright 2023 The MathWorks, Inc.'; | ||
w = window.open(); | ||
d = w.document; | ||
d.write('<pre>\n'); | ||
d.write(code_string); | ||
// Add copyright line at the bottom if specified. | ||
if (copyright.length > 0) { | ||
d.writeln(''); | ||
d.writeln('%%'); | ||
if (copyright.length > 0) { | ||
d.writeln('% _' + copyright + '_'); | ||
} | ||
} | ||
d.write('</pre>\n'); | ||
d.title = title + ' (MATLAB code)'; | ||
d.close(); | ||
} | ||
--><p style="text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;"><br /><a href=""><span style="font-size: x-small; font-style: italic;">Get | ||
the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br /> | ||
Published with MATLAB® R2023a<br /></p> | ||
</div> | ||
<!-- | ||
661f86ea0d734810b8ca2514e6ba69c9 ##### SOURCE BEGIN ##### | ||
%% Exploring Matrices Exercises | ||
% Try your hand at a few exercises involving | ||
% <https://blogs.mathworks.com/cleve/2023/09/11/exploring-matrices | ||
% Exploring Matrices>. | ||
%% Qube Simplified | ||
% | ||
% <<Qube_simplified.png>> | ||
% | ||
% I have simplified the |Qube| app by removing these four buttons. | ||
% | ||
% * |solve|. The <== key now controls the unscrambling | ||
% operation. | ||
% | ||
% * |scramble|. The ==> key now does six random rotations. | ||
% | ||
% * |order|. I never found a satisfactory reference for | ||
% the group theory of Rubik's cube. | ||
% | ||
% * |score|. I never found a use for the nuclear norm. | ||
% | ||
% Code for |Qube| dated 9/24/2023 is included in the | ||
% <https://blogs.mathworks.com/cleve/files/Apps_mzip.m | ||
% Apps mzip archive>. | ||
%% Exploring Matrices Exercises | ||
% | ||
% Here are a few exercises for | ||
% <https://blogs.mathworks.com/cleve/2023/09/11/exploring-matrices | ||
% Exploring Matrices>. | ||
% The answers are available at | ||
% <https://blogs.mathworks.com/cleve/files/ExMatAnswers.pdf | ||
% ExMatAnswers>. | ||
%% Matrix Multiplication | ||
% | ||
% *1.* | ||
% Compute by rows, and by columns. | ||
% | ||
% $$ | ||
% \left( | ||
% \begin{array}{rrr} | ||
% 8 & 1 & 6 \\ | ||
% 3 & 5 & 7 \\ | ||
% 4 & 9 & 2 | ||
% \end{array} | ||
% \right) | ||
% \left( | ||
% \begin{array}{r} | ||
% 1 \\ | ||
% 1 \\ | ||
% 1 | ||
% \end{array} | ||
% \right) | ||
% $$ | ||
% | ||
% | ||
% *2.* | ||
% Solve for $z$ using inner products of rows, and | ||
% using linear combinations of columns. | ||
% | ||
% $$ | ||
% \left( | ||
% \begin{array}{rrr} | ||
% 1 & 2 & 3 \\ | ||
% 4 & 5 & 6 \\ | ||
% 7 & 8 & 9 | ||
% \end{array} | ||
% \right) | ||
% \left( | ||
% \begin{array}{r} | ||
% 1 \\ | ||
% z \\ | ||
% 1 | ||
% \end{array} | ||
% \right) | ||
% \ = \ | ||
% \left( | ||
% \begin{array}{r} | ||
% 0 \\ | ||
% 0 \\ | ||
% 0 | ||
% \end{array} | ||
% \right) | ||
% $$ | ||
% | ||
% | ||
% *3.* | ||
% What do the |m|, |n| and |p| buttons on the |Multiply| app do? | ||
% What are the other buttons and what do they do? | ||
% | ||
% | ||
% *4.* | ||
% If _A_ is n-by-n and _x_ is n-by-1, | ||
% how many multiplications are required to compute _A x_ ? | ||
% | ||
% *5.* | ||
% If _A_ is m-by-n and _B_ is n-by-p, | ||
% how many multiplications are required to compute _A B_ ? | ||
|
||
%% Rotations and Scaling | ||
% | ||
% *1.* | ||
% What is _R_(30º)? | ||
% | ||
% $$ | ||
% R(\theta) \ = \ | ||
% \left( | ||
% \begin{array}{rr} | ||
% \cos{\theta} & \sin{\theta} \\ | ||
% -\sin{\theta} & \cos{\theta} | ||
% \end{array} | ||
% \right) | ||
% $$ | ||
% | ||
% *2.* | ||
% Explain <https://xkcd.com/184>. | ||
% | ||
% *3.* | ||
% What is the value of $\theta$ ? | ||
% | ||
% $$ | ||
% R(\theta) \ = \ | ||
% \left( | ||
% \begin{array}{rr} | ||
% 0.8 & 0.6 \\ | ||
% -0.6 & 0.8 | ||
% \end{array} | ||
% \right) | ||
% $$ | ||
% | ||
% | ||
% *4.* | ||
% What is the value of $\theta$ ? | ||
% | ||
% <<theta_exer.png>> | ||
% | ||
% | ||
% *5.* | ||
% Edit a copy of |Rotate.m| and replace the house with a hand. You can use | ||
% <https://mathworks-my.sharepoint.com/:u:/p/moler/EVREwZQo4ZBLkDggPTky6o4BNIfckvaLQoCDdX4ICjch9A?e=dGA2Y4 my hand> | ||
% or your own hand; see exercise 3.4 in | ||
% <https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/moler/interp.pdf | ||
% Numerical Computing with MATLAB> . | ||
% | ||
% <<hand_exer.png>> | ||
% | ||
|
||
%% Computer Graphics | ||
% | ||
% *1.* | ||
% Show how homogeneous coordinates and matrix-vector multiplication by | ||
% |Tx|, |Ty| or |Tz| produce translation. | ||
% | ||
% | ||
% *2.* | ||
% What is the range of the rotations used by the pitch, roll, and yaw | ||
% buttons on the |Grafix| app? | ||
% | ||
% *3.* | ||
% What color in the beacon on top of the plane? | ||
% How would you change the beacon's color? | ||
% | ||
% | ||
% *4,* | ||
% What is the function of the resolution and offset sliders for the teapot? | ||
% | ||
% | ||
% *5,* | ||
% How many times does the bucky ball bounce off the sides of the plot | ||
% window? | ||
% | ||
|
||
|
||
%% Matrices and Cubes | ||
% | ||
% *1.* | ||
% What is the color of central cubelet in the Color Cube? | ||
% | ||
% | ||
% *2.* | ||
% What do the "<=" , "<==" , "=>" and "==>" buttons on |Qube| do? | ||
% | ||
% | ||
% *3.* | ||
% What is "God's Number" for a 3-by-3-by-3 Rubik's Cube? | ||
% What are |Q20| and |Q26|? | ||
% See <https://blogs.mathworks.com/cleve/2022/09/05/rubiks-cube-superflips-and-gods-number | ||
% Cleve's Corner 2022/09/05>. | ||
% | ||
% | ||
% *4.* | ||
% Can you restore the following scrambled cubes with fewer moves than |<==|, | ||
% the unscramble key? Use the quarter-turn metric and | ||
% reset the cube with |start| or by clicking on |stack| and |Q0|. | ||
% You might also want to set |speed| to 30 or 45, | ||
% | ||
% * |LRUDFB| | ||
% | ||
% * |LRL'R'| | ||
% | ||
% * |FLLLRB| | ||
% | ||
% * |Q26| | ||
% | ||
% * Reset the random number generator by entering |rng(r)| for some | ||
% small integer |r| in the command window and then generate six | ||
% random rotations with the |==>| key. | ||
|
||
|
||
##### SOURCE END ##### 661f86ea0d734810b8ca2514e6ba69c9 | ||
--> |