# Temperament merging across interval bases

It is possible to merge regular temperaments that are defined in separate interval subspaces.

# Steps

## 1. Determine the interval basis for the output temperament

A guiding principle when performing a temperament merge across interval subspaces is described on the main page for temperament merging:

Map-merging produces a temperament that tempers out only the commas that are tempered out by all of the input temperaments.
Conversely, comma-merging produces a temperament that tempers out every comma tempered out by any of the input temperaments.

From this, we can make some helpful statements:

For a comma-merge, because the output temperament deals with every comma, then its interval basis must be capable of supporting this: specifically, it must include every formal prime from any of the input temperaments' interval bases. Think of it this way: for any given temperament, its interval basis's formal primes are the building blocks for its commas, and so in order to express every comma in the merged temperament, we will need every input temperament's building blocks gathered in one place. In other words, we must find the merge of all the input interval bases.

For a map-merge, then, because the output temperament will deal only with tempered commas shared by every input temperament, then its interval basis only needs to include the formal primes that are present in all of the input interval bases. Here's why: a comma built using a formal prime that isn't shared by all input temperaments couldn't even be built in all input temperaments, let alone tempered out by all of them. And so, to build the set of commas that are tempered out by all temperaments, we only need the building blocks that can be found in all of them. In mathematical terms, we must find the intersection of the input interval bases.

## 2. Convert the input temperaments to the output interval basis

After determining the target interval basis, follow the instructions described here to convert the input temperament over: Temperament merging across interval bases#Changing interval basis.

## 3. Perform the merge as usual

See the instructions described here to perform the temperament merge: Temperament merging#Merging.

# Interval subspaces as subspaces of other interval subspaces

In the same way that an subspace is a part of the full space, a subspace can be seen as a part of another larger subspace. So we can say an interval subspace is itself a subspace of another interval subspace.

Any given interval subspace will be a subspace of infinitely many other interval subspaces.

## Examples Figure 1. The interval subspace 2.3 can be clearly seen to be a subspace of 2.3.7. The latter is simply many copies of the former, separated by 7's.

For example, the 2.3 interval subspace is a subspace of the 2.3.7 interval subspace; this is clearly apparent, because the 2.3.7 interval subspace is the same as the 2.3 interval subspace except with the addition of a new formal prime, 7 (see Figure 1). Figure 2. Here we can see how the interval subspace 2.9 is a subspace of 2.3. The latter is simply two copies of the former, offset by 3.

For a perhaps less obvious example, the 2.9.5 interval subspace is a subspace of the 2.3.5 interval subspace; this may be surprising, because 2.9.5 is the one with a larger formal prime, but what this actually means is that it spans a smaller subspace, because while 2.3.5 contains all intervals with any power of 3, 2.9.5 contains only half of those, specifically those with even powers of 3, i.e., powers of 9 (see Figure 2).

Sometimes, neither interval subspace is a subspace of the other. Consider 2.3.5 and 2.3.7: the former lacks a 7, and the latter lacks a 5.

## Application: determining whether it is possible to change the interval subspace

Understanding which interval subspaces are subspaces of each other is important when changing the interval subspace for an interval or temperament. This is because only certain changes are possible: specifically, it is only possible to change between interval subspaces where one is a subspace of the other. Otherwise, the interval subspaces are incomparable.

We then have further constraints, depending on which type of object we're changing the interval subspace for:

• For objects that are made of intervals — such as individual intervals themselves, or comma bases — we can only change in the direction from the subspace to the superspace. This is because unless the target interval subspace completely contains the original interval subspace, there's no guarantee that we'll still have all the formal prime building blocks that we need to represent our intervals.
• For objects that are made of maps, i.e. mappings, the opposite is true: we can only change from the superspace to the subspace. Think of it this way: maps are functions, and they only claim to know what to do with inputs from within their given domain, and their domain is the interval subspace. So we can restrict their behavior just fine, because there's no question about what they do with inputs that don't happen to use every available building block from their domain. But there's no unambiguous way to say what they should do with any inputs that use building blocks from outside that domain, if we were to try to expand it.

These two types of objects are in fact the only two types of objects we need to worry about in RTT. The technical term for the difference between these two types of objects is variance. There are only two variances: contravariant, and covariant. Intervals are contravariant, and maps are covariant.

