The general solution isn't bad at all. It just needs a little
simplification.
eqs: [ (y1-b)^2+(x1-a)^2 = r^2 ,
(y2-b)^2+(x2-a)^2 = r^2 ,
(y3-b)^2+(x3-a)^2 = r^2 ] $
sols: solve( eqs, [a,b,r] ) $
Now length(sols) = 2, that is, there are two solutions.
Let's look at the first solution, sols[1]. It's big. But in fact
Part(sols[1],1) -- the value for A -- doesn't look so bad. Neither
does Part(sols[1],2) -- the value for B.
It's only part(sols[1],3) -- the value for R -- that is big. So let's
massage it.
rval: rhs(part(sols[1],3))$
or more simply (but perhaps less clearly):
rval: part(sols,1,3,2);
Now let's try factoring it:
factor(rval)
... already much smaller
But we can do better:
scanmap(factorsum,rval) gives us a nice compact form:
2 2 2 2 2 2
SQRT((y2 - y1) + (x2 - x1) ) SQRT((y3 - y1) + (x3 - x1) ) SQRT((y3 - y2) + (x3 - x2) )
- -----------------------------------------------------------------------------------------
2 (x2 y3 - x1 y3 - x3 y2 + x1 y2 + (x3 - x2) y1)
Unfortunately, Maxima doesn't do a very good job of displaying this on
a narrow monitor.
Here is a manually reformatted version which shows the symmetry of the
solution nicely:
2 2
SQRT((y2 - y1) + (x2 - x1) ) *
2 2
SQRT((y3 - y1) + (x3 - x1) ) *
2 2
SQRT((y3 - y2) + (x3 - x2) )
- ----------------------------------------------
2 (x2 y3 - x1 y3 - x3 y2 + x1 y2 + (x3 - x2) y1)
The numerator is very nicely symmetric.
Now, let's look at the values for a and b.
aval: part(sols,1,1,2)$
bval: part(sols,1,2,2)$
Well, their denominators are nicely symmetric, and hmm, look a lot
like rval's denominator. Is it in fact the same thing? Let's see:
ratdenom(rval)-ratdenom(aval) => 0
sure enough! So substitute that in (though I can't figure out any
easy way to factor out the "2" without destroying the structure of the
expression ... any ideas?).
By looking at the existing symmetries in bval and extending them to
the rest of the expression, we find that it is:
2 2 2
(x2 - x1) y3 + (x1 - x3) y2 + (x3 - x2) y1 +
2 2 2
(x2 - x1) x3 + (x3 - x2) x1 + (x1 - x3) x2
and with a little more manipulation, we get:
2 2 2 2 2 2
(x2 - x1) (y3 + x3 ) - (x3 - x1) (y2 + x2 ) + (x3 - x2) (y1 + x1 )
Isn't that pretty?
-s