function poly(x, names, sep){
let s = "";
let zero = true;
for (let i = 0; i < 10; i++){
if(x[i]){
if(!zero){
s += '+';
}
zero = false;
if (!i){
s += x[i]
}
else
{
if(x[i] != 1){
s += x[i];
s += sep;
}
s += names[i];
}
}
}
if(zero)
return '0';
return s;
}
function polyHTML(x){
if(typeof(x) == typeof(666)){
return x;
}
if(x.length == 10){
return poly(x, [ '1', 'x', 'y', 'z', 'x<sup>2</sup>', 'xy', 'xz', 'y<sup>2</sup>', 'yz', 'z<sup>2</sup>'], "");
}
return x;
}
function poly_sage(x){
if(typeof(x) == typeof(666)){
return x;
}
if(x.length == 10){
return poly(x, [ '1', 'x', 'y', 'z', 'x^2', 'x*y', 'x*z', 'y^2', 'y*z', 'z^2'], '*');
}
return x;
}
function poly_tex(x){
if(typeof(x) == typeof(666)){
return x;
}
if(x.length == 10){
return poly(x, [ '1', 'x', 'y', 'z', 'x^2', 'xy', 'xz', 'y^2', 'yz', 'z^2'], '');
}
return x;
}
function matrix_sage(matrix){
const {cols, rows, m} = matrix;
let matrix_array = Array.from({length: rows}, (_, i) => m.slice(i * cols, (i + 1) * cols));
return "matrix([" + matrix_array.map(row => "["+row.map(v => poly_sage(v)).join(',')+"]").join(',') + "])"
}
function matrix_tex(matrix){
const {cols, rows, m} = matrix;
let matrix_array = Array.from({length: rows}, (_, i) => m.slice(i * cols, (i + 1) * cols));
return "\\begin{pmatrix}\n" + matrix_array.map(row => ""+row.map(v => poly_sage(v)).join('&')+"\\\\").join('\n') + "\n\\end{pmatrix}\n"
}
function tex(proof){
let s = '\\documentclass{article}\\usepackage{amsmath}\\setcounter{MaxMatrixCols}{11}\\begin{document}\n'
for (const [i, [a,b,c,d]] of proof.entries()){
s += "\\[ A_{" + i + "} = " + matrix_tex(a) + "=" + matrix_tex(b) + matrix_tex(c) + "\\]\n"
s += "\\[ " + matrix_tex(c) + matrix_tex(b) + "=" + matrix_tex(d) + "= A_{" + (i+1) + "} \\]\n"
}
s += "\\end{document}";
return s
}
function sage(proof){
let s = 'steps = [\n';
for (const [i, [a,b,c,d]] of proof.entries()){
s += "(" + matrix_sage(a) + "," + matrix_sage(b)+ "," + matrix_sage(c) + "," + matrix_sage(d) + ")";
s += ",\n"
}
s += "]";
return s
}
function pynb(proof){
const notebook = {
cells: [{
cell_type: "code",
execution_count: null,
id: "1",
metadata: {},
outputs: [],
source: [sage(proof)+"\n", ""]
},
{
cell_type: "code",
execution_count: null,
id: "2",
metadata: {},
outputs: [],
source: [
"for (A,R,S,B) in steps:\n",
" assert A == R*S\n",
" assert S*R == B\n",
""
]
}
],
metadata: {},
nbformat: 4,
nbformat_minor: 5
};
return JSON.stringify(notebook);
}
function MatrixHTML(matrix){
const {cols, rows, m} = matrix;
let matrix_array = Array.from({length: rows}, (_, i) => m.slice(i * cols, (i + 1) * cols));
let pad = cols > 3 ? 4/ cols : 1;
return html`
<div style="display:flex; align-items:stretch; width:fit-content;">
<div style="border:1px solid #333; border-right:none; width:6px; border-radius:3px 0 0 3px;"></div>
<table style="border-collapse:collapse; margin:0 -4px;">
${matrix_array.map(row => html`<tr>
${row.map(v => html`<td style="padding:${3*pad}px ${6*pad}px; text-align:center;">${polyHTML(v)}</td>`)}
</tr>`)}
</table>
<div style="border:1px solid #333; border-left:none; width:6px; border-radius:0 3px 3px 0;"></div>
</div>
`
}
function onestep(step, index){
const A = step[0];
const R = step[1];
const S = step[2];
const B = step[3];
return html`
<div style="display:flex; align-items:stretch; width:fit-content;">
<span style="align-self:center; margin-right:6px;">A${index} = </span>
${MatrixHTML(A)}
<span style="align-self:center; margin-right:6px;"> = </span>
${MatrixHTML(R)}
<span style="align-self:center; margin-right:6px;"> </span>
${MatrixHTML(S)}
</div>
<div style="height: 20px;"></div>
<div style="display:flex; align-items:stretch; width:fit-content;">
${MatrixHTML(S)}
<span style="align-self:center; margin-right:6px;"> </span>
${MatrixHTML(R)}
<span style="align-self:center; margin-right:6px;"> = </span>
${MatrixHTML(B)}
<span style="align-self:center; margin-right:6px;">= A${index+1}</span>
</div>
</div>`;
}SSE proofs
The proof
This is a companion to my article (to be on arxiv soon) “Combinatorial Search for SSE equivalence”. It contains proofs that the Baker matrices are SSE equivalent for small sizes, and that the Ashley matrix is SSE equivalent to the matrix 2.
Below is a proof that
Download options
Sage
The sage file give a list of 4-uples \((A,R,S,B)\) s.t. \(A = RS, B = SR\). The notebook version also contains a few ways to test the SSE. If you intend to use these for matrices with polynomials, add the line var('x', 'y', 'z') to the file.
Tex
For large matrices, add {\setlength{\arraycolsep}{2pt} before compiling
See the proof
To navigate using the keyboard, click on the selector and use left/right.