So from these two opposing bulleted facts above, we can conclude that any for pair of interval subspaces where neither one is a subspace of the other, there would be no way for us to express either intervals or maps from one in the other. And that's why we could say that they're incomparable interval subspaces.

## General method to determine whether an interval subspace is a subspace of another

A couple subsections ago, we provided a couple examples where we used natural language to explain — between two interval subspaces — which one was a subspace of the other. But we still need to describe a method to determine this in general. Let's do that next.

We can say that an interval subspace $\textbf{b}_1$ is a subspace of another interval subspace $\textbf{b}_2$ if when we merge $\textbf{b}_1$ and $\textbf{b}_2$ we just get $\textbf{b}_2$ again. In layperson's terms, if $\textbf{b}_1$ brings nothing to the table that $\textbf{b}_2$ hasn't already brought, then it is completely contained by $\textbf{b}_2$ and therefore is a subspace of it.

For more information on merging interval bases, see Temperament merging across interval bases#Merging.

### Example

For instance, we can demonstrate how 2.25/9.11/7 is a subspace of 2.5/3.7.11 using this approach. If you've really got a knack for this stuff, you may be able to eyeball even this somewhat intense example, but it's obviously good to have a rigorous method like this to fall back on, if only to convince ourselves that we've got the right answer (or to automate things with code, as has been done with these methods in the RTT library in Wolfram Language).

So, first, we do the first step of merging interval bases: concatenate them. That gets us 2.25/9.11/7.2.5/3.7.11.

The next step of merging is to canonicalize. To begin that, we convert our interval basis to a formal primes matrix $F$. Here, we've labeled the columns with the number-list representation of the formal primes of this interval basis, to help show the correspondence, as well as the rows with the primes these formal primes factor into:

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \\ \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{25/9} & \scriptsize{11/7} & \scriptsize{2} & \scriptsize{5/3} & \scriptsize{7} & \scriptsize{11} \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & -2 & 0 & 0 & -1 & 0 & 0 \\ 0 & 2 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 1 \\ \end{array} \right] \\ \end{array}$

And now we reduce that big resultant matrix, using column-style Hermite normal form (the labels have been updated match the results, too):

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \\ \end{array} \begin{array} {lll} \begin{array} {lll} & \scriptsize{2} & \scriptsize{5/3} & \scriptsize{7} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ \end{array} \right] \\ \end{array}$

The columns with all zeroes are not useful and so we can throw those away.

And so when we convert this back to the typical list of numbers form, we have 2.5/3.7.11 again. So this tells us that 2.25/9.11/7 is totally contained by 2.5/3.7.11, and so it's a subspace of it.

# Interval basis operations

## Merging

If you happen to already be familiar with temperament merging, merging interval bases follows a similar pattern: concatenate, then canonicalize the result.

### But first: a gentle introduction

Many times, it's easy to eyeball the merge of two interval bases. The basic idea is to just take everything that's in either one basis or the other. So 2.3.7 merged with 2.3.5 should just be 2.3.5.7, easy. Sometimes it can get kind of tricky, though. Like, what's the merge of 2.3.7/5 and 2.9.21/5? Not so obvious now. Hint: it's not 2.3.9.7/5.21/5!

### Concatenate

This is the easy part. Suppose we're merging 2.3.5 and 2.3.7; the concatenation of those two is quite simply 2.3.5.2.3.7. Yes, that result contains a lot of repetition. But that's what the next step — the canonicalization step — is there to solve.

### Notation

The notation used for merging here is the same as comma-merge: $\textbf{b}_1|\textbf{b}_2$.

### Applications

Interval basis merging comes up in two key situations:

1. Determining whether one interval subspace is a subspace of another: $\textbf{b}_1$ is a subspace of $\textbf{b}_2$ if $\textbf{b}_1|\textbf{b}_2 = \textbf{b}_2$. For more details, see: Temperament merging across interval bases#General method to determine whether an interval subspace is a subspace of another.
2. Comma-merging temperaments across interval bases, in which case the comma-merged temperament's interval basis will be the merge of the all the input interval bases.

## Intersecting

Finding the intersection of interval bases is surprisingly tricky:

