NB.I propose this solution. The posted solutions are algebraic.
NB. amoeba is the simplex optimization method found at www.jsoftware.com require'amoeba'['/usr/local/j64-602/addons/math/misc/amoeba.ijs' NB. y is Cx0 Cy0 R0 Cx1 Cy1 R1 Cx2 Cy2 R2 NB. x are radius scale factors to control which circles are included NB. in the common tangent circle. 1 to surround, _1 to exclude. NB. returns (center, radius); final simplex volume apollonius =: 3 :0 1 apollonius y : a=.9$0 0 1 NB. boolean selection vector c=.3 2$(-.a)#,y NB. centers r=.x*a#,y NB. radii v=.1e_20 NB. goal simplex volume NB. scale the problem rather than the volume? d=:r 2 : 'm + [: +/"1&.:*: n -"1 ]' c NB. distances to tangents s=.([: +/ [: *:@, -/~@:d) amoeba v c NB. solution avg =. +/ % # ((, avg@:d)&.:>@:{. , {:)s ) NB. all 8 solutions (<:+:#:i.8)apollonius"1 _ ] _1 1 1,4 2 2,:1 _3 3 NB........graphical demonstration........... load'graph' p0 =: 1,.~|:2 1 o./ 2p1 * (i. % <:) 80 draw =: 4 : 0 gdclose name=:'apollo' gdopen name gdcolor GREEN gdpolygon ,/"2 p0(+/ .*)("_ _1)0.1*((0 1,3 4,:6 7){,y),"2 1~(2 5 8{,y)*/=i.2 gdcolor RED gdlines ,p0+/ .*0.1*(2{.,x),~({:,x)*=i.2 gdshow name ) (draw~ >@{.@:((-_1 1 1)&apollonius))_1 1 1,4 2 2,:1 _3 3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm