Symbolic – Numeric Algebra in Geodesy R. Lewis, B. Paláncz, P. Zaletnyik, J. Awange 1 Geodesy and Surveying Geodesy and Surveying are concerned with measuring the Earth on different scales. Variables such as distances, angles and height differences are measured and other geometrical variables (i. e. coordinates of location) are derived from these measurements. Many geodetic problems can be represented as systems of multivariable polynomials. GPS Positioning (GPS Ranging) In GPS Positioning pseudo distances are measured between a GPS receiver and minimum 4 GPS satellites to calculate the position of the receiver (X,Y,Z) and the receiver’ clock bias (T). For each satellites: ( X ai )2 (Y bi )2 (Z ci )2 (T Pi )2 0 where ai, bi, ci are the coordinates of the satellites and Pi the measured distances. 3D Helmert similarity transformation In geodesy is a frequent task to calculate the coordinates of points from one to another different coordinate system. In the 7-parameter similarity transformation 3 translations, 3 rotations and 1 scale parameter are used. z Z P Z Y X x 0 xi Xi X0 y m R i Yi Y0 [ 33] z Z Z i i 0 i 0 X 0 Y y where R is the rotation matrix, m is the scale parameter and X0, Y0, Z0 are the 3 translation parameters. Solving Algebraic Computational Problems in Geodesy The book of J.L. Awange and E.W. Grafarend can be considered as a milestone in this research area. The main algebraic methods they applied: Groebner Basis Resultants (Sylvester, Macaulay and Sturmfels’ Formulations) Gauss-Jacobi combinatorial solution 2005 Improvement of models and methods Geodesy needs more precise measurements, more precise computations with more general and enhanced models. Computational algebra provides more effective algorithms and methods to carry out these computations. 3D affine transformation The 3D affine transformation is the generalization of the 3D Helmert transformation, using 3 different scale parameters according to the coordinate axes, instead of one. The 9 transformation parameters (3 translation, 3 rotations and 3 scale parameters) should be determined using control points with known coordinates in both coordinate system. z Z P Z Y X x 0 xi Xi X0 R Yi Y0 yi [ M 33 ] [ 33 ] z Z Z i i 0 i 0 X 0 Y y where R is the rotation matrix, M the diagonal matrix of the scale parameters and X0, Y0, Z0 are the 3 translation parameters. Rotation matrix z Z The rotation matrix in general is given by using 3 axial rotation angles (, , - Cardan angles), leading to the next rotation matrix: P Z Y 0 i 0 X 0 Y X x cos cos R( , , ) sin sin cos cos sin cos sin cos sin sin cos sin sin sin sin cos cos cos sin sin sin cos Instead of the traditional form, the rotation matrix can be expressed with a skewsymmetric matrix (S) also, and this facilitates the symbolic solution of the problem. sin sin cos cos cos 0 c b S c 0 a b a 0 R ( I 3 S )1 I 3 S y Scale parameters In 3D affine transformation 3 scale parameters (m1, m2, m3) are used according to the 3 coordinate axis: m1 M 0 0 0 m2 0 0 0 m3 In further, instead of the scale parameters (m1, m2, m3), we will use their reciprocals (1, 2, 2) to get more simple equations. introducing: M 1 1 1 1 1 , 2 , 3 m1 m2 m3 0 1 0 0 2 0 0 0 3 The algebraic equations Using 1 instead of M and R ( I 3 S )1 I 3 S we get: xi Xi X0 1 1 yi I 3 S I 3 S Yi Y0 z Z Z i i 0 0 xi Xi X0 0 I S y I S Y I S i i Y0 3 3 3 0 z Z Z i i 0 c b 1 0 0 xi 1 c b X i 1 c b 1 0 0 X 0 0 1 a 0 2 0 yi c 1 a Yi c 1 a 0 2 0 Y0 0 c 1 0 b a 1 0 0 z b a 1 Z i b a 1 0 0 3 Z 0 3 i The 3-point problem As for one point with known coordinates in both coordinate systems 3 equations can be written, to determine the 9 parameters of the transformation 3 points are required. In this case the following 9 equations can be written: f 1 X 1 cY1 bZ1 x1 1 X 0 1 cy1 2 cY0 2 bz1 3 bZ0 3 f 2 cX 1 Y1 aZ 1cx1 1 cX 0 1 y1 2 Y0 2 az1 3 aZ0 3 f 3 bX 1 aY1 Z 1 bx1 1 bX 0 1 ay1 2 aY0 2 z 1 3 Z 0 3 f 4 X 2 cY2 bZ2 x 2 1 X 0 1 cy2 2 cY0 2 bz2 3 bZ0 3 f 5 cX 2 Y2 aZ 2 cx2 1 cX 0 1 y 2 2 Y0 2 az2 3 aZ0 3 f 6 bX 2 aY2 Z 2 bx2 1 bX 0 1 ay2 2 aY0 2 z 2 3 Z 0 3 f 7 X 3 cY3 bZ3 x3 1 X 0 1 cy3 2 cY0 2 bz3 3 bZ0 3 f 8 cX 3 Y3 aZ 3 cx3 1 cX 0 1 y 3 2 Y0 2 az3 3 aZ0 3 f 9 bX 3 aY3 Z 3 bx3 1 bX 0 1 ay3 2 aY0 2 z 3 3 Z 0 3 Simplification of the equations g 1 f 1 f7 g 2 f 4 f7 g3 f2 f8 g4 f5 f8 g5 f3 f9 g6 f6 f 9 We can reduce the equation system by differencing the equations, and introducing some new variables, the relative coordinates instead of the original ones, X ij X i X j , Yij Yi Y j , Z ij Z i Z j i, j 1,2,3, i j xij xi x j , yij yi y j , z ij z i z j Then the system of equation to be solved is, g1 X 13 x13 1 c Y13 c y13 2 b Z 13 b z13 3 g 2 X 23 x23 1 c Y23 c y23 2 b Z 23 b z 23 3 g 3 Y13 c X 13 c x13 1 y13 2 a Z 13 a z13 3 g 4 Y23 c X 23 c x23 1 y23 2 a Z 23 a z 23 3 g 5 Z 13 b X 13 b x13 1 a Y13 a y13 2 z13 3 g6 Z 23 b X 23 b x23 1 a Y23 a y23 2 z 23 3 The Dixon – EDF method Explicit symbolic solution can be achieved by employing the accelerated Dixon resultant by the Early Discovery Factors (EDF) algorithm, which was suggested and implemented in the computer algebra system Fermat by Lewis. The basic idea of the Dixon method is to construct a square matrix M whose determinant D is a multiple of the resultant. The EDF method is to exploit the observed fact that D has many factors. In other words, we try to turn the existence of spurious factors to our advantage. By elementary row and column manipulations (Gaussian elimination) we discover probable factors of D and pluck them out of M0=M. Any denominators that form in the matrix are plucked out. This produces a smaller matrix M1 still with polynomial entries, and list of discovered numerators and denominators. Solution with Dixon – EDF method From our system of equation an univariate polynomial for 1 can be computed by employing the accelerated Dixon resultant by the Early Discovery Factors (Dixon - EDF) algorithm as elimination technique. Using this method one can get the result in the following form: 5 i 1 Ki i 1 where i (1) are irreducible polynomials with low degree, but their powers, Ki are very big positive integer numbers, so expanding this expression would result into millions of terms! Solution with Dixon – EDF method Consequently, we shall consider Ki = 1, for i = 1;…;5. We get five irreducible polynomials (i (1)): 1 y13 z23 y23 z13 2 Z 13 z23 Z 23 z13 3 x13 y23 1 x23 y13 1 X 13 y23 X 23 y13 4 x13 2 y23 z23 12 x13 x23 y13 z 23 12 x13 x23 y23 z13 12 x23 2 y13 z13 12 Z 13 y23 z 23 Y13 y23 z 23 X 13 y23 z 23 Z 13 Z 23 y13 z 23 2 2 2 Y13 Y23 y13 z 23 X 13 X 23 y13 z 23 Z 13 Z 23 y23 z13 Y13 Y23 y23 z13 X 13 X 23 y23 z13 Z 23 y13 z13 Y23 y13 z13 X 23 y13 z13 2 2 2 5 Z 13 x13 x23 z23 12 Z 23 x13 2 z 23 12 Z 13 x23 2 z13 12 Z 23 x13 x23 z13 12 X 13 Z 13 x23 z 23 1 2 X 13 Z 23 x13 z 23 1 X 23 Z 13 x13 z 23 1 X 13 Z 23 x23 z13 1 2 X 23 Z 13 x23 z13 1 X 23 Z 23 x13 z13 1 X 13 Z 23 z 23 X 13 X 23 Z 13 z 23 X 13 X 23 Z 23 z13 X 23 Z 13 z13 2 2 Solution with Dixon – EDF method The factor polynomial providing proper root has degree of two, therefore its solution can be expressed in analytical form (only the positive root is correct, 1). The proper polynomial is: 4 x13 2 y23 z23 12 x13 x23 y13 z23 12 x13 x23 y23 z13 12 x23 2 y13 z13 12 Z13 y23 z23 Y13 y23 z23 X 13 y23 z23 Z13 Z 23 y13 z23 2 2 2 Y13 Y23 y13 z23 X 13 X 23 y13 z23 Z13 Z 23 y23 z13 Y13 Y23 y23 z13 X 13 X 23 y23 z13 Z 23 y13 z13 Y23 y13 z13 X 23 y13 z13 2 2 2 Similarly we can get simple explicit forms for 2 and 3. Solutions for 1, 2, 3 1 = [X232 y13 z13 + y13 Y232 z13 + X132 y23 z23 + Y132 y23 z23 + y23 Z132 z23 X13 X23 (y23 z13 + y13 z23) - Y13 Y23 (y23 z13 + y13 z23) y23 z13 Z13 Z23 - y13 Z13 z23 Z23 + y13 z13 Z232)]1/2 / [(x23 y13 - x13 y23) (x23 z13 - x13 z23)]1/2 2 = [-X132 x23 z23 + X13 X23 (x23 z13 + x13 z23) + x23 (Y13 Y23 z13 - Y132 z23 Z132 z23 + z13 Z13 Z23) - x13 (X232 z13 + Y232 z13 - Y13 Y23 z23 Z13 z23 Z23 + z13 Z232))]1/2 / [-(x23 y13 - x13 y23) (-y23 z13 + y13 z23)]1/2 3 = [X132 x23 y23 - X13 X23 (x23 y13 + x13 y23) + x23 (Y132 y23 y13 Y13 Y23 + y23 Z132 - y13 Z13 Z23) + x13 (X232 y13 - Y13 y23 Y23 + y13 Y232 y23 Z13 Z23 + y13 Z232))]1/2 / [(x23 z13 - x13 z23) (y23 z13 - y13 z23)]1/2 Solution for a, b, c Knowing 1, 2, 3 our system of equation will be linear and a, b, c can be determined easily. a [ X 23Y13 X 13Y23 ( X 23 y13 X 13 y23 ) 2 1 ( x23Y13 x13Y23 ( x23 y13 x13 y23 ) 2 )] / [ X 23 Z13 X 13 Z 23 ( X 23 z13 X 13 z23 ) 3 1 ( x23 Z13 x13 Z 23 ( x23 z13 x13 z23 ) 3 )] b [Y23 Z13 Y13 Z 23 (Y23 z13 Y13 z23 ) 3 2 ( y23 Z13 y13 Z 23 ( y23 z13 y13 z23 ) 3 )] / [ X 23Y13 X 13Y23 ( X 23 y13 X 13 y23 ) 2 1 ( x23Y13 x13Y23 ( x23 y13 x13 y23 ) 2 )] c [ X 23 Z13 X 13 Z 23 ( X 23 z13 X 13 z23 ) 3 1 ( x23 Z13 x13 Z 23 ( x23 z13 x13 z23 ) 3 )] / [Y23 Z13 Y13 Z 23 (Y23 z13 Y13 z23 ) 3 2 ( y23 Z13 y13 Z 23 ( y23 z13 y13 z23 ) 3 )] Solution for X0, Y0, Z0 Knowing 1, 2, 3 and a, b, c the translation parameters can be determined from the original system of equation: 0 X 0 x1 X1 x1 X1 x1 1 / 1 1 1/ 2 Y0 y1 M R Y1 y1 R Y1 y1 0 Z z Z z Z z 0 0 0 1 1 1 1 1 1 a 2 b2 c2 2(ab c) 2(b ac) X 1 1 2 2 2 2(ab c) 1 a b c 2(a bc) Y1 1 a 2 b2 c2 2 2 2 2 ( b ac ) 2 ( a bc ) 1 a b c Z1 0 0 1 / 3 Using the Dixon-EDF method we got fully symbolic solution for all the parameters and using these explicit formulas the parameters can be calculated easily just substituting the coordinates to these formulas. N-point problem In geodesy normally we have more observations than unknowns, when the solution is determined by minimizing the sum of the deviations squared (Least Squares Method). In this case one possible solution is the before mentioned Gauss-Jacobi combinatorial method. In Hungary there are 1138 national stations with known GPS and local projection coordinates. To determine the parameters of the affine transformation we should have compute about 250 millions combinations, which is unrealistic. Therefore we decided to transform the overdetermined problem into a determined one. Definition of the N-point problem For one 3D control point (which coordinates are given in both systems), 3 nonlinear equations can be written: vxi X i cYi bZi xi 1 X 0 1 cyi 2 cY0 2 bzi 3 bZ0 3 vyi cX i Yi aZ i cxi 1 cX 0 1 yi 2 Y0 2 azi 3 aZ0 3 vzi bX i aYi Z i bxi 1 bX 0 1 ayi 2 aY0 2 z i 3 Z 0 3 Therefore for N control points we can write 3 times N nonlinear equations. N u (vxi2 vyi2 vzi2 ) i 1 u f (a, b, c, X 0 , Y0 , Z 0 , 1 , 2 , 3 ) The determined model can be evaluated via partial differentiation: f a 0, f b 0, f c 0, f X 0 0, f Y0 0, f Z0 0, f 1 0, f 2 0, f 3 0 The determined model Using computer algebra manipulations we get a determined model in symbolic form consisting of 9 equations. One of them is: N Eqa bNX 0Y0 1 2 aNY0 2 cNX 0 Z 0 1 3 aNZ0 3 bY0 1 2 xi 2 2 2 2 i 1 N N N i 1 i 1 i 1 N N cZ0 1 3 xi bY0 2 X i cZ0 3 X i aY0 2 2 N (2 y ) i i 1 N bX 0 1 2 yi b 1 2 ( xi yi ) b 2 ( X i yi ) a 2 i 1 i 1 2 i 1 N N N N i 1 i 1 i 1 i 1 N y i 1 2 i aY0 2 (2Yi ) bX 0 1 Yi Z 0 3 2Yi b 1 ( xiYi ) N N i 1 i 1 b ( X iYi ) a 2 2 yiYi aZ0 3 N 2 N N N (2 z ) cX z i i 1 0 1 3 N c 1 3 ( xi zi ) c 3 ( X i zi ) 3 (2Yi zi ) a 3 i 1 i 1 i 1 N N N N i 1 i 1 i 1 i 1 i 1 2 i N z i 1 2 i Y0 2 (2 Z i ) aZ0 3 (2 Z i ) cX 0 1 Z i c 1 ( xi Z i ) N N N N i 1 i 1 i 1 i 1 c ( X i Z i ) 2 2 yi Z i a 3 2 zi Z i a (Yi Z i ) 0 2 2 Numerical solutions of the determined model Unfortunately this multivariate polynomial system of 9 equations with 9 unknowns can not be solved in symbolic form. Local numerical methods like Newton-Raphson or Newton-Krylov generally fail to converge, because of the initial guess values computed from the 3 point solution are wildly different values depending on the constellation of the selected 3 points. Global numerical method like linear homotopy is considered as a good candidate. Solution with Newton Homotopy Method The homotopy continuation method deforms the known roots of the start system into the roots of the target system. It is a very effective tool to find the roots of polynomial systems. Employing New tonhomotopy, the start system is, G( ) F ( ) F ( 0 ) w ith F ( Fa ( ), Fb ( ), Fc ( ), FX 0 ( ), FY0 ( ), FZ 0 ( ), F 1 ( ), F 2 ( ), F 3 ( )) as target system, (a, b, c, X 0 , Y0 , Z 0 , 1 , 2 , 3 ) as unknow nvariables and 0 (a, b, c, X 0 , Y0 , Z 0 , 1 , 2 , 3 ) as start (initial) values for the homotopy function. Then the homotopy functionis, H ( , ) F ( ) (1 ) F ( 0 ). The start values were computed by the 3 point solution, because homotopy solution technique proved to be very robust to ensure convergency. Solution with different start values This table illustrates that the values calculated from different triplets can differ significantly depending on their geometrical configurations. [″] [″] [″] X0 [m] Y0 [m] Z0 [m] k1 [ppm] k2 [ppm] k3 [ppm] start values - a 8 -8 -8 -243 -227 +337 0 0 0 start values - b +2 -3 -19 0 0 0 -1 -118 -18 solution 3 -47 14 -2299 527 2143 270 -189 -245 The parameters in this table are transformed into their traditional geodetic forms, representing the rotation matrix with three rotation angles (, , ) in seconds, instead of a, b, c, and the deviation of the scale parameters from one (ki = mi – 1 = 1/I - 1) in ppm (part per million), instead the inverse scale parameters (1, 2, 3). Trajectories of the different solutions Solution of the linear homotopy model means the solution of a system of nonlinear ordinary differential equations. Figures above show the trajectories (the homotopy paths) of the variable (parameter) a on the complex plain, in case of these two different initial values. We have got the same result independently on the initial values. Comparing the different methods Method Computation time [second] Start values - a Start values - b Newton-Raphson Fails to converge Converging to wrong a solution Newton-Krylov singularity 3.5 Newton-Homotopy 0.72 0.73 The traditional Newton-Raphson method failed with both initial values, its modification, the Newton-Krylov method had singularity in the first case, and it was slowed down by the increasing number of the iteration ensuring acceptable precision in the second case. Using homotopy we do not need proper initial value, because this method is more robust than local methods, enlarges the domain of convergence and even faster than the traditional Newton’s type methods. Thank you for your attention!