1. Convert the interval bases to formal prime matrices, as with a merge.
2. Create a block matrix by stacking two copies of one formal prime matrix on the left side, and then setting one copy of the other formal prime matrix on the right side, with the bottom-right quadrant of this block matrix filled in with all zeros.
3. HNF this.
4. The results we want are in the bottom-right. We take only half-columns, from the bottom half, and only half-columns where their corresponding top-half are all zeros (which will only happen to columns that are sorted to the right side).
5. Canonicalize.

The reason this works is that wherever the corresponding top-half columns are all zeros, this was achieved through linear combinations of vectors from both interval bases, which means the information below them represents vectors that are in both of them. In other words, if $(x, x) + (y, 0) = (0, z)$ and $x$ is in $\textbf{b}_1$ and $y$ is in $\textbf{b}_2$, then we must have $x + y = 0$ and $z = x$. We're sort of abusing HNF as a way to solve a system, kind of like when we calculate the null-space.

### But first: a gentle introduction

As with the interval basis merge, it is sometimes practical to eyeball the answer. The basic idea is just to take only formal primes that in both of the interval bases. So the intersection of 2.3.5 and 2.3.7 is plainly just 2.3. But other times the answer may not be so clear. Such as: What is the intersection of 2.5/3.9/7 and 2.9.5? Hint: It's not just 2!

### Example

Let's find the intersection of 2.5/3 and 2.9.5.

First, the two interval bases as formal prime matrices:

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{5/3} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 \\ 0 & -1 \\ 0 & 1 \\ \end{array} \right] \end{array} \hspace{1cm} \begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{5} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array}$

Now we must combine them into one big block matrix. Two copies of the first on the left, one copy of the other in the top-right, and zeros to pad out:

$\left[ \begin{array} {rr|rrr} 1 & 0 & 1 & 0 & 0 \\ 0 & -1 & 0 & 2 & 0 \\ 0 & 1 & 0 & 0 & 1 \\ \hline 1 & 0 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ \end{array} \right]$

Now, HNF that (column-style, so zeros end up in the top right):

$\left[ \begin{array} {rrrrr} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 2 \\ 0 & -1 & 0 & 0 & -2 \\ \end{array} \right]$

Now we're looking for any half-columns in the bottom half wherever there are all zeroes in the corresponding top half. Such zeroes are highlighted red here, and what we're looking for is highlighted in yellow:

$\left[ \begin{array} {rrrrr} 1 & 0 & 0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 1 & 0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 0 & 1 & \colorbox{pink}0 & \colorbox{pink}0 \\ \hline 0 & 0 & 0 & \colorbox{yellow}1 & \colorbox{yellow}0 \\ 0 & 1 & 0 & \colorbox{yellow}0 & \colorbox{yellow}2 \\ 0 & -1 & 0 & \colorbox{yellow}0 & \colorbox{yellow}{-2} \\ \end{array} \right]$

So let's focus in on that result:

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{9/25} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 \\ 0 & 2 \\ 0 & -2 \\ \end{array} \right] \end{array}$

Canonicalization time. That's already in matrix form, and HNF even (yes, we use HNF again here). No all zeros columns. Converted back to a list of numbers we at first have 2.9/25. But the last step is to take the undirected value, which reciprocates 9/25 to its super form which is 25/9. So the intersection of 2.5/3 and 2.9.5 is 2.25/9.

### Notation

The notation for interval basis intersecting we'll use here is just the intersection symbol: $\textbf{b}_1∩\textbf{b}_2$.

### Applications

The intersection of interval bases comes up with doing a map-merge of temperaments. The resulting temperament's interval basis will be the intersection of all the input interval bases. For more information, see: Temperament merging across interval bases#Map-merge.

# Changing interval basis An interval rebase forms a two-way bridge between an interval superspace basis $\textbf{b}_L$ and an interval subspace basis $\textbf{b}_s$. But mappings can only use it to go from the superspace to the subspace, and comma bases can only use it to go from the subspace to the superspace.

Given an interval, comma basis, or mapping — anything that has an associated interval basis — it is possible to change it from one interval basis to another. We can accomplish this using an interval rebase, an object that works like a two-way bridge between two interval bases.

