Derive complex number form its position in the plane Suppose I have a circle of center $s$ and radius $r$ and four points $p1,p2,p3,p4$ (in order) on that circle. What is the formula for the middle point $m$ between $p1$ and $p2$ on the circle? In the input I only have these five complex numbers $s,p1,p2,p3,p4$ and a real number $r$.

 A: Let $ p_2' = \frac{p_2 -s}{p_1 - s}, p_3' = \frac{p_3 -s}{p_1 - s}$. Then $|p_2'| = |p_3'| = 1$. I'll assume that $p_1, p_2, p_3$ are all distinct. So $p_2' \ne 1, p_3' \ne 1$.
Let $\theta_2 = \arg p_2', \theta_3 = \arg p_3'$, where the angles are in $(-\pi, \pi]$.
If $\text{sign}(\theta_3) \ne \text{sign}(\theta_2)$ or $|\theta_3| \ge |\theta_2|$, then set $m' = e^{i\theta_2/2}$. Else set $m' = -e^{i\theta_2/2}$.
Finally $m = s + (p_1 - s)m'$.
$p_4$ is completely superfluous.

To avoid calculating args, we can define for $x^2 + y^2 = 1, y\ne 0$ that $$\sqrt{x+iy} = \sqrt{\frac{1+x}2} + i\left(\text{sign}(y)\sqrt{\frac{1-x}2}\right)$$

*

*If $p_2' = -1$, then $m' = -\text{sign}(\text{Im}(p_3'))i$.

*Else, if $\text{sign}(\text{Im}(p_3')) \ne \text{sign}(\text{Im}(p_2'))$ or $\text{Re}(p_3') < \text{Re}(p_2')$, then $m' = \sqrt{p_2'}$.

*Else $m' =-\sqrt{p_2'}$.

And again $m = s + (p_1 - s)m'$
A: Updated to give the circle midpoint of $p_1,p_2$ along the arc that doesn’t contain $p_3.$
We need the principal square root. If $s=0,p_1=1,p_2=z,p_3=-1,$ then the value is the principal square root of $z.$ It is built into the question.
If $p_3=-1$ and $s=0,$ then the midpoint can be found as $\sqrt{p_1}\sqrt{p_2},$ where we have the principal square root, defined and continuous everywhere other than the negative reals. (It can be defined at the negative reals, but not made continuous.) The value $\sqrt{p_1}\sqrt{p_2}$ is one of the square roots of $p_1p_2,$ but we don't know which sign it takes relative to the principal value of $\sqrt{p_1p_2},$ so we can't simplify.
Then in the general case of $p_1,p_2,p_3$ on a circle around $s,$ we can transform it via $f(z)=\frac{s-z}{p_3-s},$ which transforms the circle containing the $p_i$ to the unit circle, with $f(p_3)=-1,$ and preserving the arc angles. Essentially, $f$ rotates, translates, and scales the plane.
Then we can use:  $$f^{-1}\left(\sqrt{f(p_1)}\sqrt{f(p_2)}\right)=s+(p_3-s)\sqrt{\frac{s-p_1}{p_3-s}}\sqrt{\frac{s-p_2}{p_3-s}}$$
We can't use $\sqrt{u}\sqrt{v}=\sqrt{uv}$ or $u\sqrt{v}=\sqrt{u^2v},$ because these are not true for the principal square root.
This works for any $p_1,p_2\neq p_3.$
The principal square root is not purely algebraic. It is motivated by the algebraic notion of a square root, but the cut is motivated by the geometry of the question. It is fortunate that the principal square root is a very common choice, but it doesn’t have an algebraic meaning.
A: I approach the problem as follows: let
$$
\zeta_1=\arg(p_1-s)\\
\zeta_2=\arg(p_2-s)
$$
with $\zeta_{1,2}\in[-\pi,\pi]$. Then
$$
m=s+re^{i\big(\zeta_2+\frac{\zeta_1-\zeta_2}{2}\big)}=s+re^{i\big(\frac{\zeta_1+\zeta_2}{2}\big)}
$$
A: $\arg(m)$ is just the average of the arguments of $p_1$ and $p_2$, and $m$ lies on the circle with radius $r$ centered at the origin:
$$m=r\exp\left(i\frac{\arg(p_1)+\arg(p_2)}2\right)$$
and just add $s$ to translate it to the circle centered at $s$.
