Tenney–Euclidean tuning: Difference between revisions
Rework (see talk). This also introduces the free parameter "s" as I used in my parametric norm (but the idea ultimately comes from Mike's formulation of the Wilson norm) |
+ actually needed contents |
||
| (One intermediate revision by the same user not shown) | |||
| Line 34: | Line 34: | ||
There are a number of methods to solve least squares problems. One common way is to use the [[Moore–Penrose pseudoinverse]]. | There are a number of methods to solve least squares problems. One common way is to use the [[Moore–Penrose pseudoinverse]]. | ||
== Computation | == Computation == | ||
=== Using pseudoinverse === | |||
The Moore–Penrose pseudoinverse, denoted ''A''{{+}}, is a generalization of the inverse matrix with which it shares a lot of properties. In this method, the (not necessarily independent) TE generator map ''G'', which correspond to the rows of ''V'' are given by | The Moore–Penrose pseudoinverse, denoted ''A''{{+}}, is a generalization of the inverse matrix with which it shares a lot of properties. In this method, the (not necessarily independent) TE generator map ''G'', which correspond to the rows of ''V'' are given by | ||
| Line 46: | Line 47: | ||
We may find the same projection matrix starting from a list of weighted monzos rather than vals. If ''M''<sub>''W''</sub> is a rank-''n'' matrix whose columns are weighted monzos, and ''I'' is the ''n''×''n'' identity matrix, then {{nowrap| ''P''<sub>''W''</sub> {{=}} ''I'' − ''M''<sub>''W''</sub>{{subsup|''M''|''W''|+}} }} is the same projection matrix as {{subsup|''V''|''W''|+}}''V''<sub>''W''</sub> so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are. | We may find the same projection matrix starting from a list of weighted monzos rather than vals. If ''M''<sub>''W''</sub> is a rank-''n'' matrix whose columns are weighted monzos, and ''I'' is the ''n''×''n'' identity matrix, then {{nowrap| ''P''<sub>''W''</sub> {{=}} ''I'' − ''M''<sub>''W''</sub>{{subsup|''M''|''W''|+}} }} is the same projection matrix as {{subsup|''V''|''W''|+}}''V''<sub>''W''</sub> so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are. | ||
=== Computer program === | |||
Here is a minimalistic [https://www.python.org/ Python] script that takes a mapping and gives TE generators and tuning maps, using [https://scipy.org/ Scipy]. | |||
<syntaxhighlight lang="python"> | |||
import numpy as np | |||
from scipy import linalg | |||
def te (mapping, subgroup_basis): | |||
just_tuning_map = 1200*np.log2 (subgroup_basis) | |||
te_weight = np.diag (1/np.log2 (subgroup_basis)) | |||
mapping_w = mapping @ te_weight | |||
just_tuning_map_w = just_tuning_map @ te_weight | |||
te_generators = linalg.lstsq (np.transpose (mapping_w), just_tuning_map_w)[0] | |||
te_tuning_map = te_generators @ mapping | |||
return te_generators, te_tuning_map | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="python"> | |||
# taking septimal magic as an example ... | |||
mapping = np.array ([[1, 0, 2, -1], [0, 5, 1, 12]]) | |||
subgroup_basis = np.array ([2, 3, 5, 7]) | |||
# to find the TE tuning you enter | |||
te (mapping, subgroup_basis) | |||
</syntaxhighlight> | |||
Output: | |||
<pre> | |||
[1201.08240941 380.695113 ] | |||
[1201.08240941, 1903.47556502, 2782.85993183, 3367.25894662] | |||
</pre> | |||
== Enforcement == | == Enforcement == | ||
| Line 95: | Line 130: | ||
=== Benedetti/Wilson–Euclidean tuning === | === Benedetti/Wilson–Euclidean tuning === | ||
'''Benedetti/Wilson–Euclidean tuning''' ('''BE tuning''') adopts the Benedetti or Wilson weight in place of Tenney weight, based on the dual norm of [[Wilson norm]]<ref group="note">Technically, the Benedetti height is not a norm, and tunings that minimize the maximum Benedetti-weighted damage can be different from those based on the Wilson norm for certain subgroups. However, it is almost always more convenient to simply use the Wilson norm in these cases.</ref>. For {{nowrap|''Q'' {{=}} {{val| 2 3 5 … }}}}, the weighting matrix has the form | '''Benedetti/Wilson–Euclidean tuning''' ('''BE tuning''') adopts the Benedetti or Wilson weight in place of Tenney weight, based on the dual norm of [[Wilson norm]]<ref group="note">Technically, the [[Benedetti height]] is not a norm, and tunings that minimize the maximum Benedetti-weighted damage can be different from those based on the Wilson norm for certain subgroups. However, it is almost always more convenient to simply use the Wilson norm in these cases.</ref>. For {{nowrap|''Q'' {{=}} {{val| 2 3 5 … }}}}, the weighting matrix has the form | ||
$$ W = \operatorname{diag} (1/Q) $$ | $$ W = \operatorname{diag} (1/Q) $$ | ||