Elsewhere, these have been called subgroup basis matrices, but that terminology will not be used here, for the same reasons as are described in the last section of this article (here: Interval basis#Terminology: interval basis vs. subgroup) as well as the additional reason that such a name can easily be conflated with the interval basis itself. Sometimes the interval superspace's formal prime matrix is an identity matrix, in which case the interval rebase will be the same as the interval subspace's formal prime matrix, but this is not always the case.

As discussed earlier, only certain interval basis changes are possible: (here: Temperament merging across interval bases#Application: determining whether it is possible to change the interval subspace). To quickly recap here, it is only possible to change between interval subspaces where one is a subspace of the other. So when we say a given interval rebase works like a two-way bridge, there's a more specific way to say what we mean: an interval rebase allows us to change either from the subspace to the superspace, or from the superspace to the subspace. Which direction we go just depends on which side we enter the bridge from: the right side or the left side.

## Constructing an interval rebase

Here are the steps:

1. Set up a matrix with $d_L$ rows, where $d_L$ is the dimensionality of the superspace, and $d_s$ columns, where $d_s$ is the dimensionality of the subspace.
2. Label the rows with the superspace formal primes.
3. Label the columns with the subspace formal primes.
4. Fill in each entry with the count of formal primes from the interval superspace basis for this row that could be used to build the formal primes in the interval subspace basis for this column.

### Example

Let's construct the interval rebase $R$ between 2.25/9.11/7 and 2.5/3.7.11. As we proved earlier, the former is a subspace of the latter. So this will be a 4×3 matrix.

• The first column is easy. There's no change to prime 2 between these two interval bases.
• The second column isn't so tricky, if you can recognize that 25/9 is simply 5/3 squared. So we need a 2 in the cell connecting those two formal primes, and zeroes elsewhere.
• The third column isn't so tricky either. It's just one 11 in the numerator, so that's a +1, and one 7 in the denominator, so that's a -1.

And here's the final result:

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{5/3} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \\ \end{array} \begin{array} {lll} \begin{array} {lll} & \scriptsize{2} & \scriptsize{25/9} & \scriptsize{11/7} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & -1 \\ 0 & 0 & 1 \\ \end{array} \right] \\ \end{array}$

## Using the interval rebase

For intervals and comma bases, which can only be changed from a subspace to a superspace, we left-multiply by the interval rebase; this process is identical to the process used when mapping intervals with ordinary temperament mappings, except replacing the mapping with the interval rebase.

As for changing such temperament mapping matrices themselves — which can only be changed the other way, from a superspace to a subspace — we instead right-multiply by the interval rebase. So, strangely, this is also identical to the process used when mapping intervals with ordinary temperament mappings, except replacing the intervals with the interval rebase.

### Examples

Suppose we have the interval rebase $R_{L↔s}$ between 2.3.5.7 $\textbf{b}_L$ and 2.9/7.5/3 $\textbf{b}_s$. The superspace is 2.3.5.7, so that's the rows, and 2.9/7.5/3 is the subspace, so that's the columns. And so here's our $R_{L↔s}$:

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \\ \end{array} \begin{array} {lll} \begin{array} {lll} & \scriptsize{2} & \scriptsize{5/3} & \scriptsize{9/7} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & -1 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \\ \end{array} \right] \\ \end{array}$

First, let's use this to convert a comma basis $C_s$ (that's in the $\textbf{b}_s$ interval subspace) to the $\textbf{b}_L$interval subspace, by doing $R_{L↔s}.C$:

