1

I would like to solve the system of equations $$\sum\limits_{i \in S_m}{} x_{i} \equiv b_m \quad (\textrm{mod } 2\pi)$$ in $n$ real-valued variables $x_1, \dots, x_n$, where the $S_m$'s are length-$k$ subsets of $\{1,\dots,n\}$ (where $k$ is some fixed integer in $[1,n]$) and the $b_m$'s are real numbers in $[0, 2\pi)$. We assume the system does have a solution (clearly, this means that infinitely many solutions exist, since one could just add arbitrary integer multiples of $2\pi$ to any variable).

Here, $a \equiv b \quad (\textrm{mod } 2\pi)$ means that $a-b$ is an integer multiple of $2\pi$.

I am quite unsure how to approach this, because the real numbers modulo $2\pi$ are not a field ($\frac{1}{2\pi}$ has no multiplicative inverse); on the other hand, the problem intuitively still "feels" like it should be solvable.

(Note that this question is very similar to How do you solve linear least-squares modulo $2 \pi$?, which is unanswered, although I am interested in the specific case of recovering a solution when one exists - not in minimizing the least-squares objective for general problems of this form that may not admit a solution.)

  • You want to know how to solve this in principle? Or how to implement an actual algorithm to perform computations? – emacs drives me nuts Feb 10 '20 at 10:26
  • "because the real numbers modulo 2π are not a field (1/(2π) has no multiplicative inverse)". In $\mathbb R/(2π)$, 2π is zero, hence one would not expect 2π to have multiplicative inverse. The problem is that you have zero-divisors, i.e. $a\cdot b=0$ and neither $a$ nor $b$ are zero, for example $a=b=\sqrt{2π}$. – emacs drives me nuts Feb 10 '20 at 10:34
  • I would like to know whether it is even guaranteeably efficiently solvable at all (under the assumption that a true solution does exist). By efficient, I mean worst-case polynomial-time in the number of variables. And yes, I agree with your second comment - perhaps it was a poor choice of example, I just meant to illustrate why it is not a field [by $1/(2\pi)$ I meant the number 0.159..., not the symbolic notation I gave which is undefined in $\mathbb{R}/(2\pi)$]. (However, an efficient algorithm would be nice if one does exist.) – user749477 Feb 10 '20 at 10:47
  • 1
    How would you define multiplication modulo $2\pi$? What exactly is $(2\pi)\cdot (2\pi)$ ? Is it zero (because $2\pi \equiv 0$ mod $2\pi$)? Or is it $\approx 1.779$, because $4\pi^2 -12\pi \approx 1.779$? – daw Feb 10 '20 at 11:32
  • @daw "How would you define multiplication modulo 2π?" In the obvious way and similar to addition and subtraction: compute $a\cdot b$ and then pick the unique real number $x=a\cdot b + k\cdot 2\pi$ with $k\in\mathbb Z$ such that $x\in[0,2\pi)$. We have $4\pi^2-12\pi\equiv 0 \mod 2\pi$, hence when we pick $[0,2\pi)$ as the representatives for our rest classes, the result is uniquely represented by 0. – emacs drives me nuts Feb 10 '20 at 12:48
  • 1
    @emacsdrivesmenuts But $4\pi^2$ is not an integer multiple of $2\pi$. The problem here is that integer multiples of $2\pi$ do not form an ideal in the ring of real numbers. However, the system of congruences does not involve multiplication anyway. – Christoph Feb 10 '20 at 14:12
  • After some thought, I realized that using the assumption that there exists a solution, the problem is actually quite simple. Gaussian elimination in the usual manner (and then taking the result mod 2π) actually suffices to find a solution. – user749477 Feb 13 '20 at 11:38
  • @user749477: One can post an answer to one's own question. Please don't leave answers in comments. – Jacob Manaker Aug 06 '22 at 09:01

1 Answers1

1

I have the same problem in trying to build a sphere spring embedder for planar graphs (all planar graphs can be embedded onto (unit) sphere because of bijection of plane and unit sphere minus north pole). I have overcome the wrap around with a trick sofar.

First I determine (very slow, $O(|V|⁴)$ runtime) tetrahedron vertices with sum of shortest paths maximal). Then I discard two shortest tetrahedron paths not sharing vertices and a big separating circle remains. I give the $4$ vertices coordinates

coords[M[0]] = [3*Math.PI/2, Math.acos(+Math.sqrt(1/3))];
coords[M[1]] = [  Math.PI/2, Math.acos(+Math.sqrt(1/3))];
coords[M[3]] = [    Math.PI, Math.acos(-Math.sqrt(1/3))];
coords[M[2]] = [          0, Math.acos(-Math.sqrt(1/3))];

Then vertices of tetrahedron shortest paths are evenly placed between those vertex positions:
Visualization of separating circle vertex placements

For all vertices on "left" side of separating circle the horizontal polar angle is in range $0°..270°$, and no wrap around can happen. So I use Tutte's system of linear equations solver with separating circle as "outer face" and get polar coordinate positions for left side vertices.

Then I add 2*Math.PI to all vertices in $0°..90°$ range, resulting in all horizontal coordinates being in range $180°..450°$, allowing to solve system of linear equations without wrap for "right" side of separating circle vertices.

This is an example output (my code creates OpenSCAD file for visualization):
corresponding forum posting
sphere spring embedding of (planar) C60 fullerene
As you can see vertices "left" are numbered "$1$", vertices "right" are numbered "$2$" and vertices on separating circle are numbered "$0$" (edges on separating circle are orange as well).

Now I want to fixate all vtype $1$ and $2$ vertices and determine new coordinates for vtype=$0$ vertices by solving system of linear equations, and have the wrap around problem as well.

Now an idea (not complete yet) on how to solve system of linear equations in case not arbitrary precision is needed. This is $2π$:

pi@pi400-64:~ $ echo "pi=4*a(1); 2*pi" | bc -ql
6.28318530717958647688
pi@pi400-64:~ $ 

I took first $8$ digits $62831853$, but that was no prime. But $62831849$ is a prime. So with $7$ digits past decimal point precision values can be represented in $Z/pZ$ with prime $p=62831849$.

If a solution exists in $Z/pZ$, done.
If not, values have to be changed slightly (eg. by increasing/decreasing last digit) in order to find a solution.
The $4$ missing integers until $2π$ should not be a problem.
Will try Gaussian elminination which works on $Z/pZ$ with some modifications in order to find an approximate solution (which would be perfectly fine for me) now, and update here if successful.

VoidGawd
  • 3,110
HermannSW
  • 181