Mathematical guide/Matrix operations: Difference between revisions
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
\end{pmatrix} </math>. | \end{pmatrix} </math>. | ||
The dot product is a way to combine two vectors to get out a single number. | The dot product is a way to combine two vectors to get out a single number. Say we want to take the dot product of the vectors <math> \begin{pmatrix}12\\19\\28\end{pmatrix} </math> and <math> \begin{pmatrix}-2\\0\\1\end{pmatrix} </math>. To do so, follow these steps: | ||
Say we want to take the dot product of the vectors <math> \begin{pmatrix}12\\19\\28\end{pmatrix} </math> and <math> \begin{pmatrix}-2\\0\\1\end{pmatrix} </math>. | |||
To do so, follow these steps: | |||
* Write the vectors separated by a dot to denote the dot product: <math> | * Write the vectors separated by a dot to denote the dot product: <math> | ||
\begin{pmatrix} | \begin{pmatrix} | ||
Line 21: | Line 20: | ||
1 | 1 | ||
\end{pmatrix} | \end{pmatrix} | ||
</math> | </math> | ||
**This may also be notated <math> \langle 12, 19, 28 \vert -2, 0, 1\rangle </math>; from this derives the notation for vals and monzos. | ** This may also be notated <math> \langle 12, 19, 28 \vert -2, 0, 1\rangle </math>; from this derives the notation for vals and monzos. | ||
* Multiply the corresponding elements, and add the results together: <math> \left(12\cdot-2\right)+\left(19\cdot0\right)+\left(28\cdot1\right) = -24 + 0 + 28 = 4 </math> | * Multiply the corresponding elements, and add the results together: <math> \left(12\cdot-2\right)+\left(19\cdot0\right)+\left(28\cdot1\right) = -24 + 0 + 28 = 4 </math> | ||
Line 53: | Line 52: | ||
where the second object is the vector. | where the second object is the vector. | ||
To write the first element of our output, we take the dot product of the first row of our matrix with our vector: | To write the first element of our output, we take the dot product of the first row of our matrix with our vector: <math>\begin{pmatrix} | ||
<math>\begin{pmatrix} | |||
1\\ | 1\\ | ||
0\\ | 0\\ | ||
Line 85: | Line 83: | ||
-6\\ | -6\\ | ||
4\\ | 4\\ | ||
\end{bmatrix}</math> | \end{bmatrix}</math> . | ||
. | |||
== Multiply matrix by matrix == | == Multiply matrix by matrix == | ||
A matrix can act on another matrix, as well. In this case, the matrix on the right can simply be treated as several vectors next to each other. | A matrix can act on another matrix, as well. In this case, the matrix on the right can simply be treated as several vectors next to each other. | ||
<math> | <math> | ||
Line 109: | Line 104: | ||
\end{bmatrix} | \end{bmatrix} | ||
</math> | </math> | ||
== Determinant == | |||
todo | |||
== Practical usage == | |||
Let's say we want to determine the tuning of 6/5 in quarter-comma meantone. | |||
=== Stage 1: JI to temperament === | |||
<math> | |||
\begin{bmatrix} | |||
1 & 0 & -4\\ | |||
0 & 1 & 4 | |||
\end{bmatrix} | |||
</math> | |||
This matrix I've been using as an example is actually a "function" that converts a 5-limit interval in monzo format (with the entries corresponding to powers of 2, 3, and 5) into a corresponding meantone interval in an analogous format (with the entries representing powers of meantone's tempered 2 and 3) called "tempered monzos" or "tmonzos". | |||
So, let's take the monzo for 6/5, [1 1 -1⟩, and apply this matrix to it: <math> | |||
\begin{bmatrix} | |||
1 & 0 & -4\\ | |||
0 & 1 & 4 | |||
\end{bmatrix} | |||
\begin{bmatrix} | |||
1\\ | |||
1\\ | |||
-1 | |||
\end{bmatrix} | |||
= | |||
\begin{bmatrix} | |||
5\\ | |||
-3 | |||
\end{bmatrix}</math>. | |||
The result is the meantone tmonzo representing a tempered 6/5. | |||
=== Stage 2: Temperament to tuning === | |||
Now, we have the tmonzo. We'll be introducing something called a tval, which gives us a specific tuning of our temperament the same way a regular val gives us a specific tuning of just intonation. The quarter-comma meantone tval for this meantone mapping is ⟨1200 ~1896.5784] in cents. This is where the dot product comes in: <math> \langle 1200, ~1896.5784 \vert 5, -3\rangle </math>. | |||
Computing this dot product yields ~310.265, which is exactly the size of the QCM minor third in cents! |