$\begin{array} {ccc} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} C_L \\ \begin{array} {ccc} \\ \end{array} \\ \left[ \begin{array} {rrr} -8 & -4 \\ -11 & -3 \\ 11 & 5 \\ 0 & -1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{←} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} R_{L↔s} \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{5/3} & \scriptsize{9/7} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & -1 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{×} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{5/3} \\ \scriptsize{9/7} \\ \end{array} \\ \begin{array} {rrr} \\ \end{array} \\ \end{array} \begin{array} {ccc} C_s \\ \begin{array} {ccc} \\ \end{array} \\ \left[ \begin{array} {rrr} -8 & -4 \\ 11 & 5 \\ 0 & 1 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \end{array} \\ \end{array}$

And now let's use $R_{L↔s}$ to convert a mapping the other way, from $\textbf{b}_L$ to $\textbf{b}_s$, by doing $M_L.R_{L↔s}$:

$\begin{array} {ccc} M_L \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{3} & \scriptsize{5} & \scriptsize{7} \\ \end{array} \\ \left[ \begin{array} {rrr} 12 & 19 & 28 & 34 \end{array} \right] \end{array} \hspace{0.5cm} \large{×} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} R_{L↔s} \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{5/3} & \scriptsize{9/7} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & -1 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{→} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} M_s \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{5/3} & \scriptsize{9/7} \\ \end{array} \\ \left[ \begin{array} {rrr} 12 & 9 & 4 \end{array} \right] \\ \begin{array} {rrr} \\ \end{array} \\ \end{array}$

## Wolfram implementation

Functions for finding interval rebases have been implemented in the RTT library in Wolfram Language as getRforM and getRforC. Although it also simply contains changeB which you can use directly on any temperament and it will do this step under the hood for you.

# Examples

## Comma-merge

First, let's work through an example of a comma-merge across interval bases: meantone $T_1$ with archytas $T_2$, where meantone is in the 5-limit standard interval basis 2.3.5, which we'll call $\textbf{b}_1$, and archytas is in the 2.3.7 interval basis, which we'll call $\textbf{b}_2$.

First we must merge these two temperaments' interval bases. Concatenate them to 2.3.5.2.3.7, then convert to matrix:

$\begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{3} & \scriptsize{5} & \scriptsize{2} & \scriptsize{3} & \scriptsize{7}\\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ \end{array} \right] \end{array}$

Then column Hermite normal form:

$\begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{3} & \scriptsize{5} & \scriptsize{7} & & \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ \end{array} \right] \end{array}$

Then remove the columns of all zeros, go back to number list form, and make sure everything's greater than 1, which it is already. And so the merged formal prime matrix $F_1|F_2$ is 2.3.5.7.

Now we change the formal prime matrix for each comma basis to $F_1|F_2$. Let's do meantone first. First we need to find our interval rebase $R_{F_1|F_2↔F_1}$.

Actually, $R_{1|2↔1}$ is easier enough to read, and still clear enough, so we'll use that notation moving forward. And here it is itself:

$\begin{array} {ccc} \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{3} & \scriptsize{5} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \\ \end{array} \right] \end{array}$

Now we take our comma basis $C_1$ and left-multiply it by this $R_{1|2↔1}$, just like we would left-multiply by a mapping:

$\begin{array} {ccc} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} (1|2)C_1 \\ \begin{array} {ccc} \\ \end{array} \\ \left[ \begin{array} {rrr} 4 \\ -4 \\ 1 \\ 0 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{←} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} R_{1|2↔1} \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{3} & \scriptsize{5} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{×} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \end{array} \\ \begin{array} {rrr} \\ \end{array} \\ \end{array} \begin{array} {ccc} C_1 \\ \begin{array} {ccc} \\ \end{array} \\ \left[ \begin{array} {rrr} 4 \\ -4 \\ 1 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \end{array} \\ \end{array}$

Now we find our other $R$, the one for archytas, i.e. $R_{1|2↔2}$:

$\begin{array} {rrr} \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{7} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array}$

And change the interval basis for the archytas comma basis in the same way:

