It's some years since I did math and I can't, for the life of me remember how to solve equations.
I am trying to find the centre of an ellipse from the radii and $2$ points on the ellipse using : $$\frac{(x_A-C_x)^2}{a^2} + \frac{(y_A-C_y)^2}{b^2} = 1$$
where $(x_A,y_A)=A$ and $a$ and $b$ are the semi-major axis and the semi-minor axis. $(C_x,C_y)$ are the coordinates of the centre.
If $x_B$ and $y_B$ are the coordinates of another point on the ellipse, then I get the following: $$\frac{(x_A-C_x)^2}{a^2} + \frac{(y_A-C_y)^2}{b^2} = \frac{(x_B-C_x)^2}{a^2} + \frac{(y_B-C_y)^2}{b^2}$$
Which I can expand:
$b*b*(xa*xa+cx*cx-2*xa*cx)+a*a(ya*ya+cy*cy-2*ya*cy)=b*b*(xb*xb+cx*cx-2*xb*cx)+a*a(yb*yb+cy*cy-2*yb*cy)$
and from there:
$b*b*xa*xa+b*b*cx*cx-2*b*b*xa*cx+a*a*ya*ya+a*a*cy*cy-2*a*a*ya*cy=b*b*xb*xb+b*b*cx*cx-2*b*b*xb*cx+a*a*yb*yb+a*a*cy*cy-2*a*a*yb*cy$
And then
$b*b*xa*xa-2*b*b*xa*cx+a*a*ya*ya-2*a*a*ya*cy=b*b*xb*xb-2*b*b*xb*cx+a*a*yb*yb-2*a*a*yb*cy$
Now what?
I'm damned if I can remember what to do next.
[Edit] I've got down to this: $(a*a*ya*ya-2*a*a*ya*cy-b*b*xb*xb-a*a*yb*yb+2*a*a*yb*cy)/2*b*b*(xa-xb)=cx$, but as far as I can see, I still need to resolve cy before I can work out cx.[/Edit]
PS. This question was mistakenly posted on the Programming section: https://stackoverflow.com/questions/43468181/solving-equations-for-an-ellipse?
Note that centre $C=(X,Y)$ is either one of the intersection for
$$ \left \{ \begin{array}{ccccc} \dfrac{(X-x_A)^2}{a^2}+\dfrac{(Y-y_A)^2}{b^2} & = & 1 & \cdots \cdots & (1) \\ \dfrac{(X-x_B)^2}{a^2}+\dfrac{(Y-y_B)^2}{b^2} & = & 1 & \cdots \cdots & (2) \end{array} \right.$$
The point $C$ also lies on the conjugate diameter w.r.t. chord $AB$ namely
$$ \frac{(X-x_A)^2}{a^2}+\frac{(Y-y_A)^2}{b^2}= \frac{(X-x_B)^2}{a^2}+\frac{(Y-y_B)^2}{b^2}$$
$$ \frac{2(x_A-x_B)X}{a^2}+\frac{2(y_A-y_B)Y}{b^2}= \frac{x_A^2-x_B^2}{a^2}+\frac{y_A^2-y_B^2}{b^2}$$
In principle, it is solvable
$$X=\frac{x_A+x_B}{2} \pm \frac{a(y_A-y_B)}{2b} \sqrt{\frac{4}{\dfrac{(x_A-x_B)^2}{a^2}+\dfrac{(y_A-y_B)^2}{b^2}}-1}$$
$$Y=\frac{y_A+y_B}{2} \mp \frac{b(x_A-x_B)}{2a} \sqrt{\frac{4}{\dfrac{(x_A-x_B)^2}{a^2}+\dfrac{(y_A-y_B)^2}{b^2}}-1}$$