<s>[INST] Finding an angle in a triangle, when the length of one side is unknown and the distances from each vertex to an arbitrary point is known Given the triangle $\triangle ABN$ I would like to find the angle $\angle ANB$. The lengths of $AN$ and $BN$ are known, but the length $AB$ is unknown.
There exists another point $S$ that forms two more triangles $\triangle ANS$ and $\triangle BNS$. The lengths of $NS, AS$ and $BS$ are known. The location of $S$ is arbitrary, it may be inside or outside $\triangle ABN$.
Using these triangles $\angle ANS$ and $\angle BNS$ can be calculated. These can then be used to find $\angle ANB$. However, There are multiple ways to calculate ANB depending on the position of $S$, as shown by these two figures:


I've also come up with other equations that are required when $S$ is in different positions.
Is there a better way to find $\angle ANB$?
If there is not, is there a way to determine which of the equations to use to calculate $\angle ANB$ from $\angle ANS$ and $\angle BNS$?
The coordinates of the four points $A$, $B$, $N$ and $S$ are all unknown.
 [/INST] 
As stated, the problem does not necessarily have a single solution. Example: 
AN = 1.0, BN = 0.65, NS = 0.92, AS = 0.81, BS = 0.35 
B's coordinates can be either {0.45509,0.354363} or 
{0.733145,0.592696}, and the values of angle ANB is different for 
these two sets of coordinates. 
Note that I am using approximate numbers here, but the roundoff errors 
are small enough to be ignored. 
I hope to expand on my answer by providing a closed formula for the 
two possible values of ANB (when they exist).
EDIT: General answer:
Create a Cartesian grid such that $N$ is at the origin, $A$ lies on 
the positive x axis and $S$ lies in the upper half plane. You can 
always do this using translation, rotation, and reflecting without 
affecting any lengths: 

(note that $A$ and $N$ above are flipped from my counterexample 
earlier, as it turns out the calculations are easier with $N$ at the 
origin; I've also replaced the side lengths with lowercase letters 
since I'm using Mathematica to help solve this problem) 
Although I've draw B and S in quadrant I, B can be in any quadrant, 
and S can be in quadrants I or II (since we explicitly chose our axis 
system so that sy > 0). 
We can now find sx and sy by solving the simultaneous equations: 
$\text{sx}^2+\text{sy}^2=d^2$ 
$(\text{sx}-c)^2+\text{sy}^2=e^2$ 
The are two solutions, but only one with sy > 0: 
$  
   \left\{\text{sx}\to \frac{c^2+d^2-e^2}{2 c},\text{sy}\to 
    \sqrt{d^2-\frac{\left(c^2+d^2-e^2\right)^2}{4 c^2}}\right\} 
$ 
We can now solve for bx and by using: 
$(\text{bx}-\text{sx})^2+(\text{by}-\text{sy})^2=f^2$ 
$\text{bx}^2+\text{by}^2=g^2$
and plugging in the values of sx and sy we found earlier, yielding two 
solutions, both valid: 
$ 
   \left\{\text{bx}\to \frac{\left(c^2+d^2-e^2\right) 
    \left(d^2-f^2+g^2\right)+\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) 
    (d+f-g) (d-f+g) (d+f+g)}}{4 c d^2},\text{by}\to -\frac{c^4 
    \left(d^2-f^2+g^2\right)+c^2 \left(\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) 
    (d-f-g) (d+f-g) (d-f+g) (d+f+g)}-2 \left(d^2+e^2\right) 
    \left(d^2-f^2+g^2\right)\right)+(d-e) (d+e) \left(\sqrt{(c-d-e) (c+d-e) 
    (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) (d+f+g)}+(d-e) (d+e) 
    \left(d^2-f^2+g^2\right)\right)}{4 c d^2 \sqrt{-(c-d-e) (c+d-e) (c-d+e) 
    (c+d+e)}}\right\} 
$ 
$ 
   \left\{\text{bx}\to \frac{\left(c^2+d^2-e^2\right) 
    \left(d^2-f^2+g^2\right)-\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) 
    (d+f-g) (d-f+g) (d+f+g)}}{4 c d^2},\text{by}\to \frac{c^4 
    \left(-\left(d^2-f^2+g^2\right)\right)+c^2 \left(\sqrt{(c-d-e) (c+d-e) 
    (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) (d+f+g)}+2 \left(d^2+e^2\right) 
    \left(d^2-f^2+g^2\right)\right)+(d-e) (d+e) \left(\sqrt{(c-d-e) (c+d-e) 
    (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) (d+f+g)}-(d-e) (d+e) 
    \left(d^2-f^2+g^2\right)\right)}{4 c d^2 \sqrt{-(c-d-e) (c+d-e) (c-d+e) 
    (c+d+e)}}\right\} 
$ 
To find ABN, we simply take the arctangent of 
$\frac{\text{by}}{\text{bx}}$. Since the angle will always be between 
0 and 180 degrees (if it's larger than 180 degrees, we measure the 
angle clockwise), we can use the single argument form of arctangent 
(I'd stated incorrectly earlier than we needed the two argument 
form. This yields: 
$ 
   -\tan ^{-1}\left(\frac{c^4 \left(d^2-f^2+g^2\right)+c^2 \left(\sqrt{(c-d-e) 
    (c+d-e) (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) (d+f+g)}-2 
    \left(d^2+e^2\right) \left(d^2-f^2+g^2\right)\right)+(d-e) (d+e) 
    \left(\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) 
   (d+f+g)}+(d-e) (d+e) \left(d^2-f^2+g^2\right)\right)}{\sqrt{-(c-d-e) (c+d-e) 
    (c-d+e) (c+d+e)} \left(\left(c^2+d^2-e^2\right) 
    \left(d^2-f^2+g^2\right)+\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) 
    (d+f-g) (d-f+g) (d+f+g)}\right)}\right) 
$ 
$ 
   \tan ^{-1}\left(\frac{c^4 \left(-\left(d^2-f^2+g^2\right)\right)+c^2 
    \left(\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) 
    (d+f+g)}+2 \left(d^2+e^2\right) \left(d^2-f^2+g^2\right)\right)+(d-e) (d+e) 
    \left(\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) (d+f-g) (d-f+g) 
   (d+f+g)}-(d-e) (d+e) \left(d^2-f^2+g^2\right)\right)}{\sqrt{-(c-d-e) (c+d-e) 
    (c-d+e) (c+d+e)} \left(\left(c^2+d^2-e^2\right) 
    \left(d^2-f^2+g^2\right)-\sqrt{(c-d-e) (c+d-e) (c-d+e) (c+d+e) (d-f-g) 
    (d+f-g) (d-f+g) (d+f+g)}\right)}\right) 
$ 
Mathematica can't find a simpler form for the answer, and I'm not sure 
how useful the above is, but there you have it. 
Note that I assume the triangle inequality throughout. When the 
triangle inequality doesn't hold, some of the square roots above are 
of negative values, and thus have no real number solutions. 
</s>