with(linalg): xa1:= -9:ya1:=9:xa2:=9:ya2:=9: xa3:=12:ya3:=-3:xa4:=3:ya4:=-13: xa5:=-3:ya5:=-13:xa6:=-12:ya6:=-3: xb1:= -3:yb1:=7:xb2:=3:yb2:=7: xb3:=7:yb3:=-1:xb4:=4:yb4:=-6: xb5:=-4:yb5:=-6:xb6:=-7:yb6:=-1: rot:=array([[cos(p)*cos(h)-sin(p)*cos(t)*sin(h) ,-cos(p)*sin(h)-sin(p)*cos(t)*cos(h), sin(p)*sin(t)],[sin(p)*cos(h)+cos(p)*cos(t)*sin(h), -sin(p)*sin(h)+cos(p)*cos(t)*cos(h),-cos(p)*sin(t)], [sin(t)*sin(h),sin(t)*cos(h),cos(t)]]): for i from 1 to 6 do OA.i:=array([xa.i,ya.i,0]): CBr.i:=array([xb.i,yb.i,0]): CB.i:=multiply(rot,CBr.i): od: cen:=array([x,y,z]): for i from 1 to 6 do AB.i:=evalm(cen-OA.i+CB.i): ro.i:=dotprod(AB.i,AB.i,`orthogonal`): ro.i:=simplify(ro.i,trig): od: for i from 1 to 6 do eq.i:=ro.i-60^2: od: er1:=eq2-eq1:er2:=eq3-eq1:er3:=eq4-eq1:er4:=eq5-eq1:er5:=eq6-eq1: sw:=solve({er1,er2,er3},{x,y,z}): assign(sw): en1:=numer(eq1):en2:=numer(er4):en3:=numer(er5): for i from 1 to 3 do en.i:=simplify(en.i,trig): en.i:=convert(en.i,horner,[sin(p),cos(p),sin(t),cos(t),sin(h),cos(h)]): od:We are looking for a solution in the domain:
Here we may use the general solving algorithm (section 2.3), the general solving algorithm with the gradient (section 2.4), the general solving algorithm with the gradient and Hessian (section 2.5).
These algorithms are implemented in the test program Test_Solve_General, Test_Solve_Gradient_General, Test_Solve_JH_General (in that later case Kantorovitch theorem is applied only at level 1).