Re: Sphere formula

*To*: mathgroup at smc.vnet.net*Subject*: [mg109499] Re: Sphere formula*From*: "Alexander Elkins" <alexander_elkins at hotmail.com>*Date*: Sat, 1 May 2010 06:50:52 -0400 (EDT)*References*: <hr65rj$jq6$1@smc.vnet.net> <hrbach$hq9$1@smc.vnet.net>

"S. B. Gray" <stevebg at ROADRUNNER.COM> wrote in message news:hrbach$hq9$1 at smc.vnet.net... > On 4/27/2010 1:05 AM, S. B. Gray wrote: > > 1. The center of a sphere through 4 points has a very nice determinant > > form. (http://mathworld.wolfram.com/Sphere.html) What I want is a nice > > formula for the center of a sphere through 3 points, where the center is > > in the plane of the three points. I have a formula but it's a horrible > > mess of hundreds of lines, even after FullSimplify. > > > > 2. (Unlikely) Is there a way to get Mathematica to put a long formula into a > > matrix/determinant form if there is a nice one? > > > > Any tips will be appreciated. > > > > Steve Gray > > > Thanks to everyone who answered my question, but there is a simpler > answer. I forgot the simple fact that any linear combination of two > vectors lies in the plane of the two vectors. > > Let the three points be p1,p2,p3. Consider the linear function > p=b(p2-p1)+c(p3-p1) where b,c are to be determined and p is the desired > center. Now do > > Solve[{Norm(p-p1)==Norm(p-p2),Norm(p-p1)==Norm(p-p3)},{b,c}]. > > This gives b,c and therefore p, which will be equidistant from p1,p2, > and p3 and lie in their plane. Very simple. (I used (p-p1).(p-p1) etc. > instead of Norm.) > > Steve Gray Unless I misinterpreted something in this posting, the following does not give the expected center point {1, 2, 3} using Ray Koopman' s posted values for {p1, p2, p3} as the result: In[1]:=With[{p1={0.018473,-1.1359,-0.768653},p2={2.51514,5.25315,6.48158}, p3={0.818313,-0.881007,-1.0825}}, With[{p=b(p2-p1)+c(p3-p1)}, p/.NSolve[{(p-p1).(p-p1)==(p-p2).(p-p2),(p-p1).(p-p1)==(p-p3).(p-p3)},{b,c}] ]] Out[1]={{0.797494,2.34596,2.76487}} Another test using a random center point and Ray Koopman's method of selecting three random points also does not match the expected value: In[2]:=Module[{pc=RandomReal[{-10,10},3], r=5Orthogonalize@RandomReal[NormalDistribution[0,1],{3,3}], p1,p2,p3},{p1,p2,p3}= Table[{Cos@#,Sin@#,0}&@RandomReal[{-Pi,Pi}].r+pc,{3}]; {pc, #, pc == #} &[With[{p=b(p2-p1)+c(p3-p1)}, p/.NSolve[{(p-p1).(p-p1)==(p-p2).(p-p2),(p-p1).(p-p1)==(p-p3).(p-p3)},{b,c}] ]]] Out[2]={{-7.4099,3.28674,-3.24279},{{-6.53281,-1.33034,-3.11019}},False}