Algebraic Geodesy and Geoinformatics - 2009 - PART II APPLICATIONS 16 Conformal Mapping Overview First, the 3- point problem is discussed. A preliminary elimination of the translation vector reduces the size of system to 4 polynomial equations. This system can be solved in symbolic way, either with Dixon resultant or with reduced Groebner basis, both methods result in the same quartic univariate polynomial. Concerning numerical solution Extended NewtonRaphson method can be employed to solve all of the 9 equations in least square sense, utilizing the symbolic solution of any 7 equations as initial guess. For N- point problem Gauss- Jacobi solution improved by Extended Newton- Raphson method is very attractive. However, the General Procrustes algorithm is the fastest and precise as the direct global minimization technique requiring about 5 times longer computation time, than the General Procrustes. All numerical data of the examples are from the text book. 16- 1 Problem definition Let us consider coordinates given in two systems A and B. The coordinates of the same physical point, Pi in system A are (Xi , Yi , Zi ) , while its corresponding coordinates in system B are (xi , yi , zi ). We suppose that the relation between the two systems can be described by conformal mapping, namely Xi X0 xi yi = s R Yi + Y0 zi Zi Z0 This formula represents 3 elementary transformations, - scaling, with positive, real s, X0 - translation, with vector Y0 , Z0 - rotation, with matrix R. The rotation matrix, R can be expressed by the skew matrix, S R = HI3 - SL-1 HI3 + SL where Clear@"Global‘*"D 2 ConformalMapping_16.nb S= 0 -c b c 0 -a ; -b a 0 and I3 = IdentityMatrix @3D; Then the rotation matrix, R = Inverse@HI3 - SLD .HI3 + SL Simplify; MatrixForm@RD 1+a2 -b2 -c2 2 a b-2 c 2 Hb+a cL 1+a2 +b2 +c2 1+a2 +b2 +c2 2 Ha b+cL 1+a2 +b2 +c2 1+a2 +b2 +c2 2 H-b+a cL 1+a2 +b2 +c2 2 Ha+b cL 1-a2 -b2 +c2 1+a2 +b2 +c2 1+a2 +b2 +c2 1+a2 +b2 +c2 1-a2 +b2 -c2 - 2 Ha-b cL 1+a2 +b2 +c2 which satisfies the following relation, I3 == R.Transpose@RD Simplify True The transformation has 7 parameters, (a, b, c, X0 , Y0 , Z0 , s) and to determine them, we need the coordinates of minimum 3 points in both systems (3 -Point Problem). The prototype equation for a point, Pi , f3 i-2 f3 i-1 f3 i xi = HI3 - SL. yi zi Xi - s HI3 + SL. Yi Zi X0 - HI3 - SL. Y0 Z0 xi - X0 - s Xi + c yi - c Y0 + c s Yi - b zi + b Z0 - b s Zi - c xi + c X0 - c s Xi + yi - Y0 - s Yi + a zi - a Z0 + a s Zi b xi - b X0 + b s Xi - a yi + a Y0 - a s Yi + zi - Z0 - s Zi Then for i = 1 f1 f2 f3 = f3 i-2 f3 i-1 f3 i . i ® 1 Expand; f1 MatrixFormB f2 F f3 x1 - X0 - s X1 + c y1 - c Y0 + c s Y1 - b z1 + b Z0 - b s Z1 - c x1 + c X0 - c s X1 + y1 - Y0 - s Y1 + a z1 - a Z0 + a s Z1 b x1 - b X0 + b s X1 - a y1 + a Y0 - a s Y1 + z1 - Z0 - s Z1 for i = 2 f4 f5 f6 = f3 i-2 f3 i-1 f3 i . i ® 2 Expand; f4 MatrixFormB f5 F f6 x2 - X0 - s X2 + c y2 - c Y0 + c s Y2 - b z2 + b Z0 - b s Z2 - c x2 + c X0 - c s X2 + y2 - Y0 - s Y2 + a z2 - a Z0 + a s Z2 b x2 - b X0 + b s X2 - a y2 + a Y0 - a s Y2 + z2 - Z0 - s Z2 for i = 3 f3 i-2 Expand; MatrixFormB f3 i-1 F f3 i ConformalMapping_16.nb f7 f8 f9 = f3 i-2 f3 i-1 f3 i . i ® 3 Expand; f7 MatrixFormB f8 F f9 x3 - X0 - s X3 + c y3 - c Y0 + c s Y3 - b z3 + b Z0 - b s Z3 - c x3 + c X0 - c s X3 + y3 - Y0 - s Y3 + a z3 - a Z0 + a s Z3 b x3 - b X0 + b s X3 - a y3 + a Y0 - a s Y3 + z3 - Z0 - s Z3 Translation parameters, (X0 , Y0 , Z0 ) can be eliminated by differencing, f14 = f1 - f4 Simplify x1 - x2 - s X1 + s X2 + c y1 - c y2 + c s Y1 - c s Y2 - b z1 + b z2 - b s Z1 + b s Z2 f25 = f2 - f5 Simplify - c x1 + c x2 - c s X1 + c s X2 + y1 - y2 - s Y1 + s Y2 + a z1 - a z2 + a s Z1 - a s Z2 f39 = f3 - f9 Simplify b x1 - b x3 + b s X1 - b s X3 - a y1 + a y3 - a s Y1 + a s Y3 + z1 - z3 - s Z1 + s Z3 f69 = f6 - f9 Simplify b x2 - b x3 + b s X2 - b s X3 - a y2 + a y3 - a s Y2 + a s Y3 + z2 - z3 - s Z2 + s Z3 Now, we have four equations and four unknown parameters (a, b, c, s). The nonlinearity is represented by the variable s only. Let us introduce new variables, newvars = 8x12 ® z12 ® z1 - z2 , X12 ® X1 - X2 , Y12 ® Y1 - Y2 , Z12 ® Z1 - Z2 , x1 - x2 , x13 ® z13 ® z1 - z3 , X13 ® X1 - X3 , Y13 ® Y1 - Y3 , Z13 ® Z1 - Z3 , x1 - x3 , x23 ® x2 - x3 , y12 ® y1 - y2 , y13 ® y1 - y3 , y23 ® y2 - y3 , z23 ® z2 - z3 , X23 ® X2 - X3 , Y23 ® Y2 - Y3 , Z23 ® Z2 - Z3 <; Then our system becomes, sys = 8x12 - s X12 + c y12 + c s Y12 - b z12 - b s Z12, - c x12 - c s X12 + y12 - s Y12 + a z12 + a s Z12, b x13 + b s X13 - a y13 - a s Y13 + z13 - s Z13, b x23 + b s X23 - a y23 - a s Y23 + z23 - s Z23<; Let us check it, 8f14 , f25 , f39 , f69 < - sys . newvars Simplify 80, 0, 0, 0< 16- 2 Symbolic solution 16- 2- 1 Dixon Resultant << Resultant‘Dixon‘ We eliminate the linear parameters, a, b, and c, in order to get an univariate polynomial of s, 3 4 ConformalMapping_16.nb AbsoluteTiming @solsdx = DixonResultant @sys, 8a, b, c<, 8U, V, W<D Simplify;D 80.5781250, Null< solsdx x122 I- x23 Hy13 + s Y13L + x13 y23 + s H- X23 y13 + X13 y23 + x13 Y23L + s2 H- X23 Y13 + X13 Y23LM + y12 H- x23 Hy12 y13 + z12 z13L + x13 Hy12 y23 + z12 z23LL + s IX13 y122 y23 + x13 y122 Y23 + X12 y23 z12 z13 - X23 y12 Hy12 y13 + z12 z13L - x23 Iy122 Y13 + Y12 z12 z13 + y12 Z12 z13 - y12 z12 Z13M + X13 y12 z12 z23 + x13 Y12 z12 z23 - X12 y13 z12 z23 + x13 y12 Z12 z23 - x13 y12 z12 Z23M + x12 Hz12 + s Z12L Iy23 Hz13 - s Z13L - y13 z23 + s HY23 z13 - Y13 z23 + y13 Z23L + s2 H- Y23 Z13 + Y13 Z23LM + s2 I- X23 y122 Y13 - x13 Y122 y23 + X122 Hx23 y13 - x13 y23L + X13 y122 Y23 - X23 Y12 z12 z13 - X23 y12 Z12 z13 + X23 y12 z12 Z13 + x23 IY122 y13 - Y12 Z12 z13 + Y12 z12 Z13 + y12 Z12 Z13M + X13 Y12 z12 z23 + X13 y12 Z12 z23 + x13 Y12 Z12 z23 - X13 y12 z12 Z23 - x13 Y12 z12 Z23 - x13 y12 Z12 Z23 + X12 HY23 z12 z13 + y23 Z12 z13 - y23 z12 Z13 - Y13 z12 z23 - y13 Z12 z23 + y13 z12 Z23LM + s3 Ix23 Y122 Y13 - X13 Y122 y23 - x13 Y122 Y23 + X122 HX23 y13 + x23 Y13 - X13 y23 - x13 Y23L + x23 Y12 Z12 Z13 + X23 IY122 y13 - Y12 Z12 z13 + Y12 z12 Z13 + y12 Z12 Z13M + X13 Y12 Z12 z23 - X13 Y12 z12 Z23 - X13 y12 Z12 Z23 - x13 Y12 Z12 Z23 + X12 HY23 Z12 z13 - Y23 z12 Z13 - y23 Z12 Z13 - Y13 Z12 z23 + Y13 z12 Z23 + y13 Z12 Z23LM + s4 IX122 HX23 Y13 - X13 Y23L + X12 H- Y23 Z12 Z13 + Y13 Z12 Z23L + Y12 HX23 HY12 Y13 + Z12 Z13L - X13 HY12 Y23 + Z12 Z23LLM The result is a quartic polynomial of s, Exponent[solsdx, {s,a,b,c}] 84, 0, 0, 0< The coeffients, q0s = Coefficient@solsdx, s, 0D Simplify x122 H- x23 y13 + x13 y23L + x12 z12 Hy23 z13 - y13 z23L + y12 H- x23 Hy12 y13 + z12 z13L + x13 Hy12 y23 + z12 z23LL q1s = Coefficient@solsdx, sD Simplify - x23 y122 Y13 + X13 y122 y23 + x13 y122 Y23 + x122 H- X23 y13 - x23 Y13 + X13 y23 + x13 Y23L x23 Y12 z12 z13 + X12 y23 z12 z13 - x23 y12 Z12 z13 - X23 y12 Hy12 y13 + z12 z13L + x23 y12 z12 Z13 + X13 y12 z12 z23 + x13 Y12 z12 z23 - X12 y13 z12 z23 + x13 y12 Z12 z23 - x13 y12 z12 Z23 + x12 HY23 z12 z13 + y23 Z12 z13 - y23 z12 Z13 - Y13 z12 z23 - y13 Z12 z23 + y13 z12 Z23L q2s = CoefficientAsolsdx, s2 E Simplify - x122 X23 Y13 - X23 y122 Y13 - x13 Y122 y23 + X122 Hx23 y13 - x13 y23L + x122 X13 Y23 + X13 y122 Y23 - X23 Y12 z12 z13 - X23 y12 Z12 z13 + x12 Y23 Z12 z13 + X23 y12 z12 Z13 x12 Y23 z12 Z13 - x12 y23 Z12 Z13 + x23 IY122 y13 - Y12 Z12 z13 + Y12 z12 Z13 + y12 Z12 Z13M + X13 Y12 z12 z23 + X13 y12 Z12 z23 + x13 Y12 Z12 z23 - x12 Y13 Z12 z23 X13 y12 z12 Z23 - x13 Y12 z12 Z23 + x12 Y13 z12 Z23 - x13 y12 Z12 Z23 + x12 y13 Z12 Z23 + X12 HY23 z12 z13 + y23 Z12 z13 - y23 z12 Z13 - Y13 z12 z23 - y13 Z12 z23 + y13 z12 Z23L q3s = CoefficientAsolsdx, s3 E Simplify x23 Y122 Y13 - X13 Y122 y23 - x13 Y122 Y23 + X122 HX23 y13 + x23 Y13 - X13 y23 - x13 Y23L + x23 Y12 Z12 Z13 - x12 Y23 Z12 Z13 + X23 IY122 y13 - Y12 Z12 z13 + Y12 z12 Z13 + y12 Z12 Z13M + X13 Y12 Z12 z23 - X13 Y12 z12 Z23 - X13 y12 Z12 Z23 - x13 Y12 Z12 Z23 + x12 Y13 Z12 Z23 + X12 HY23 Z12 z13 - Y23 z12 Z13 - y23 Z12 Z13 - Y13 Z12 z23 + Y13 z12 Z23 + y13 Z12 Z23L ConformalMapping_16.nb q4s = CoefficientAsolsdx, s4 E Simplify X122 HX23 Y13 - X13 Y23L + X12 H- Y23 Z12 Z13 + Y13 Z12 Z23L + Y12 HX23 HY12 Y13 + Z12 Z13L - X13 HY12 Y23 + Z12 Z23LL Let us check the result, solsdx == q4s s4 + q3s s3 + q2s s2 + q1s s + q0s Simplify True The other parameters can be computed as function of the nonlinear parameter s. The first equation does not contain the parameter a, Map@Exponent@ð, 8a, b, c<D &, sysD 880, 1, 1<, 81, 0, 1<, 81, 1, 0<, 81, 1, 0<< Therefore, we do not take it into consideration when computing a, soladx = DixonResultant @Drop@sys, 81, 1<D, 8b, c<, 8V, W<D Simplify Hx12 + s X12L Ia Is X23 y13 + s2 X23 Y13 + x23 Hy13 + s Y13L - x13 y23 - s X13 y23 - s x13 Y23 - s2 X13 Y23M x23 z13 - s X23 z13 + s x23 Z13 + s2 X23 Z13 + x13 z23 + s X13 z23 - s x13 Z23 - s2 X13 Z23M Similarly, we leave out equations, which does not contain the corresponding parameter in case of b, solbdx = DixonResultant @Drop@sys, 82, 2<D, 8a, c<, 8U, W<D Simplify Hy12 + s Y12L Ib Is X23 y13 + s2 X23 Y13 + x23 Hy13 + s Y13L - x13 y23 - s X13 y23 - s x13 Y23 - s2 X13 Y23M y23 z13 - s Y23 z13 + s y23 Z13 + s2 Y23 Z13 + y13 z23 + s Y13 z23 - s y13 Z23 - s2 Y13 Z23M and c, solcdx = DixonResultant @Drop@sys, 83, 3<D, 8a, b<, 8U, V<D Simplify Hz12 + s Z12L Ic x23 y12 + y12 y23 + x12 Hx23 + s X23 - c y23 - c s Y23L + z12 z23 + s Hc X23 y12 + c x23 Y12 - Y12 y23 - X12 Hx23 + c y23L + y12 Y23 + Z12 z23 - z12 Z23L s2 H- c X23 Y12 + Y12 Y23 + X12 HX23 + c Y23L + Z12 Z23LM 16- 2- 2 Reduced Groebner Basis The similar result can be achieved by reduced Groebner basis. AbsoluteTiming @8solsgb< = GroebnerBasis @sys, 8s, a, b, c<, 8a, b, c<D Simplify;D 815.2656250, Null< 5 6 ConformalMapping_16.nb solsgb x122 Is X23 y13 + s2 X23 Y13 + x23 Hy13 + s Y13L - x13 y23 - s X13 y23 - s x13 Y23 - s2 X13 Y23M + y12 Hx23 Hy12 y13 + z12 z13L - x13 Hy12 y23 + z12 z23LL + s I- X13 y122 y23 - x13 y122 Y23 - X12 y23 z12 z13 + X23 y12 Hy12 y13 + z12 z13L + x23 Iy122 Y13 + Y12 z12 z13 + y12 Z12 z13 - y12 z12 Z13M - X13 y12 z12 z23 - x13 Y12 z12 z23 + X12 y13 z12 z23 - x13 y12 Z12 z23 + x13 y12 z12 Z23M + x12 Hz12 + s Z12L Iy23 H- z13 + s Z13L + y13 z23 - s HY23 z13 - Y13 z23 + y13 Z23L + s2 HY23 Z13 - Y13 Z23LM + s2 IX23 y122 Y13 + x13 Y122 y23 + X122 H- x23 y13 + x13 y23L - X13 y122 Y23 + X23 Y12 z12 z13 + X23 y12 Z12 z13 - X23 y12 z12 Z13 x23 IY122 y13 - Y12 Z12 z13 + Y12 z12 Z13 + y12 Z12 Z13M - X13 Y12 z12 z23 X13 y12 Z12 z23 - x13 Y12 Z12 z23 + X13 y12 z12 Z23 + x13 Y12 z12 Z23 + x13 y12 Z12 Z23 + X12 H- Y23 z12 z13 - y23 Z12 z13 + y23 z12 Z13 + Y13 z12 z23 + y13 Z12 z23 - y13 z12 Z23LM + s3 I- x23 Y122 Y13 + X13 Y122 y23 + x13 Y122 Y23 + X122 H- X23 y13 - x23 Y13 + X13 y23 + x13 Y23L x23 Y12 Z12 Z13 - X23 IY122 y13 - Y12 Z12 z13 + Y12 z12 Z13 + y12 Z12 Z13M - X13 Y12 Z12 z23 + X13 Y12 z12 Z23 + X13 y12 Z12 Z23 + x13 Y12 Z12 Z23 + X12 H- Y23 Z12 z13 + Y23 z12 Z13 + y23 Z12 Z13 + Y13 Z12 z23 - Y13 z12 Z23 - y13 Z12 Z23LM + s4 IX122 H- X23 Y13 + X13 Y23L + X12 Z12 HY23 Z13 - Y13 Z23L + Y12 H- X23 HY12 Y13 + Z12 Z13L + X13 HY12 Y23 + Z12 Z23LLM This is the same result as the result of the Dixon resultant, but the computation time is considerably longer. solsgb - solsdx Simplify True The determination of the other parameters are similar. Again, we consider the parameter s as a constant parameter, 8solagb< = GroebnerBasis @Drop@sys, 81, 1<D, 8a, b, c<, 8b, c<D 9- a x23 y13 - a s X23 y13 - a s x23 Y13 - a s2 X23 Y13 + a x13 y23 + a s X13 y23 + a s x13 Y23 + a s2 X13 Y23 + x23 z13 + s X23 z13 s x23 Z13 - s2 X23 Z13 - x13 z23 - s X13 z23 + s x13 Z23 + s2 X13 Z23= The Dixon solution has two factors. The reduced Groebner basis gives the second one, solagb - soladx@@2DD Simplify True Similarly 8solbgb< = GroebnerBasis @Drop@sys, 82, 2<D, 8a, b, c<, 8a, c<D 9- b x23 y13 - b s X23 y13 - b s x23 Y13 - b s2 X23 Y13 + b x13 y23 + b s X13 y23 + b s x13 Y23 + b s2 X13 Y23 + y23 z13 + s Y23 z13 s y23 Z13 - s2 Y23 Z13 - y13 z23 - s Y13 z23 + s y13 Z23 + s2 Y13 Z23= solbgb - solbdx@@2DD Simplify True 8solcgb< = GroebnerBasis @Drop@sys, 83, 3<D, 8a, b, c<, 8a, b<D 9- x12 x23 + s X12 x23 - s x12 X23 + s2 X12 X23 - c x23 y12 - c s X23 y12 c s x23 Y12 - c s2 X23 Y12 + c x12 y23 + c s X12 y23 - y12 y23 + s Y12 y23 + c s x12 Y23 + c s2 X12 Y23 - s y12 Y23 + s2 Y12 Y23 - z12 z23 - s Z12 z23 + s z12 Z23 + s2 Z12 Z23= ConformalMapping_16.nb solcgb - solcdx@@2DD Simplify True 16- 2- 3 Computation of the translation vector The translation vector can be computed from the original system consisting of 9 equations, sysO = Table@fi , 8i, 1, 9<D 8x1 - X0 - s X1 + c y1 - c Y0 + c s Y1 - b z1 + b Z0 - b s Z1 , - c x1 + c X0 - c s X1 + y1 - Y0 - s Y1 + a z1 - a Z0 + a s Z1 , b x1 - b X0 + b s X1 - a y1 + a Y0 - a s Y1 + z1 - Z0 - s Z1 , x2 - X0 - s X2 + c y2 - c Y0 + c s Y2 - b z2 + b Z0 - b s Z2 , - c x2 + c X0 - c s X2 + y2 - Y0 - s Y2 + a z2 - a Z0 + a s Z2 , b x2 - b X0 + b s X2 - a y2 + a Y0 - a s Y2 + z2 - Z0 - s Z2 , x3 - X0 - s X3 + c y3 - c Y0 + c s Y3 - b z3 + b Z0 - b s Z3 , - c x3 + c X0 - c s X3 + y3 - Y0 - s Y3 + a z3 - a Z0 + a s Z3 , b x3 - b X0 + b s X3 - a y3 + a Y0 - a s Y3 + z3 - Z0 - s Z3 < Concerning the translation parameters, we have only 3 unknown parameters, but 9 equations. The translation vector, X0 Xi Αi xi Y0 = yi - s R Yi = Βi Γi zi Z0 Zi for i = 1, 2, 3. Therefore the coefficient matrix has special structure, 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 X0 Y0 Z0 Α1 Β1 Γ1 Α2 = Β2 Γ2 Α3 Β3 Γ3 namely A = Flatten@Table@IdentityMatrix @3D, 83<D, 1D; MatrixForm@AD 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 the pseudoinverze of A, 7 8 ConformalMapping_16.nb pIA = PseudoInverse @AD; pIA MatrixForm 1 1 0 0 3 1 0 3 0 0 3 1 0 0 0 0 1 3 0 0 3 1 0 0 3 1 0 0 1 3 3 0 0 0 1 3 Therefore, the least square solution is a simple averaging, see Gauss-Jacobi combinatorial solution, see Chapter 7. The solution, Α1 Β1 Γ1 Α2 pIA. Β2 Γ2 Α3 Β3 Γ3 :: Α1 3 + Α2 + 3 Α3 3 >, : Β1 3 + Β2 3 + Β3 3 >, : Γ1 3 + Γ2 3 + Γ3 3 >> or in detailed form, 1 solXYZ0 = 3 :: 3 I1 + x1 y1 z1 X1 - s R. Y1 Z1 1 a2 + b2 + c2 M + x2 y2 z2 X2 - s R. Y2 Z2 + x3 y3 z3 X3 - s R. Y3 Z3 Simplify II1 + a2 + b2 + c2 M x1 + I1 + a2 + b2 + c2 M x2 + x3 + a2 x3 + b2 x3 + c2 x3 - s X1 - a2 s X1 + b2 s X1 + c2 s X1 - s X2 - a2 s X2 + b2 s X2 + c2 s X2 - s X3 - a2 s X3 + b2 s X3 + c2 s X3 - 2 a b s Y1 + 2 c s Y1 - 2 a b s Y2 + 2 c s Y2 - 2 a b s Y3 + 2 c s Y3 - 2 b s Z1 - 2 a c s Z1 - 2 b s Z2 - 2 a c s Z2 - 2 b s Z3 - 2 a c s Z3 M>, : 3 I1 + 1 a2 + b2 + c2 M I- 2 Ha b + cL s X1 - 2 Ha b + cL s X2 - 2 a b s X3 - 2 c s X3 + y1 + a2 y1 + b2 y1 + c2 y1 + y2 + a2 y2 + b2 y2 + c2 y2 + y3 + a2 y3 + b2 y3 + c2 y3 - s Y1 + a2 s Y1 - b2 s Y1 + c2 s Y1 - s Y2 + a2 s Y2 - b2 s Y2 + c2 s Y2 - s Y3 + a2 s Y3 - b2 s Y3 + c2 s Y3 + 2 a s Z1 - 2 b c s Z1 + 2 a s Z2 - 2 b c s Z2 + 2 a s Z3 - 2 b c s Z3 M>, : 1 3 I1 + a2 + b2 + c2 M I2 Hb - a cL s X1 + 2 Hb - a cL s X2 + 2 b s X3 - 2 a c s X3 - 2 a s Y1 - 2 b c s Y1 - 2 a s Y2 - 2 b c s Y2 - 2 a s Y3 - 2 b c s Y3 + z1 + a2 z1 + b2 z1 + c2 z1 + z2 + a2 z2 + b2 z2 + c2 z2 + z3 + a2 z3 + b2 z3 + c2 z3 - s Z1 + a2 s Z1 + b2 s Z1 c2 s Z1 - s Z2 + a2 s Z2 + b2 s Z2 - c2 s Z2 - s Z3 + a2 s Z3 + b2 s Z3 - c2 s Z3 M>> 16- 3 Numerical Example for the 3-Point Problem Let us consider the following data of 3 physical points, dataC3 = X2 -> X3 -> x1 -> x2 -> x3 -> 8X1 -> 423.09, Y1 -> 500.42, Z1 -> 800.02, 423.78, Y2 -> 766.61, Z2 -> 379.80, 465.59, Y3 -> 267.41, Z3 -> 367.23, 183.00, y1 -> 500.40, z1 -> 800.02, 181.53, y2 -> 749.31, z2 -> 402.84, 223.76, y3 -> 279.16, z3 -> 393.28<; Let us compute the parameter s. The quartic polynomial for s, ConformalMapping_16.nb Let us compute the parameter s. The quartic polynomial for s, eqs = s4 q4s + s3 q3s + s2 q2s + s q1s + q0s . newvars . dataC3 - 2.15763 ´ 109 - 4.66636 ´ 109 s - 9.09524 ´ 107 s2 + 5.25536 ´ 109 s3 + 2.83912 ´ 109 s4 Let us normalize it, eqs = eqs Coefficient@eqs, s, 4D Expand - 0.759966 - 1.6436 s - 0.0320354 s2 + 1.85105 s3 + 1. s4 The roots, sols = NSolve@eqs, sD Flatten 8s ® - 0.952173, s ® - 0.942298, s ® - 0.89888, s ® 0.942298< The admissible solution should be positive, real, s0 = Select@sols, Im@ð@@2DDD 0 ì ð@@2DD > 0 &D 8s ® 0.942298< The elements of the skew matrix can be directly computed from the symbolic result, for example let us take the result of the Dixon resultant, a0 = Solve@Hsoladx . newvarsL 0, aD Simplify 99a ® I- s X2 z1 + s X3 z1 + x1 z2 + s X1 z2 - s X3 z2 x1 z3 - s X1 z3 + s X2 z3 + s2 X2 Z1 - s2 X3 Z1 - s x1 Z2 - s2 X1 Z2 + s2 X3 Z2 + x3 Hz1 - z2 - s Z1 + s Z2 L + s x1 Z3 + s2 X1 Z3 - s2 X2 Z3 + x2 H- z1 + z3 + s Z1 - s Z3 LM I- s X2 y1 + s X3 y1 + x1 y2 + s X1 y2 - s X3 y2 - x1 y3 - s X1 y3 + s X2 y3 - s2 X2 Y1 + s2 X3 Y1 + s x1 Y2 + s2 X1 Y2 - s2 X3 Y2 + x3 Hy1 - y2 + s Y1 - s Y2 L s x1 Y3 - s2 X1 Y3 + s2 X2 Y3 + x2 H- y1 + y3 - s Y1 + s Y3 LM== then a0 = a0 . s0 . dataC3 Flatten 8a ® - 0.00241637< similarly b0 = Solve@Hsolbdx . newvarsL 0, bD Simplify 99b ® I- s Y2 z1 + s Y3 z1 + y1 z2 + s Y1 z2 - s Y3 z2 y1 z3 - s Y1 z3 + s Y2 z3 + s2 Y2 Z1 - s2 Y3 Z1 - s y1 Z2 - s2 Y1 Z2 + s2 Y3 Z2 + y3 Hz1 - z2 - s Z1 + s Z2 L + s y1 Z3 + s2 Y1 Z3 - s2 Y2 Z3 + y2 H- z1 + z3 + s Z1 - s Z3 LM I- s X2 y1 + s X3 y1 + x1 y2 + s X1 y2 - s X3 y2 - x1 y3 - s X1 y3 + s X2 y3 - s2 X2 Y1 + s2 X3 Y1 + s x1 Y2 + s2 X1 Y2 - s2 X3 Y2 + x3 Hy1 - y2 + s Y1 - s Y2 L s x1 Y3 - s2 X1 Y3 + s2 X2 Y3 + x2 H- y1 + y3 - s Y1 + s Y3 LM== b0 = b0 . s0 . dataC3 Flatten 8b ® - 0.000146775< 9 10 ConformalMapping_16.nb c0 = Solve@Hsolcdx . newvarsL 0, cD Simplify 99c ® Ix22 - s x3 X1 + s x3 X2 + s2 X1 X2 - s2 X22 - s2 X1 X3 + s2 X2 X3 - x2 Hx3 - s X1 + s X3 L + x1 H- x2 + x3 - s X2 + s X3 L - y1 y2 + y22 + y1 y3 - y2 y3 + s y2 Y1 - s y3 Y1 - s y1 Y2 + s y3 Y2 + s2 Y1 Y2 - s2 Y22 + s y1 Y3 - s y2 Y3 - s2 Y1 Y3 + s2 Y2 Y3 - z1 z2 + z22 + z1 z3 - z2 z3 - s z2 Z1 + s z3 Z1 + s z1 Z2 - s z3 Z2 + s2 Z1 Z2 - s2 Z22 - s z1 Z3 + s z2 Z3 - s2 Z1 Z3 + s2 Z2 Z3 M Is X2 y1 - s X3 y1 - x1 y2 - s X1 y2 + s X3 y2 + x1 y3 + s X1 y3 - s X2 y3 + s2 X2 Y1 s2 X3 Y1 - s x1 Y2 - s2 X1 Y2 + s2 X3 Y2 + x3 H- y1 + y2 - s Y1 + s Y2 L + s x1 Y3 + s2 X1 Y3 - s2 X2 Y3 + x2 Hy1 - y3 + s Y1 - s Y3 LM== c0 = c0 . s0 . dataC3 Flatten 8c ® 0.00447553< The translation vector, XYZ0 = MapThread@ð1 ® ð2 &, 88X0 , Y0 , Z0 <, solXYZ0 . dataC3 . s0 . a0 . b0 . c0 Flatten<D 8X0 ® - 211.663, Y0 ® 21.644, Z0 ® 48.3429< The residium of the equations of the original system, rs = sysO . dataC3 . s0 . a0 . b0 . c0 . XYZ0 90.460014, 0.0228701, - 1.42109 ´ 10-14 , 0.460014, 0.0228701, 4.54747 ´ 10-13 , - 0.920027, - 0.0457402, - 3.2685 ´ 10-13 = The residium of the solution, Norm@%D 1.12819 This method is implemented as a Mathematica function, Conform3DV7, in the GeoAlgebra package, << GeoAlgebra‘Conform3DV7‘ ? Conform3DV7 Solves the 7-Parameter Datum Transformation Problem computing the 'best fitting' parameters of the linear transform, between systems 8X,Y,Z< -> 8x,y,z< in form 8x,y,z< = s R Ha, b, cL 8X,Y,Z< + 8X0,Y0,Z0<. The inputs: - xyz =88x1,y1,z1<, 8x2,y2,z2<, 8x3,y3,z3<< - XYZ =88X1,Y1,Z1<, 8X1,Y1,Z1<,8X1,Y1,Z1<<. The result: 8s, a, b, c, X0, Y0, Z0< - scale,s, - elements of the skew matrix a, b, c, - translation vector, X0, Y0, Z0 Let us employ the function, ConformalMapping_16.nb 11 AbsoluteTiming @sol = Conform3DV7@88183.00, 500.40, 800.02<, 8181.53, 749.31, 402.84<, 8223.76, 279.16, 393.28<<, 88423.09, 500.42, 800.02<, 8423.78, 766.61, 379.80<, 8465.59, 267.41, 367.23<<D NumberForm@ð, 12D &;D 80., Null< sol 80.942297664317 , -0.0024163658149 , -0.000146774979062 , 0.00447552595506 , -211.662662588 , 21.6440005507 , 48.3428540977 < The function is very fast, thanks for the symbolic solution! 16- 4 Numerical Solutions First, we start with the Global Numerical Solver. Using it as a global method, any 7 equations can be solved from the 9 ones. The system of the 9 equations, sysO 8x1 - X0 - s X1 + c y1 - c Y0 + c s Y1 - b z1 + b Z0 - b s Z1 , - c x1 + c X0 - c s X1 + y1 - Y0 - s Y1 + a z1 - a Z0 + a s Z1 , b x1 - b X0 + b s X1 - a y1 + a Y0 - a s Y1 + z1 - Z0 - s Z1 , x2 - X0 - s X2 + c y2 - c Y0 + c s Y2 - b z2 + b Z0 - b s Z2 , - c x2 + c X0 - c s X2 + y2 - Y0 - s Y2 + a z2 - a Z0 + a s Z2 , b x2 - b X0 + b s X2 - a y2 + a Y0 - a s Y2 + z2 - Z0 - s Z2 , x3 - X0 - s X3 + c y3 - c Y0 + c s Y3 - b z3 + b Z0 - b s Z3 , - c x3 + c X0 - c s X3 + y3 - Y0 - s Y3 + a z3 - a Z0 + a s Z3 , b x3 - b X0 + b s X3 - a y3 + a Y0 - a s Y3 + z3 - Z0 - s Z3 < Take the first 7 equations, sysOr = Take@sysO, 81, 7<D 8x1 - X0 - s X1 + c y1 - c Y0 + c s Y1 - b z1 + b Z0 - b s Z1 , - c x1 + c X0 - c s X1 + y1 - Y0 - s Y1 + a z1 - a Z0 + a s Z1 , b x1 - b X0 + b s X1 - a y1 + a Y0 - a s Y1 + z1 - Z0 - s Z1 , x2 - X0 - s X2 + c y2 - c Y0 + c s Y2 - b z2 + b Z0 - b s Z2 , - c x2 + c X0 - c s X2 + y2 - Y0 - s Y2 + a z2 - a Z0 + a s Z2 , b x2 - b X0 + b s X2 - a y2 + a Y0 - a s Y2 + z2 - Z0 - s Z2 , x3 - X0 - s X3 + c y3 - c Y0 + c s Y3 - b z3 + b Z0 - b s Z3 < The variable list X = 8a, b, c, s, X0 , Y0 , Z0 <; We have two solutions and the first one has considerable "error", solabcs = NSolve@sysOr . newvars . dataC3, XD 88a ® 455.301, b ® 38.2629, c ® 23.6376, s ® - 0.942298, X0 ® 730.149, Y0 ® 105.142, Z0 ® 97.1707<, 8a ® - 0.00241786, b ® 0.000764641, c ® 0.00302899, s ® 0.942298, X0 ® - 213.952, Y0 ® 22.807, Z0 ® 49.0663<< Remark : Do not mix the error of the method and the error of the technique, which means how to use it! The reason of the "error" here, is the fact that the system of the 7 equations mathematically has two solutions! Would be the model perfect and the data without error, then the additional two equations were redundant! However, it is generally not true, therefore these solutions do not represent the least square solution of the overdetermined system of 9 equations. In addition again, we can consider the first solution as a parasitic solution, but not as an error of the computation or the method. This phenomenon can be considered as a side effect of the algebraic solution! 12 ConformalMapping_16.nb Remark : Do not mix the error of the method and the error of the technique, which means how to use it! The reason of the "error" here, is the fact that the system of the 7 equations mathematically has two solutions! Would be the model perfect and the data without error, then the additional two equations were redundant! However, it is generally not true, therefore these solutions do not represent the least square solution of the overdetermined system of 9 equations. In addition again, we can consider the first solution as a parasitic solution, but not as an error of the computation or the method. This phenomenon can be considered as a side effect of the algebraic solution! Now, let us use these results as initial values for the Extended Newton- Raphson method employed for solving the overdetermined system, << GeoAlgebra‘NewtonExtended‘ ? NewtonExtended Computes the solution of an overdetermined nonlinear system. Input parameters: f - list of functions of the system, x - list of variables, x0 - list of the initial values, eps - error limit for the iteration, default value: 10^-12 n - maximum number of the iterations, default value: 100. Output: list of the iterative solutions We select the second solution as initial values, X0 = Map@ð@@2DD &, solabcs@@2DDD 8- 0.00241786, 0.000764641, 0.00302899, 0.942298, - 213.952, 22.807, 49.0663< The result is somewhat different from the symbolic solution, AbsoluteTiming @ soln = MapThread@ð1 ® ð2 &, 8X, NewtonExtended @sysO . dataC3, X, X0 D Last<D;D 80.3281250, Null< soln 8a ® - 0.00244041, b ® 0.000757418, c ® 0.0030362, s ® 0.942205, X0 ® - 213.898, Y0 ® 22.8437, Z0 ® 49.154< However, the residium, rn = sysO . dataC3 . soln 80.00242036, - 0.0293541, 0.00173727, 0.000252836, 0.0130756, - 0.0259387, - 0.00267319, 0.0162785, 0.0242014< is considerably smaller, see Fig.16.1, Norm@%D 0.0507172 and it is distributed nearly uniformly, ConformalMapping_16.nb 13 ListPlot@8rs, rn<, Joined ® True, PlotRange ® All, Frame ® TrueD 0.4 0.2 0.0 -0.2 -0.4 -0.6 -0.8 0 2 4 6 8 Fig .16 .1 Distribution of the residiums in case of symbolic (blue) and numeric solution of the 9 equations in least square sense (maroon) Remark: Probably, the best strategy is to employ symbolic solution first then to improve it with Extended Newton- Raphson method applied to the overdetermined system, to 9 equations. Let us do it! Employing the solution of the symbolic method as initial values, X0 = Map@ð@@2DD &, Join@s0, a0, b0, c0, XYZ0DD 80.942298, - 0.00241637, - 0.000146775, 0.00447553, - 211.663, 21.644, 48.3429< then applying Extended Newton- Raphson method, soln = MapThread@ð1 ® ð2 &, 8X, NewtonExtended @sysO . dataC3, X, X0 D Last<D 8a ® - 0.00244041, b ® 0.000757418, c ® 0.0030362, s ® 0.942205, X0 ® - 213.898, Y0 ® 22.8437, Z0 ® 49.154< Remark: Generally the best strategy is to combine symbolic and robust local numeric methods to get unique, precise solution without quessing initial values and with just a few iterations! 16- 5 N-Point Problem 16- 5- 1 The system of equations and data structures In this case, there are data for more than 3 points at our disposal. The prototype equation, xi e = HI3 - SL. yi zi Xi - s HI3 + SL. Yi Zi X0 - HI3 - SL. Y0 Z0 Expand Flatten 8xi - X0 - s Xi + c yi - c Y0 + c s Yi - b zi + b Z0 - b s Zi , - c xi + c X0 - c s Xi + yi - Y0 - s Yi + a zi - a Z0 + a s Zi , b xi - b X0 + b s Xi - a yi + a Y0 - a s Yi + zi - Z0 - s Zi < In our illlustrative example there are seven points. The system in case of these 7 points, 14 ConformalMapping_16.nb sys = Table@e, 8i, 1, 7<D Flatten 8x1 - X0 - s X1 + c y1 - c Y0 + c s Y1 - b z1 + b Z0 - b s Z1 , - c x1 + c X0 - c s X1 + y1 - Y0 - s Y1 + a z1 - a Z0 + a s Z1 , b x1 - b X0 + b s X1 - a y1 + a Y0 - a s Y1 + z1 - Z0 - s Z1 , x2 - X0 - s X2 + c y2 - c Y0 + c s Y2 - b z2 + b Z0 - b s Z2 , - c x2 + c X0 - c s X2 + y2 - Y0 - s Y2 + a z2 - a Z0 + a s Z2 , b x2 - b X0 + b s X2 - a y2 + a Y0 - a s Y2 + z2 - Z0 - s Z2 , x3 - X0 - s X3 + c y3 - c Y0 + c s Y3 - b z3 + b Z0 - b s Z3 , - c x3 + c X0 - c s X3 + y3 - Y0 - s Y3 + a z3 - a Z0 + a s Z3 , b x3 - b X0 + b s X3 - a y3 + a Y0 - a s Y3 + z3 - Z0 - s Z3 , x4 - X0 - s X4 + c y4 - c Y0 + c s Y4 - b z4 + b Z0 - b s Z4 , - c x4 + c X0 - c s X4 + y4 - Y0 - s Y4 + a z4 - a Z0 + a s Z4 , b x4 - b X0 + b s X4 - a y4 + a Y0 - a s Y4 + z4 - Z0 - s Z4 , x5 - X0 - s X5 + c y5 - c Y0 + c s Y5 - b z5 + b Z0 - b s Z5 , - c x5 + c X0 - c s X5 + y5 - Y0 - s Y5 + a z5 - a Z0 + a s Z5 , b x5 - b X0 + b s X5 - a y5 + a Y0 - a s Y5 + z5 - Z0 - s Z5 , x6 - X0 - s X6 + c y6 - c Y0 + c s Y6 - b z6 + b Z0 - b s Z6 , - c x6 + c X0 - c s X6 + y6 - Y0 - s Y6 + a z6 - a Z0 + a s Z6 , b x6 - b X0 + b s X6 - a y6 + a Y0 - a s Y6 + z6 - Z0 - s Z6 , x7 - X0 - s X7 + c y7 - c Y0 + c s Y7 - b z7 + b Z0 - b s Z7 , - c x7 + c X0 - c s X7 + y7 - Y0 - s Y7 + a z7 - a Z0 + a s Z7 , b x7 - b X0 + b s X7 - a y7 + a Y0 - a s Y7 + z7 - Z0 - s Z7 < The numerical data are, xyz = 4 157 870.237 4 149 691.049 4 173 451.354 4 177 796.064 4 137 659.549 4 146 940.228 4 139 407.506 664 818.678 688 865.785 690 369.375 643 026.700 671 837.337 666 982.151 702 700.227 4 775 416.524 4 779 096.588 4 758 594.075 4 761 228.899 ; 4 791 592.531 4 784 324.099 4 786 016.645 XYZ = 4 157 222.543 4 149 043.336 4 172 803.511 4 177 148.376 4 137 012.190 4 146 292.729 4 138 759.902 664 789.307 688 836.443 690 340.078 642 997.635 671 808.029 666 952.887 702 670.738 4 774 952.099 4 778 632.188 4 758 129.701 4 760 764.800 ; 4 791 128.215 4 783 859.856 4 785 552.196 and where xyz are the coordinates for the WGS-84 system, while XYZ are the coordinates for the local system. In rule form, xyzR = MapThread@8xð1 ® ð2@@1DD, yð1 ® ð2@@2DD, zð1 ® ð2@@3DD< &, 8Range@7D, xyz<D Flatten 9x1 ® 4.15787 ´ 106 , y1 ® 664 819., z1 ® 4.77542 ´ 106 , x2 ® 4.14969 ´ 106 , y2 x4 y5 z6 ® ® ® ® 688 866., z2 ® 4.7791 ´ 106 , x3 ® 4.17345 ´ 106 , y3 ® 690 369., z3 ® 4.75859 ´ 106 , 4.1778 ´ 106 , y4 ® 643 027., z4 ® 4.76123 ´ 106 , x5 ® 4.13766 ´ 106 , 671 837., z5 ® 4.79159 ´ 106 , x6 ® 4.14694 ´ 106 , y6 ® 666 982., 4.78432 ´ 106 , x7 ® 4.13941 ´ 106 , y7 ® 702 700., z7 ® 4.78602 ´ 106 = XYZR = MapThread@8Xð1 ® ð2@@1DD, Yð1 ® ð2@@2DD, Zð1 ® ð2@@3DD< &, 8Range@7D, XYZ<D Flatten 9X1 ® 4.15722 ´ 106 , Y1 ® 664 789., Z1 ® 4.77495 ´ 106 , X2 ® 4.14904 ´ 106 , Y2 X4 Y5 Z6 ® ® ® ® 688 836., Z2 ® 4.77863 ´ 106 , X3 ® 4.1728 ´ 106 , Y3 ® 690 340., Z3 ® 4.75813 ´ 106 , 4.17715 ´ 106 , Y4 ® 642 998., Z4 ® 4.76076 ´ 106 , X5 ® 4.13701 ´ 106 , 671 808., Z5 ® 4.79113 ´ 106 , X6 ® 4.14629 ´ 106 , Y6 ® 666 953., 4.78386 ´ 106 , X7 ® 4.13876 ´ 106 , Y7 ® 702 671., Z7 ® 4.78555 ´ 106 = 16- 5- 2 Global Minimization ConformalMapping_16.nb 15 16- 5- 2 Global Minimization The global minimization is the most simple and robust method, but quite time consuming. The system equations in numerical form, sysn = sys . xyzR . XYZR; Short@sysn, 10D 94.15787 ´ 106 - 4.77542 ´ 106 b + 664 819. c - 4.15722 ´ 106 s - 4.77495 ´ 106 b s + 664 789. c s - X0 - c Y0 + b Z0 , 664 819. + 4.77542 ´ 106 a - 4.15787 ´ 106 c - 664 789. s + 4.77495 ´ 106 a s - 4.15722 ´ 106 c s + c X0 - Y0 - a Z0 , 4.77542 ´ 106 - 664 819. a + 4.15787 ´ 106 b - 4.77495 ´ 106 s - 664 789. a s + 4.15722 ´ 106 b s - b X0 + a Y0 - Z0 , 16, 702 700. + 4.78602 ´ 106 a - 4.13941 ´ 106 c - 702 671. s + 4.78555 ´ 106 a s 4.13876 ´ 106 c s + c X0 - Y0 - a Z0 , 4.78602 ´ 106 - 702 700. a + 4.13941 ´ 106 b 4.78555 ´ 106 s - 702 671. a s + 4.13876 ´ 106 b s - b X0 + a Y0 - Z0 = The objective function, obj = Apply@Plus, Map@ð ^ 2 &, sysnDD; Short@obj, 10D I4.79159 ´ 106 - 671 837. a + 4.13766 ´ 106 b - 4.79113 ´ 106 s - 671 808. a s + 4.13701 ´ 106 b s - b X0 + a Y0 - Z0 M + 2 I4.78602 ´ 106 - 702 700. a + 4.13941 ´ 106 b - 4.78555 ´ 106 s 702 671. a s + 4.13876 ´ 106 b s - b X0 + a Y0 - Z0 M + 2 17 + I4.17345 ´ 106 - 4.75859 ´ 106 b + 690 369. c - 4.1728 ´ 106 s 4.75813 ´ 106 b s + 690 340. c s - X0 - c Y0 + b Z0 M + 2 I4.13941 ´ 106 - 4.78602 ´ 106 b + 702 700. c - 4.13876 ´ 106 s 4.78555 ´ 106 b s + 702 671. c s - X0 - c Y0 + b Z0 M 2 The result, AbsoluteTiming @solGM = NMinimize@obj, XD;D 80.5312500, Null< solGM 90.0835105, 9a ® 2.42043 ´ 10-6 , b ® - 2.16637 ´ 10-6 , c ® - 2.40732 ´ 10-6 , s ® 1.00001, X0 ® 641.88, Y0 ® 68.6553, Z0 ® 416.398== The rotation matrix, Rn = R . solGM@@2DD; MatrixForm@RnD 4.81463 ´ 10-6 - 4.33276 ´ 10-6 1. - 4.81465 ´ 10 -6 4.33274 ´ 10-6 1. - 4.84085 ´ 10-6 4.84087 ´ 10-6 1. 16- 5- 3 Gauss-Jacobi solution Now, we have 7 points and any 3 of them form a subset, n = 3; m = 7; The number of the subsets 16 ConformalMapping_16.nb mn = Binomial@m, nD 35 This is not a big number, therefore it is reasonable to use combinatorial solution, especially because the solution of the 3Point Problem is very fast. These subsets are, qs = Partition@Map@ð &, Flatten@Subsets@Range@mD, 8n<DDD, nD 881, 81, 81, 82, 83, 2, 3, 6, 4, 5, 3<, 6<, 7<, 7<, 6<, 81, 81, 82, 82, 83, 2, 3, 3, 5, 5, 4<, 7<, 4<, 6<, 7<, 81, 81, 82, 82, 83, 2, 4, 3, 5, 6, 5<, 5<, 5<, 7<, 7<, 81, 81, 82, 82, 84, 2, 4, 3, 6, 5, 6<, 6<, 6<, 7<, 6<, 81, 81, 82, 83, 84, 2, 4, 3, 4, 5, 7<, 7<, 7<, 5<, 7<, 81, 81, 82, 83, 84, 3, 5, 4, 4, 6, 4<, 6<, 5<, 6<, 7<, 81, 81, 82, 83, 85, 3, 5, 4, 4, 6, 5<, 7<, 6<, 7<, 7<< The data values for the subsets can be generated as it follows, dataGJ = Map@Transpose@ðD &, Table@8xyz@@qs@@i, jDDDD, XYZ@@qs@@i, jDDDD<, 8i, 1, mn<, 8j, 1, n<DD; Short@dataGJ, 10D 99994.15787 ´ 106 , 664 819., 4.77542 ´ 106 =, 94.14969 ´ 106 , 688 866., 4.7791 ´ 106 =, 94.17345 ´ 106 , 690 369., 4.75859 ´ 106 ==, 994.15722 ´ 106 , 664 789., 4.77495 ´ 106 =, 94.14904 ´ 106 , 688 836., 4.77863 ´ 106 =, 94.1728 ´ 106 , 690 340., 4.75813 ´ 106 ===, 33, 9994.13766 ´ 106 , 671 837., 4.79159 ´ 106 =, 94.14694 ´ 106 , 666 982., 4.78432 ´ 106 =, 94.13941 ´ 106 , 702 700., 4.78602 ´ 106 ==, 994.13701 ´ 106 , 671 808., 4.79113 ´ 106 =, 94.14629 ´ 106 , 666 953., 4.78386 ´ 106 =, 94.13876 ´ 106 , 702 671., 4.78555 ´ 106 ==== Loading the symbolic solution of the 3 - point problem, << GeoAlgebra‘Conform3DV7‘ ; The solution of the 35 subsets, AbsoluteTiming @solGJ = Map@Conform3DV7@ð@@1DD, ð@@2DDD &, dataGJD;D 80.2031250, Null< ConformalMapping_16.nb 17 NumberForm@solGJ TableForm, 6D 0.999999 -7.89644 ´ 10-7 1.11598 ´ 10-6 0.999999 -5.35996 ´ 10 -6 0.999999 3.53688 ´ 10-7 0.999999 2.38348 ´ 10 -6 1.96505 ´ 10-8 643.095 22.6163 481.602 -6 517.556 -38.212 599.401 -2.24546 ´ 10-6 -4.9477 ´ 10-7 674.343 37.7954 452.134 730.196 64.7628 399.818 0.0000145529 -8.21312 ´ 10 -6 0.999999 -2.55255 ´ 10-6 6.29899 ´ 10-6 1.00000 2.46743 ´ 10-6 -6 5.09255 ´ 10-6 -1.40804 ´ 10 -6 8.12839 ´ 10-7 594.52 -0.760895 527.04 -5.93527 ´ 10-6 586.749 101.518 -9.99846 ´ 10 -7 498.265 1.00000 -2.10379 ´ 10 1.00000 -5.34206 ´ 10-6 -7.71392 ´ 10-6 2.49642 ´ 10-6 1.00000 1.00001 1.00001 -1.92394 ´ 10-7 7.30811 ´ 10-7 0.0000151895 -0.0000121382 0.0000190266 -0.0000163347 -3.06353 ´ 10-6 631.99 52.2648 -0.0000128003 703.346 273.884 -0.0000155323 739.81 333.255 465.536 293.595 253.605 1.00001 1.00001 -7.11025 ´ 10-6 0.0000122498 0.0000380055 -0.0000184347 3.07746 ´ 10-6 -0.0000277583 491.543 -71.1452 760.504 618.886 526.017 230.342 1.00001 2.38451 ´ 10-6 680.297 41.6576 380.533 1.00000 4.93064 ´ 10 -6 737.581 67.2038 369.354 1.00000 3.07903 ´ 10-6 1.00000 3.22055 ´ 10 -6 635.101 89.5105 436.099 1.00000 3.92191 ´ 10-6 -7.58078 ´ 10-7 -4.44507 ´ 10-6 633.896 101.236 435.501 1.00000 1.54574 ´ 10-6 -9.08449 ´ 10-7 -2.39469 ´ 10-6 638.116 61.5296 437.527 -6 -2.40361 ´ 10 -6 2.07598 ´ 10 -6.06425 ´ 10-6 7.51972 ´ 10-7 -9.85975 ´ 10 -6 1.01197 ´ 10 -6 664.69 -8.11419 ´ 10-7 -3.71775 ´ 10-6 635.47 -8.02463 ´ 10 -1.68488 ´ 10 -7 -6 -3.83987 ´ 10 -6 87.135 442.016 402.17 436.22 1.00001 3.2616 ´ 10 637.744 78.2913 420.066 1.00001 3.89241 ´ 10-6 -2.71372 ´ 10-6 -2.98945 ´ 10-6 647.065 87.6438 410.659 1.00001 0.0000107567 -0.0000139093 -7.35337 ´ 10-6 748.047 189.463 308.303 1.00001 4.25212 ´ 10 -6 -7 618.438 128.159 421.246 1.00001 2.55219 ´ 10-6 -3.20825 ´ 10-6 -5.77505 ´ 10-6 643.765 97.2313 403.623 1.00000 3.51389 ´ 10-6 -3.3106 ´ 10-6 418.37 1.00000 3.12668 ´ 10 -6 638.548 70.9403 430.423 1.00000 3.17964 ´ 10-6 -1.71742 ´ 10-6 -1.73543 ´ 10-6 644.127 71.1657 425.534 1.00000 3.18301 ´ 10-6 -1.75421 ´ 10-6 -1.73338 ´ 10-6 644.487 71.2004 425.222 1.00001 4.93025 ´ 10 -6 1.00001 2.54331 ´ 10-6 -2.07665 ´ 10-6 -3.94928 ´ 10-6 638.758 82.5886 416.868 1.00000 3.09686 ´ 10-6 -1.39389 ´ 10-6 -3.88772 ´ 10-6 641.46 432.236 -6 -8.02273 ´ 10 -1.14035 ´ 10 -8.40752 ´ 10 -7 -6 -7.54063 ´ 10 -6 -3.91826 ´ 10-6 661.998 93.4872 -1.76754 ´ 10 -6.14995 ´ 10 -6 -6 624.015 123.68 88.8769 -5.77091 ´ 10 2.74527 ´ 10-6 -2.28113 ´ 10-6 -2.24433 ´ 10-6 633.262 68.8019 403.579 1.00001 3.30644 ´ 10-6 -2.7641 ´ 10-6 404.564 1.00001 -6 -2.63389 ´ 10 583.346 -66.0798 423.887 1.00001 -6 4.19823 ´ 10 -6 1.00001 3.14131 ´ 10 3.83191 ´ 10 -6 -2.58841 ´ 10 -6 16.8065 720.124 -43.1786 -3.07473 ´ 10-6 641.79 -1.54197 ´ 10 -6 81.87 618.544 63.6421 465.602 378.063 The average solGJavg = Map@Mean@ðD &, Transpose@solGJDD NumberForm@ð, 12D & 91.00000432576 , 3.5648198311 ´ 10-6 , -2.42990247217 ´ 10-6 , -3.54841881878 ´ 10-6 , 648.123456076 , 89.9350637311 , 418.714884865 = which is a quite bad result. Now, instead of using weighting technique, we use a different method to improve this result. Let us compute the value of objective function for every subset solution, objGJ = Map@obj . 8s ® ð@@1DD, a ® ð@@2DD, b ® ð@@3DD, c ® ð@@4DD, X0 ® ð@@5DD, Y0 ® ð@@6DD, Z0 ® ð@@7DD< &, solGJD 80.692454, 2.97175, 0.465146, 0.80273, 1.10084, 1.98812, 0.450086, 1.72955, 0.450835, 4.31309, 6.65965, 2.26175, 23.2864, 0.65846, 1.3637, 0.201256, 0.189137, 0.228662, 0.126695, 0.101355, 0.12014, 1.56615, 0.585342, 0.3723, 0.163248, 0.153814, 0.164332, 0.147514, 0.392229, 0.190792, 0.188549, 2.16535, 0.127353, 0.111554, 0.434054< Select the solution, which has the minimal residual, 18 ConformalMapping_16.nb Select the solution, which has the minimal residual, solGJs = solGJ@@First@Flatten@Position@objGJ, Min@objGJDDDDDD; solGJs NumberForm@ð, 12D & 91.00000541154 , 3.26159701109 ´ 10-6 , -1.68487595715 ´ 10-6 , -2.58841274695 ´ 10-6 , 637.744465387 , 78.2912587174 , 420.065675625 = and do improve it with the Extended Newton- Raphson method, using it as initial guess, 16- 5- 4 Extended Newton- Raphson method << GeoAlgebra‘NewtonExtended‘ AbsoluteTiming @solNE = NewtonExtended @sysn, X, solGJsD Last;D 80.1875000, Null< solNE 92.42043 ´ 10-6 , - 2.16637 ´ 10-6 , - 2.40732 ´ 10-6 , 1.00001, 641.88, 68.6553, 416.398= In order to demonstrate the robustness of the method, let us select the worst result, solGJs = solGJ@@First@Flatten@Position@objGJ, Max@objGJDDDDDD; solGJs NumberForm@ð, 12D & 81.00000634587 , 0.0000380054712855 , -0.0000184346607387 , -0.0000277582684802 , 760.503916369 , 618.886376051 , 230.342364432 < Again, the solution fast and precise, AbsoluteTiming @solNE = NewtonExtended @sysn, X, solGJsD Last;D 80.1875000, Null< solNE 92.42043 ´ 10-6 , - 2.16637 ´ 10-6 , - 2.40732 ´ 10-6 , 1.00001, 641.88, 68.6553, 416.398= 16- 5- 5 General Procrustes method Another numerical solution technique, the General Procrustes method is also a good candidate for solving the problem, see Chapter 9. We also implemented it as a function in the GeoAlgebra package, << GeoAlgebra‘GeneralProcrustes‘ ? GeneralProcrustes Solves the 7-Parameter Datum Transformation Problem computing the scale parameter, s, the translation vector, 8X0, Y0, Z0< and the rotation matrix, R, as well as the norm of the error matrix, nEL. The input data are: Y1 - matrixHn ´ 3L, the coordinates of the image points, Hxi, yi, ziL, Y2 - matrix Hn ´ 3L, the coordinates of the object points, HXi, Yi, ZiL, W - weight matrix Hn ´ nL. Here n is the number of the pairs of points. The output is a list, 8R, s, 8X0, Y0, Z0<, nEL<. Now we employ identity matrix for the weigth matrix in order to compare the result with that of the other methods. ConformalMapping_16.nb 19 Now we employ identity matrix for the weigth matrix in order to compare the result with that of the other methods. W = IdentityMatrix @mD 881, 0, 0, 0, 0, 0, 0<, 80, 1, 0, 0, 0, 0, 0<, 80, 0, 1, 0, 0, 0, 0<, 80, 0, 0, 1, 0, 0, 0<, 80, 0, 0, 0, 1, 0, 0<, 80, 0, 0, 0, 0, 1, 0<, 80, 0, 0, 0, 0, 0, 1<< AbsoluteTiming @solGP = GeneralProcrustes @xyz, XYZ, WD;D 80.0312500, Null< The rotation matrix, solGP@@1DD MatrixForm 0.9999999999790232905 - 4.8146461561368 ´ 10 4.3327360257663 ´ 10 -6 -6 4.8146251818956 ´ 10-6 - 4.3327593327616 ´ 10-6 0.9999999999766926608 - 4.8408533143026 ´ 10-6 4.8408741749041 ´ 10-6 0.9999999999788966679 The scaling parameter, solGP@@2DD NumberForm@ð, 12D & 1.00000558252 The translation vector, solGP@@3DD MatrixForm 641.88 68.6553 416.398 The residual, solGP@@4DD 0.0835105 This is the same error norm as was computed with direct global minimization, (Section 16- 5- 2), but the computation time is considerably less in that case. Conclusions In case of 3- point problem, Dixon resultant and reduced Groebner basis give the same symbolic result, although the Dixon method is faster than the Groebner method. The computation of the translation vector in least square sense - 3 unknowns and 9 equations - can be achieved by simple averaging because of the linearity of the problem. Employing symbolic solution, a very fast Mathematica function, Conform3DV7 was implemented in the GeoAlgebra package to solve conformal mapping in case of 3-points. Direct numerical solution with Extended Newton- Raphson method is also fast and precise, but it needs initial guess, which can be provided by the Global Numerical Solver, solving any 7 equations from the 9 ones. In all, the best strategy to solve 3-point problem, is the symbolic solution, Conform3DV7 and considering its result as a guess value for the function NewtonExtended. In case of N-point problem, direct global minimization in least square sense is alwasy a good choice, but it can be time consuming. Gauss-Jacobi combinatorial solution is reasonable, if the number of the points - therefore the number of the triplets- is not too high and the technique to solve a triplet is fast. However, the results of the different triplets can differ from each other very considerably. It seems to be the a good strategy to solve a triplet selected randomly, then the result can provide an initial guess for the Extended Newton- Raphson method. Employing General Procrustes algorithm is probably the best choice. It is precise and at least faster than any other methods.