$\begin{array}{rrr} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} (1|2)C_2 \\ \begin{array} {ccc} \\ \end{array} \\ \left[ \begin{array} {rrr} 6 \\ -2 \\ 0 \\ -1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{←} \normalsize{} \hspace{0.5cm} \begin{array} {rrr} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \end{array} \end{array} \begin{array} {ccc} R_{1|2↔2} \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{7} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{×} \normalsize{} \hspace{0.5cm} \begin{array} {rrr} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{7} \\ \end{array} \\ \begin{array} {rrr} \\ \end{array} \\ \end{array} \begin{array} {ccc} C_2 \\ \begin{array} {ccc} \\ \end{array} \\ \left[ \begin{array} {rrr} 6 \\ -1 \\ -1 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \end{array} \\ \end{array}$

Finally, we can merge these two comma bases as usual:

$\begin{array} {ccc} (1|2)C_1 \\ \left[ \begin{array} {rrr} 4 \\ -4 \\ 1 \\ 0 \\ \end{array} \right] \\ \end{array} | \begin{array} {ccc} (1|2)C_2 \\ \left[ \begin{array} {rrr} 6 \\ -2 \\ 0 \\ -1\\ \end{array} \right] \end{array} = \begin{array} {ccc} (1|2)C_1|C_2 \\ \left[ \begin{array} {rrr} 4 & 6 \\ -4 & -2 \\ 1 & 0 \\ 0 & -1\\ \end{array} \right] \end{array} \text{which canonicalizes to} \left[ \begin{array} {rrr} 4 & -6 \\ -4 & 2 \\ 1 & 0 \\ 0 & 1\\ \end{array} \right]$

And so [4 -4 1] | (2.3.7)[6 -1 -1] = [4 -4 1 0 [6 -2 0 -1].

## Map-merge

Now, let's work through an example of a map-merge of temperaments with different formal primes: 22 equal temperament $T_1$ with 17 equal temperament $T_2$, where 22-ET has interval basis 2.3.5.11, which we'll call $\textbf{b}_1$, and 17-ET has interval basis 2.9.7.11, which we'll call $\textbf{b}_2$.

First we must intersect these two temperaments' interval bases. The first step of that is to convert them to formal prime matrices which have the formal primes as columns and the merged set of the primes they factor into as the rows:

$\begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{3} & \scriptsize{5} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right] \end{array} \hspace{1cm} \begin{array} {ccc} \begin{array} {ccc} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{7} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} \right] \end{array}$

Build our block matrix:

$\left[ \begin{array} {rrrr|rrrr} 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 2 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 \\ \hline 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ \end{array} \right]$

HNF it:

$\left[ \begin{array} {rrrrrrrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 2 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{array} \right]$

Identify what we want:

$\left[ \begin{array} {rrrrrrrr} 1 & 0 & 0 & 0 & 0 & \colorbox{pink}0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 1 & 0 & 0 & 0 & \colorbox{pink}0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 0 & 1 & 0 & 0 & \colorbox{pink}0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 0 & 0 & 1 & 0 & \colorbox{pink}0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 0 & 0 & 0 & 1 & \colorbox{pink}0 & \colorbox{pink}0 & \colorbox{pink}0 \\ 0 & 0 & 0 & 0 & 0 & \colorbox{yellow}1 & \colorbox{yellow}0 & \colorbox{yellow}0 \\ 0 & 1 & 0 & 0 & 0 & \colorbox{yellow}0 & \colorbox{yellow}2 & \colorbox{yellow}0 \\ 0 & 0 & 1 & 0 & 0 & \colorbox{yellow}0 & \colorbox{yellow}0 & \colorbox{yellow}0 \\ 0 & 0 & 0 & 0 & 0 & \colorbox{yellow}0 & \colorbox{yellow}0 & \colorbox{yellow}0 \\ 0 & 0 & 0 & 0 & 0 & \colorbox{yellow}0 & \colorbox{yellow}0 & \colorbox{yellow}1 \\ \end{array} \right]$

Take just that:

$\left[ \begin{array} {rrrrrrrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right]$

Canonicalize (HNF, remove all-zero columns, back to number list form, and make super). So that tells us that the intersected interval basis $\textbf{b}_1∩\textbf{b}_2$ is 2.9.11.

Now we change the interval basis for each mapping to $\textbf{b}_1∩\textbf{b}_2$. Let's do 22-ET first. First we need to find our interval rebase $R_{1↔1∩2}$:

$\begin{array} {ccc} \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{11} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array}$

Now we take our mapping $M_1$ and right-multiply it by this $R_{1∩2↔1}$, just like we would right-multiply it by a list of vectors:

$\begin{array} {ccc} M_1 \\ \begin{array} {ccc} \scriptsize{2} & \!\!\! & \scriptsize{3} & \!\!\! & \scriptsize{5} & \!\!\! & \scriptsize{11} \end{array} \\ \left[ \begin{array} {rrr} 22 & 35 & 51 & 76 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \\ \end{array} \end{array} \hspace{0.5cm} \large{×} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{3} \\ \scriptsize{5} \\ \scriptsize{11} \\ \end{array} \end{array} \begin{array} {ccc} R_{1↔1∩2} \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{→} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} (1∩2)M_1 \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 22 & 70 & 76 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \\ \end{array} \end{array}$

Now we find our other $R$, the one for 17-ET, i.e. $R_{2↔1∩2}$:

$\begin{array} {ccc} \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{9} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \end{array} \begin{array} {ccc} \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array}$

And change the interval basis for the 17-ET mapping in the same way:

$\begin{array} {ccc} M_2 \\ \begin{array} {ccc} \scriptsize{2} & \!\!\! & \scriptsize{9} & \!\!\! & \scriptsize{7} & \!\!\! & \scriptsize{11} \end{array} \\ \left[ \begin{array} {rrr} 17 & 54 & 48 & 59 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \\ \end{array} \end{array} \hspace{0.5cm} \large{×} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} \\ \begin{array} {rrr} \\ \end{array} \\ \begin{array} {rrr} \scriptsize{2} \\ \scriptsize{9} \\ \scriptsize{7} \\ \scriptsize{11} \\ \end{array} \end{array} \begin{array} {ccc} R_{2↔1∩2} \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right] \end{array} \hspace{0.5cm} \large{→} \normalsize{} \hspace{0.5cm} \begin{array} {ccc} (1∩2)M_2 \\ \begin{array} {ccc} \scriptsize{2} & \scriptsize{9} & \scriptsize{11} \\ \end{array} \\ \left[ \begin{array} {rrr} 17 & 54 & 59 \\ \end{array} \right] \\ \begin{array} {rrr} \\ \\ \end{array} \end{array}$

Finally, we can merge these two mappings as usual:

$\begin{array} {ccc} \left[ \begin{array} {rrr} 22 & 70 & 76 \\ \end{array} \right] \\ \& \\ \left[ \begin{array} {rrr} 17 & 54 & 59 \\ \end{array} \right] \\ ↓ \\ \left[ \begin{array} {rrr} 22 & 70 & 76 \\ 17 & 54 & 59 \\ \end{array} \right] \\ \text{which canonicalizes to} \\ \left[ \begin{array} {rrr} 1 & 0 & 13 \\ 0 & 1 & -3 \\ \end{array} \right] \\ \end{array}$

And so (2.3.5.11)[22 35 51 76] & (2.9.7.11)[17 54 48 59] = (2.9.11)[1 0 13] 0 1 -3].

# Footnotes

1. The technical mathematical term for this is "sumset", not "union" as we might expect; in many contexts, "union" is the dual operation to "intersection", but for vector spaces, the dual operation to intersection is "sumset" (see page 4 of https://www2.math.upenn.edu/~siegelch/Notes/linalg.pdf). The difference between union and sumset can be explained like this: if we had two planes in a volume, their union would be both the planes, but their sumset would be the volume.
2. Using ∩ for intersection, which seems obvious. But the merge notation is tricky. We could use ∪, of course. But technically speaking, it's not a union, but a sumset, and the notation for that is unfortunately just the plus sign +, which could be confusing. Furthermore, in the context of merging temperaments, we don't use either of those symbols. Actually, we use two different symbols there, depending on what we're merging! We use & if it's maps, and | if it's commas. At least, that's the notation used on the Meet and join and Temperament merging pages. And because intersections also arise for temperament matrices like mappings and comma bases, this article has gone with consistent notation for interval bases. Interval bases concatenate horizontally, like comma bases, so we use | and consider it a "basis-merge" symbol, i.e. it works on both comma bases and interval bases.
3. This approach was found by Sintel here: https://math.stackexchange.com/questions/1560411/basis-for-the-intersection-of-two-integer-lattices/2472784#2472784
4. credit this explanation to Tom Price on Discord
5. Credit this explanation to Sintel on Discord
6. We're borrowing $L$ and $s$ from MOS scale theory; there's no direct conceptual connection here, nor any need to understand anything about such scale theory at this moment, but if you happen to be familiar with the conventional use of $L$ for "Large" and $s$ for "small" in that other xenharmonic topic, then this variable choice may be particularly helpful for you.