Algebraic Geodesy and Geoinformatics - 2009 PART I - METHODS 2 Basics of Polynomials 2- 1 Representations of Polynomials 2- 1- 1 List of monomials In Geodesy and Geoinformatics, most observations are related to the unknowns through equations of algebraic (polynomial) type. Let us consider the following univariate polynomial, poly Clear@"Global‘*"D poly = a + b - c x ^ 2; with variables, var = x; Test whether poly is a polynomial, PolynomialQ@poly, varD True A polynomial is a multivariate product of monomials of the form x1 Α1 x2 Α2 ...xn Αn , where (Α1 ,...,Αn ) Î Zn in the variables x1 ,..., xn . Monomials of the polynomial poly, MonomialList @poly, varD 9- c x2 , a + b= The polynomial can be reconstructed from the monomials, Apply@Plus, %D a + b - c x2 Let us consider the following multivariable polynomial, polym = a0 + a1 x1 + a2 x2 + a3 x12 + a4 x22 + a5 x1 x2; with variables, varm = 8x1, x2<; Test it, 2 Basics_of_Polynomials_02.nb PolynomialQ@polym, varmD True Monomials of this polynomial, MonomialList @polym, varmD 9a3 x12 , a5 x1 x2, a1 x1, a4 x22 , a2 x2, a0= The polynomial can be reconstructed, Apply@Plus, %D a0 + a1 x1 + a3 x12 + a2 x2 + a5 x1 x2 + a4 x22 2- 1- 2 List of coefficients of power of variable(s) A list of coefficients of powers of variables in polynomial, starting with power 0. coeffs = CoefficientList @poly, varD 8a + b, 0, - c< The polynomial can be reconstructed, FromDigits@Reverse@coeffsD, varD a + b - c x2 In multivariable case, the list of coefficients of powers of variables (x1, x2) in polynomial, starting with power 0 (see reconstruction) coeffs = CoefficientList @polym, varmD 88a0, a2, a4<, 8a1, a5, 0<, 8a3, 0, 0<< Reconstruction 8a0, a2, a4<.9x10 x20 , x10 x21 , x10 x22 = + 8a1, a5, 0<.9x11 x20 , x11 x21 , x11 x22 = + 8a3, 0, 0<.9x12 x20 , x12 x21 , x12 x22 = a0 + a1 x1 + a3 x12 + a2 x2 + a5 x1 x2 + a4 x22 or employing the list of coefficients and the list of variables, Fold@FromDigits@Reverse@ð1D, ð2D &, coeffs, varmD Expand a0 + a1 x1 + a3 x12 + a2 x2 + a5 x1 x2 + a4 x22 One may use different symbols for variables, Fold@FromDigits@Reverse@ð1D, ð2D &, coeffs, 8x, y<D Expand a0 + a1 x + a3 x2 + a2 y + a5 x y + a4 y2 2- 1- 3 List of exponent vectors and coefficients of variable(s) The list of exponent vectors and coefficients for the monomial in polynomial with respect to the variable(s) Basics_of_Polynomials_02.nb 3 CoefficientRules @poly, varD 882< ® - c, 80< ® a + b< FromCoefficientRules @%, 8x<D a + b - c x2 In multivariable case, CoefficientRules @polym, varmD 882, 0< ® a3, 81, 1< ® a5, 81, 0< ® a1, 80, 2< ® a4, 80, 1< ® a2, 80, 0< ® a0< Reconstruction of the polynomial FromCoefficientRules @%, 8x1, x2<D a0 + a1 x1 + a3 x12 + a2 x2 + a5 x1 x2 + a4 x22 2- 2 Polynomial Degree Let us consider the following polynomials p = 2 x + x ^ 3 y ^ 2 + y ^ 2; It can be represented as a list of exponent vectors and coefficients of variables x and y, CoefficientRules @p, 8x, y<D 883, 2< ® 1, 81, 0< ® 2, 80, 2< ® 1< and Map@8ð@@1DD, ð@@2DD< &, CoefficientRules @p, 8x, y<DD 8883, 2<, 1<, 881, 0<, 2<, 880, 2<, 1<< The monomials are x3 y2 , with coefficient 1, and x1 y0 with coefficient 2 and x0 , y2 with coeffient 1. The degree of such a monomial is defined as the sum of the involved exponents of the variables. For example, the first monomial x3 y2 , has degree 3 + 2 = 5, etc. The degree of the polynomial is the maximum degree of its constituent monomials. In this case max( 5, 1, 2) = 5. In Mathematica one may define the following function to compute the degree of a polynomial, MultivariatePolynomDegree @poly_, var_D := Max@Map@Apply@Plus, ðD &, Map@ð@@1DD &, Map@8ð@@1DD, ð@@2DD< &, CoefficientRules @poly, varDDDDD applying it to polynomial p MultivariatePolynomDegree @p, 8x, y<D 5 Given m algebraic (polynomial) observational equations, where m is the dimension of the observation space Y of order L in n variables (unknowns) (where n is the dimension of the parameter space X, the application of algebraic least squares solution (ALESS) to the algebraic observation equations gives (2 L - 1) as the degree of the set of nonlinear algebraic normal equations. There exists n normal equations of the polynomial degree (2 L - 1) to be solved. Example. (Pseudo-ranging problem). For pseudo-ranging or distance equations, the degree of the polynomials in the algebraic observational equations is L = 2. If we take the “pseudo-ranges squared” or “distances squared”, a necessary procedure in order to make the observational equations “algebraic” or “polynomial”, and implement ALESS, the objective function which is of degree L = 4 reduces by one to degree L = 3 upon differentiating once. The normal equations are of degree L = 3 as expected. Let us consider the following polynomials (now in this case n = m) 4 Basics_of_Polynomials_02.nb Example. (Pseudo-ranging problem). For pseudo-ranging or distance equations, the degree of the polynomials in the algebraic observational equations is L = 2. If we take the “pseudo-ranges squared” or “distances squared”, a necessary procedure in order to make the observational equations “algebraic” or “polynomial”, and implement ALESS, the objective function which is of degree L = 4 reduces by one to degree L = 3 upon differentiating once. The normal equations are of degree L = 3 as expected. Let us consider the following polynomials (now in this case n = m) f1 = x12 + 2 a12 x1 x2 + x22 + a0; f2 = x22 + 2 b23 x2 x3 + x32 + b0; f3 = x32 + 2 c31 x3 x1 + x12 + c0; Let us consider f1, f2 and f3 as observational equations, then their degree L = Map@MultivariatePolynomDegree @ð, 8x1, x2, x3<D &, 8f1, f2, f3<D 82, 2, 2< The objective function g = f12 + f22 + f32 ; and its degree MultivariatePolynomDegree @g, 8x1, x2, x3<D 4 Differentiating to get the normal equations Eqs = Map@D@g, ðD &, 8x1, x2, x3<D; their degrees are Map@MultivariatePolynomDegree @ð, 8x1, x2, x3<D &, EqsD 83, 3, 3< indeed 2L -1 83, 3, 3< 2- 3 Operations "Addition" and "Multiplication" Addition is associative Hf1 + f2L + f3 f1 + Hf2 + f3L True Zero element exists f1 + 0 == f1 True Inverse exists f1 + H- f1L 0 True It is commutative Basics_of_Polynomials_02.nb It is commutative f1 + f2 f2 + f1 True Multiplication is associative Hf1 * f2L * f3 == f1 * Hf2 * f3L True Identity element exists f1 * 1 f1 True Multiplication is distributive for addition f1 * Hf2 + f3L == f1 * f2 + f1 * f3 Simplify True 2- 4 Polynomial Divison Definition (Polynomial division). Consider the polynomial ring k[x] whose elements are polynomials f (x) and g (x). There exists unique polynomials p(x) and r(x) also elements of polynomial ring k[x] such that f (x) = g (x) p (x) + r (x), with either r(x) = 0 or degree of r(x) is less than the degree of g(x). Let us consider the following two univariate polynomials, f = x2 ; g = 1 + 2 x; The quotient q = PolynomialQuotient @f, g, xD 1 - x + 4 2 the remainder r = PolynomialRemainder @f, g, xD 1 4 indeed g * q + r == f Simplify True and MultivariatePolynomDegree @g, 8x<D > MultivariatePolynomDegree @r, 8x<D True In multivariate case 5 6 Basics_of_Polynomials_02.nb In multivariate case f = x2 y + x y2 - 3 x2 y2 - 3 x y3 ; g = x + y - x2 ; the quotient in respect of variable x q = PolynomialQuotient @f, g, xD - y + 3 y2 the remainder r = PolynomialRemainder @f, g, xD y2 - 3 y3 + x Iy - 2 y2 - 3 y3 M indeed g * q + r == f Simplify True and again MultivariatePolynomDegree @g, 8x<D > MultivariatePolynomDegree @r, 8x<D True However, this relation is not true when we consider both variables (x, y) MultivariatePolynomDegree @g, 8x, y<D > MultivariatePolynomDegree @r, 8x, y<D False Now, considering the other variable, y q = PolynomialQuotient @f, g, yD x3 + 3 x4 - 3 x5 + Ix - 3 x3 M y - 3 x y2 r = PolynomialRemainder @f, g, yD - x4 - 2 x5 + 6 x6 - 3 x7 indeed g * q + r == f Simplify True and MultivariatePolynomDegree @g, 8y<D > MultivariatePolynomDegree @r, 8y<D True but again MultivariatePolynomDegree @g, 8x, y<D > MultivariatePolynomDegree @r, 8x, y<D False 2- 5 Factoring Polynomials Basics_of_Polynomials_02.nb 2- 5 Factoring Polynomials In order to understand the factorization of polynomials, it is essential to revisit some of the properties of prime numbers of integers. This is due to the fact that polynomials behave like integers. Whereas for integers, any integer n > 1 is either prime (i.e. can only be factored by 1 and n itself) or a product of prime numbers, a polynomial f (x) Î k[x] is either irreducible in k[x] or factors as a product of irreducible polynomials in the field k[x]. Let us consider the following polynomial and test it whether irreducible over rationals, IrreduciblePolynomialQ Ax3 + 1E False FactorAx3 + 1E H1 + xL I1 - x + x2 M but IrreduciblePolynomialQ AI1 - x + x2 ME True 3 However, this polynomial is not irreducible over algebraic number IrreduciblePolynomialQ B1 - x + x2 , Extension ® 3 -1 -1 F False because SolveA1 - x + x2 0, xE 99x ® H- 1L13 =, 9x ® - H- 1L23 == In multivariable case f = x2 y + x y2 - 3 x2 y2 - 3 x y3 ; fc = Factor@fD - x y Hx + yL H- 1 + 3 yL the inverse operation Expand@fcD x2 y + x y2 - 3 x2 y2 - 3 x y3 These two multivariate polynomials are irreducibles over rationals IrreduciblePolynomialQ @8x ^ 2 - 2 y ^ 4, x ^ 4 - 3 y ^ 2<D 8True, True< but over 3 , the second polynomial is not irreducible, IrreduciblePolynomialQ Bx ^ 4 - 3 y ^ 2, Extension ® False indeed 3 F 7 8 Basics_of_Polynomials_02.nb indeed 3 F FactorBx ^ 4 - 3 y ^ 2, Extension ® 1 3 J 3 x2 - 3 yN J 3 x2 + 3 yN Let us factorize the following polynomials of three variables over the rational numbers 9 y2 p= 33 x y2 - 184 x2 y2 100 - 25 384 x3 y3 25 24 x3 y z2 + 144 3 20 x4 y z2 - 64 25 x y3 z2 + 12 x2 y3 z2 - 5 3 y z4 5 - 64 3 y2 z2 80 - 2 x y2 z2 + 48 20 16 x3 y3 z2 + 5 9 z4 x2 y2 z2 - 46 x2 y z2 - 5 96 23 x2 z4 + 64 x y z4 + 3 x2 y z4 - 6 x3 y z4 + 4 x4 y z4 + x y z2 + x3 y2 z2 + 5 33 x z4 - 25 20 5 256 8 33 - 25 - 5 9 y z2 + 192 x2 y3 + 25 64 x3 y4 - 25 x5 y z2 + 8 x y3 - 25 48 x2 y4 + 5 5 4 x5 z4 + 12 x y4 3 y3 + 25 25 5 - y4 + 256 x5 y2 - 5 256 x4 y3 25 576 x4 y2 + 25 + y3 z2 96 x3 y2 + y2 z4 15 x3 z4 + 9 x4 z4 - 2 3 64 x4 y2 z2 + 5 8 64 16 x y2 z4 + 3 x2 y2 z4 - x3 y2 z4 ; 4 pf = Factor@pD H- 1 + 4 xL3 H3 - 4 x + 2 yL2 I8 y + 5 z2 M 2 6400 One may try to factorize a polynomial over real numbers, too Factor@x ^ 3 - x ^ 2 + 5.12 x + 5.23D 1. H0.797915 + xL I6.55458 - 1.79791 x + x2 M However, the result can be incorrect! Considering the real representation of the polynomials of three variables pr = N@pD 0.09 y2 - 1.32 x y2 + 7.36 x2 y2 - 19.2 x3 y2 + 23.04 x4 y2 - 10.24 x5 y2 + 0.12 y3 1.6 x y3 + 7.68 x2 y3 - 15.36 x3 y3 + 10.24 x4 y3 + 0.04 y4 - 0.48 x y4 + 1.92 x2 y4 2.56 x3 y4 + 0.1125 y z2 - 1.65 x y z2 + 9.2 x2 y z2 - 24. x3 y z2 + 28.8 x4 y z2 12.8 x5 y z2 + 0.15 y2 z2 - 2. x y2 z2 + 9.6 x2 y2 z2 - 19.2 x3 y2 z2 + 12.8 x4 y2 z2 + 0.05 y3 z2 - 0.6 x y3 z2 + 2.4 x2 y3 z2 - 3.2 x3 y3 z2 + 0.0351563 z4 - 0.515625 x z4 + 2.875 x2 z4 - 7.5 x3 z4 + 9. x4 z4 - 4. x5 z4 + 0.046875 y z4 - 0.625 x y z4 + 3. x2 y z4 6. x3 y z4 + 4. x4 y z4 + 0.015625 y2 z4 - 0.1875 x y2 z4 + 0.75 x2 y2 z4 - 1. x3 y2 z4 Factor@prD - 2.56 I- 0.0351563 y2 + 0.515625 x y2 - 2.875 x2 y2 + 7.5 x3 y2 - 9. x4 y2 + 4. x5 y2 - 0.046875 y3 + 0.625 x y3 - 3. x2 y3 + 6. x3 y3 - 4. x4 y3 - 0.015625 y4 + 0.1875 x y4 - 0.75 x2 y4 + 1. x3 y4 0.0439453 y z2 + 0.644531 x y z2 - 3.59375 x2 y z2 + 9.375 x3 y z2 - 11.25 x4 y z2 + 5. x5 y z2 - 0.0585938 y2 z2 + 0.78125 x y2 z2 - 3.75 x2 y2 z2 + 7.5 x3 y2 z2 - 5. x4 y2 z2 0.0195313 y3 z2 + 0.234375 x y3 z2 - 0.9375 x2 y3 z2 + 1.25 x3 y3 z2 - 0.0137329 z4 + 0.201416 x z4 - 1.12305 x2 z4 + 2.92969 x3 z4 - 3.51563 x4 z4 + 1.5625 x5 z4 0.0183105 y z4 + 0.244141 x y z4 - 1.17188 x2 y z4 + 2.34375 x3 y z4 - 1.5625 x4 y z4 0.00610352 y2 z4 + 0.0732422 x y2 z4 - 0.292969 x2 y2 z4 + 0.390625 x3 y2 z4 M Length@%D 2 Now, we have only two factors instead of three! Therefore it is better to rationalize the coefficients before factoring, Basics_of_Polynomials_02.nb myFactor@x_D := N@Factor@MapAll@Rationalize@ð, 0D &, xDD, Precision@xDD myFactor@prD - 0.00015625 H- 1. + 4. xL3 H3. - 4. x + 2. yL2 I8. y + 5. z2 M 2 indeed N@pfD - 0.00015625 H- 1. + 4. xL3 H3. - 4. x + 2. yL2 I8. y + 5. z2 M 2 As we have seen sometimes factoring over integer (rational, real) numbers is not possible, p = 3 x ^ 3 + 7 x ^ 2 - 9; Factor@pD - 9 + 7 x2 + 3 x3 IrreduciblePolynomialQ @pD True In that case we can factor it approximately. Let us consider the solution Solve@3 x ^ 3 + 7 x ^ 2 - 9 0, xD 13 ::x ® - 7 :x ® - 7 9 18 :x ® - 7 1 1 1501 + 9 2445 9 1 - 9 27 18 1 1 9 2 J1501 + 27 + 2 2 13 J1 + ä 3 N 1501 J1 - ä 3 N 1501 27 2445 1 - - 2 2 18 13 27 2445 1 - - 2 2 1501 Now we can use the algebraic number - 27 18 1 2 490 394 032 27 2445 2 2445 N 1 J1 + ä 3 N 1 2 2 J1501 + 27 2445 N 13 >, J1501 + 27 2445 N 13 >> 13 1501 213 J1501 - 27 2445 N K11 907 223 J1501 - 27 2445 N + 147 223 1701 213 J1501 - 27 2445 N + 21 213 23 13 23 K134 456 + 4802 223 J1501 - 27 in form of real numbers 3 N F K- 67 228 + 4802 223 J1501 - 27 27 213 J1 - ä as extension 2 - >, 2 13 1501 13 13 2445 2 FactorBp, Extension ® 2445 N 2445 J1501 - 27 2445 J1501 - 27 + 27 213 2445 N 23 2445 J1501 - 27 2445 J1501 - 27 13 2445 N + 2445 N 23 2445 N 13 2445 N + 1501 213 J1501 - 27 O x + 86 436 x2 O - 86 436 xO + 23 + 2445 N 23 + 9 10 Basics_of_Polynomials_02.nb N@%, 20D - 4.0154288323479246115 ´ 10-10 H82 557.888784598526618 - 86 436.000000000000000 xL I271 488.85004168527499 + 284 241.88878459852662 x + 86 436.000000000000000 x2 M or Expand@%@@1DD %@@2DDD %@@3DD H- 0.000033150532696345028271 + 0.000034707760655282521172 xL I271 488.85004168527499 + 284 241.88878459852662 x + 86 436.000000000000000 x2 M We have got the approximate factoring in form of real number, which can be written in rational form Rationalize@%, 0D 325 998 809 - x 29 615 763 553 273 + 9 833 893 530 041 7 818 812 748 415 x + 28 812 109 086 482 + 86 436 x2 27 507 602 Let us check this result, N@Expand@%DD - 9. + 7.39902 ´ 10-21 x + 7. x2 + 3. x3 elinimating numerical error, indeed Chop@%D - 9. + 7. x2 + 3. x3 2- 6 Polynomial Roots More often than not, the most encountered interaction with polynomials is the solution of a polynomial equations in terms of finding their roots. As an example, consider the simple planar ranging case where distances are measured from two known points to an unknown station. In such a case, the measured distances are normally related to the unknown station coordinates by multivariate quadratic equations whose intersection leads to the solution of two univariate quadratic equations. If for instance point P1 whose coordinates are {x1 , y1 } is occupied and distance s1 measured to another point P0 whose coordinates {x0 , y0 } are unknown, the relationship between the measured distance and the coordinates would be the multivariate quadratic polynomial, s1 2 = Hx1 - x0 L2 + Hy1 - y0 L2 or eq1 = a x02 + b x0 + c 0; and similarly Clear@fD eq2 = d y02 + ey0 + f 0; Solving this system, it is clear, that solution can exist over reals, but considering the physical problem, cannot exist over complexes. Basics_of_Polynomials_02.nb 11 Solve@8eq1, eq2<, 8x0, y0<D ::y0 ® - - ey0 - f b2 - 4 a c -b , x0 ® 2a d :y0 ® - ey0 - f -b - b2 - 4 a c , x0 ® 2a d >, :y0 ® - - ey0 - f -b + 2a d >, :y0 ® b2 - 4 a c , x0 ® - ey0 - f -b + b2 - 4 a c , x0 ® d 2a >, >> Let us look for the solution of the following polynomial over integers eq = y2 - 12 0 ; Reduce@eq, y, IntegersD False which means, there is no solution over integers, Reduce@eq, y, RationalsD False even no solution over rationals. However it has solution over real numbers Reduce@eq, y, RealsD y -2 3 ÈÈ y 2 3 The following equation has solution over rational numbers, ReduceAy2 - 9 0, y, RationalsE y - 3 ÈÈ y 3 This equation has solution over complex number, but has not over reals, ReduceAy2 + 9 0, y, RealsE False ReduceAy2 + 9 0, y, ComplexesE y - 3 ä ÈÈ y 3 ä Polynomials with degree higher than four, in general, have solution only over algebraic numbers represented by the roots of irreducible polynomials over rational. Remark: A polynomial p(x) is irreducible if there do not exist nonconstant polynomials p1 (x), p2 (x) such that p = p1 × p2 . sol = ReduceA 14 x6 + x + 12 0, x, ComplexesE x RootA12 + ð1 + 14 ð16 &, 1E ÈÈ x RootA12 + ð1 + 14 ð16 &, 2E ÈÈ x RootA12 + ð1 + 14 ð16 &, 3E ÈÈ x RootA12 + ð1 + 14 ð16 &, 4E ÈÈ x RootA12 + ð1 + 14 ð16 &, 5E ÈÈ x RootA12 + ð1 + 14 ð16 &, 6E For example, the first polynomial First@solD x RootA12 + ð1 + 14 ð16 &, 1E 12 Basics_of_Polynomials_02.nb First@%@@2DDD@xD 12 + x + 14 x6 IrreduciblePolynomialQ A12 + x + 14 x6 E True This can be solved approximately via numerical method with a prespecified precision NSolveA12 + x + 14 x6 , x, WorkingPrecision ® 20E@@1DD 8x ® - 0.83746575913690524254 - 0.47561849711498361523 ä< 2- 7 Minimal Polynomials We presented the number ring concept and extended the sets from the sets of natural numbers N to the set of complex number C in order to cater for expanded operations. For polynomials, the roots may fail to exist in one set say Q but exist in another set R. The polynomial y2 - 2 for example, has no roots in Q but the roots exist in R. ReduceAy 2 - 2 0, RationalsE False ReduceAy 2 - 2 0, RealsE y- 2 ÈÈ y 2 The expansion of the set from Q to R is also called field extension of k. It may occur however that in the polynomial ring k[x], the solution Ξ satisfies not only the polynomial p(x) but also another polynomial h(x), where p(x) and h(x) are both elements of k[x]. In case several polynomials in k[x] have Ξ as a root and the polynomials are multiples of the polynomial of least degree that also contains Ξ as root, the polynomial of least degree is termed the minimal polynomial. Let us construct a polynomial with a root 1+ 2 , which polynomial has lowest degree minpoly = MinimalPolynomial @Sqrt@1 + Sqrt@2DD, xD - 1 - 2 x2 + x4 p1 = Plot@minpoly, 8x, - 2, 2<, Epilog ® 8Red, PointSize@LargeD, Point@8Sqrt@1 + Sqrt@2DD, 0<D<D 6 4 2 -2 -1 1 2 -2 Fig. 2.1 The minimal polynomial for the root Another polynomial, which has this root too, but having higher degree 1+ 2 Basics_of_Polynomials_02.nb poly = minpoly Hx - 1L x Expand x - x2 + 2 x3 - 2 x4 - x5 + x6 p2 = Plot@poly, 8x, - 2, 2<, Epilog ® 8Blue, PointSize@LargeD, Point@81, 0<D, Point@80, 0<D, Red, PointSize@LargeD, Point@8Sqrt@1 + Sqrt@2DD, 0<D<D; Show@8p2, p1<D 8 6 4 2 -2 -1 1 2 -2 -4 Fig. 2.2 Another polynomial with the root 1+ 2 , but it is not minimal polynomial for this root Solve@poly 0, xD :8x ® 0<, 8x ® 1<, :x ® - ä -1 + 2 >, :x ® ä -1 + 2 >, :x ® - or Reduce@poly 0, x, RationalsD 1+ 2 1+ 2 Î Rationals && x - 1+ 2 ÈÈ Î Rationals && x 1+ 2 ÈÈ x 0 ÈÈ x 1 Minimal polynomials for different numbers b = 3; Head@bD Integer MinimalPolynomial @b, xD -3 + x 5 b= ; Head@bD 2 Rational MinimalPolynomial @b, xD -5 + 2 x 7ä b = 3+ ; Head@bD 4 Complex 1+ 2 >, :x ® 1+ 2 >> 13 14 Basics_of_Polynomials_02.nb MinimalPolynomial @b, xD 193 - 96 x + 16 x2 b= 2 + 5 ; AlgebraicIntegerQ @bD True Representation of algebraic numbers as elements of a finite extension of rationals is the following, ToNumberField @bD AlgebraicNumber ARootA9 - 14 ð12 + ð14 &, 4E, 80, 1, 0, 0<E Polynomial in x corresponding to the algebraic number object MinimalPolynomial @b, xD 9 - 14 x2 + x4 Approximate solution NSolve@% 0, xD 88x ® - 3.65028<, 8x ® - 0.821854<, 8x ® 0.821854<, 8x ® 3.65028<< indeed, b in real form, b N 3.65028 and b as algebraic number is really root of the minimal polynomial, 9 - 14 x2 + x4 . x ® b Simplify 0 Let us consider {a1 ,...,an < algebraic numbers. One has to define { f1 (z),..., fn (z)}, fi Î Q[z] polynomials with rational coeffients and a b algebraic number like fi (b) = ai , i =1,...n. This is an algebraic field extention of Q[z] with b as a primitive element, Let a1 and a2 be two algebraic numbers, 3 a1 = 14 ; a2 = Sqrt@3D; 7 Here is the function, which creates the polynomials fi and b for ai , PrimitiveElement @z_, algs_ListD := Module@8ans = ToNumberField @algsD, aa<, If@ListQ@ansD, aa = Select@ans, Head@ðD === AlgebraicNumber &D; ans = 8If@aa === 8<, 1, aa@@1, 1DDD, AlgebraicNumberPolynomial @ans, zD<D; ans ; ListQ@ansDD; 8b, f< = PrimitiveElement @z, 8a1, a2<D; The algebraic number b b RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E The two polynomials with rational coefficients Basics_of_Polynomials_02.nb f : 9 z3 16 151 z + 84 490 z5 - 6035 z7 - 36 210 2 027 760 63 z3 4081 z ,- 12 070 7 z5 + 6035 z7 + 36 210 289 680 Substituting b into the first polynomials f@@1DD . z ® b 16 151 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E + 84 490 3 9 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E 6035 5 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E 36 210 7 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E 2 027 760 The reduced form RootReduce@%D RootA- 3 + 7 ð14 &, 2E and we get a1 ToRadicals@%D 3 14 7 Similarly f@@2DD . z ® b 4081 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E - 12 070 3 63 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E + 6035 5 7 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E + 36 210 7 RootA1 040 400 - 37 152 ð12 - 2004 ð14 - 12 ð16 + ð18 &, 4E 289 680 The reduced form RootReduce@%D 3 now we get directly a2 because it is real number. > 15 16 Basics_of_Polynomials_02.nb 2- 8 Univariate Polynomials with Real Coefficients 2- 8- 1 Quadratic Polynomials We shall see later, that the solution of a system of polynomial equations can be reduced to the solution of a univariate polynomial. Therefore it is useful to study the solution of polynomials with a single variable. We revisit the various types of univariate polynomials with the coefficients in the field R, which we often use to manipulate our measurements. We recapture the basic high school mathematics of inferring the roots of the polynomials from the coeffiients. Polynomials of degree 2 are known as quadratic polynomials. For univariate cases, they take the form ax2 + bx + c = 0. The general solution of quadratic equations given by the quadratic formula -b ± x= b2 - 4 a c 2a or 2c x= -b ± b2 - 4 a c This is a solution indeed, substituting it into the equation SimplifyBIa x2 + b x + cM . x -> F 2c b2 - 4 a c -b + 0 If a and c are small numbers, the possibility of the numerical error is increasing, since -b ± b2 - 4 a c » -b ± b we should substract numbers which are nearly the same. In that case, it is better to use the following formula, q=- 1 2 b + Sign HbL b2 - 4 a c Remark: Sign(x) gives -1, 0 or 1 depending on whether x is negative, zero, or positive. then x1 = q a and x2 = Let us consider a quadratic polynomial with the following coefficients 1 a= 2 ; b = 12; c = - 106 The exact solution is ; 107 c q Basics_of_Polynomials_02.nb 1 SolveB ::x ® 1 5 2 x2 + 12 x - 106 17 0, xF 107 J- 30 000 000 - 900 000 000 000 005 N>, :x ® 1 30 000 000 + >> 900 000 000 000 005 The approximated value of the smallest root with 25 digits 1 NB , 25F 30 000 000 + 900 000 000 000 005 1.666666666666664351851852 ´ 10-8 Employing the standard formula with 5 digits, SetPrecision B -b + b2 - 4 a c , 5F 2a 0. ´ 102 or using 25 digits SetPrecision B -b + b2 - 4 a c , 25F 2a 1.666666667 ´ 10-8 Using the special formula with 5 digits c NB , 5F - 1 2 b + Sign@bD b2 - 4 a c 1.6667 ´ 10-8 In general, every quadratic polynomial has exactly two real or two complex roots. From the coefficients, if b2 - 4 ac > 0, the roots are real but if b2 - 4 ac < 0 the roots are a pair of non real complex numbers.The case where b2 - 4 ac = 0 gives real and identical roots and is also known as the bifurcation point upon which the roots change sign. Let us consider the pairs of roots of the equation : 2 x2 + 5 x + c = 0 as function of the parameter c on the complex plain! 18 Basics_of_Polynomials_02.nb ListPlotBAppendBH8Re@ð1D, Im@ð1D< &L FlattenATableAx . NSolveA2 x2 + 5 x + c 0, xE, 8c, 2.5‘, 3.5‘, 0.02‘<EE, :Axes ® False, Frame ® True, FrameLabel ® 8"Real", "Imaginery"<F 0.4 Imaginery 0.2 0.0 -0.2 -0.4 -1.8 -1.6 -1.4 -1.2 -1.0 -0.8 Real Fig. 2.3 The roots of 2 x2 + 5 x + c = 0 as function of the parameter c, in range 2.5 £ c £ 3.5 where 2.5 £ c £ 3.5 with increment 0.02. The critical value of parameter c is 52 ccirt = 4´2 25 8 then SolveA2 x2 + 5 x + ccirt 0, xE ::x ® - 5 4 >, :x ® - 5 4 >> If c £ ccirt then the roots are reals, while c > ccirt the roots are complex. Let us consider, D = 0.1; SolveA2 x2 + 5 x + ccirt - D 0, xE 88x ® - 1.47361<, 8x ® - 1.02639<< SolveA2 x2 + 5 x + ccirt + D 0, xE 88x ® - 1.25 - 0.223607 ä<, 8x ® - 1.25 + 0.223607 ä<< In stability analysis of a dynamical system this critical parameter has vital importance. 2- 8- 2 Cubic Polynomials The polynomials of degree 3 take the form a x3 + b x2 + c x + d Considering a = 1, the solution is, 5 , 0>F, 4 Basics_of_Polynomials_02.nb 19 Clear@b, c, dD SolveAx3 + b x2 + c x + d 0, xE ::x ® - 213 I-b2 + 3 cM b - + 13 3 3 -2 b3 + 9 b c - 27 d + 3 3 -b2 c2 + 4 c3 + 4 b3 d - 18 b c d + 27 d2 13 -2 b3 + 9 b c - 27 d + 3 3 -b2 c2 + 4 c3 + 4 b3 d - 18 b c d + 27 d2 3 213 :x ® - J1 + ä b >, 3 N I-b2 + 3 cM + 13 3 3 223 -2 b3 + 9 b c - 27 d + 3 3 -b2 c2 + 4 c3 + 4 b3 d - 18 b c d + 27 d2 3 N -2 b3 + 9 b c - 27 d + 3 3 -b2 c2 + 4 c3 + 4 b3 d - 18 b c d + 27 d2 J1 - ä 13 >, 6 213 :x ® - J1 - ä b 3 N I-b2 + 3 cM + 13 3 3 J1 + ä 223 + 9 b c - 27 d + 3 3 -b2 3 N -2 b3 + 9 b c - 27 d + 3 3 -b2 c2 + 4 c3 + 4 b3 d - 18 b c d + 27 d2 -2 b3 c2 +4 c3 +4 b3 d - 18 b c d + 27 d2 13 6 213 >> the discriminant D from the coefficients b, c, d as D = - b2 c2 + 4 c3 + 4 b3 d - 18 b c d + 27 d 2 If D > 0 then the roots of the cubic polynomial are real and distinct. If D < 0, then one of the roots is real and the remaining two non real complex conjugate. In a case where D = 0, multiple roots all which are real are given. In case the coefficients b, c, d are all positive, then all of the three roots will be negative while if b, d are negative and c positive, all of the roots will be positive. 2- 8 - 3 Quartic Polynomials Quartic polynomials are those of degree 4. For example, one of the solution in case of a = 1 sol = SolveAx4 + b x3 + c x2 + d x + e 0, xE; 20 Basics_of_Polynomials_02.nb sol@@1DD Simplify :x ® 1 -3 b 12 3 / 3 b2 - 8 c + I4 213 Ic2 - 3 b d + 12 eMM 2 c3 - 9 b c d + 27 d2 + 27 b2 e - -4 Ic - 3 b d + 12 eM + I2 c - 9 c Hb d + 8 eL + 27 Id + b eMM 3 2 72 c e + 3 2 13 2 2 + 2 223 2 c3 - 9 b c d + 27 d2 + 27 b2 e - 72 c e + 13 -4 Ic2 - 3 b d + 12 eM + I2 c3 - 9 c Hb d + 8 eL + 27 Id2 + b2 eMM 3 2 6 / 3 b2 - 8 c - I2 213 Ic2 - 3 b d + 12 eMM - 2 c3 - 9 b c d + 27 d2 + 27 b2 e - 72 c e + 13 -4 Ic2 - 3 b d + 12 eM + I2 c3 - 9 c Hb d + 8 eL + 27 Id2 + b2 eMM 3 2 - 223 2 c3 - 9 b c d + 27 d2 + 27 b2 e - 72 c e + 13 -4 Ic2 - 3 b d + 12 eM + I2 c3 - 9 c Hb d + 8 eL + 27 Id2 + b2 eMM 3 3 3 Ib3 - 4 b c + 8 dM 2 + 2 13 Ic2 - 3 b d + 12 eMM / 3 b - 8 c + I4 2 2 c3 - 9 b c d + 27 d2 + 27 b2 e - 72 c e + -4 Ic2 - 3 b d + 12 eM + I2 c3 - 9 c Hb d + 8 eL + 27 Id2 + b2 eMM 3 13 2 + 2 223 2 c3 - 9 b c d + 27 d2 + 27 b2 e - 72 c e + -4 Ic - 3 b d + 12 eM + I2 c - 9 c Hb d + 8 eL + 27 Id + b eMM 2 3 3 2 2 13 2 > The discriminant term, D = - 4 Ic2 - 3 b d + 12 eM + I2 c3 - 9 c Hb d + 8 eL + 27 Id2 + b2 eMM Expand 3 2 - 27 b2 c2 d2 + 108 c3 d2 + 108 b3 d3 - 486 b c d3 + 729 d4 + 108 b2 c3 e - 432 c4 e - 486 b3 c d e + 2160 b c2 d e + 162 b2 d2 e - 3888 c d2 e + 729 b4 e2 - 3888 b2 c e2 + 3456 c2 e2 + 5184 b d e2 - 6912 e3 Usually we consider its normalized form D ’ = D H- 27L Expand b2 c2 d2 - 4 c3 d2 - 4 b3 d3 + 18 b c d3 - 27 d4 - 4 b2 c3 e + 16 c4 e + 18 b3 c d e 80 b c2 d e - 6 b2 d2 e + 144 c d2 e - 27 b4 e2 + 144 b2 c e2 - 128 c2 e2 - 192 b d e2 + 256 e3 - D ' > 0: four different real solutions or two complex cunjugate solutions D ' < 0: two different real solutions and one complex cunjugate solution D ' = 0: at least two of solutions are the same This can be computed with Mathematica, Basics_of_Polynomials_02.nb 21 This can be computed with Mathematica, Discriminant Ax4 + b x3 + c x2 + d x + e, xE b2 c2 d2 - 4 c3 d2 - 4 b3 d3 + 18 b c d3 - 27 d4 - 4 b2 c3 e + 16 c4 e + 18 b3 c d e 80 b c2 d e - 6 b2 d2 e + 144 c d2 e - 27 b4 e2 + 144 b2 c e2 - 128 c2 e2 - 192 b d e2 + 256 e3 2- 9 Methods for Investigating Roots 2- 9- 1 Logaritmic and Contour Plots on Complex Plane Here we introduce two graphical and an algebraic - numeric method to find roots of polynomials. Let us consider the following polynomial f = - 2829 + 65 593 z - 228 035 z2 + 536 375 z3 - 295 200 z4 + 222 000 z5 ; Ploting the logaritmic of the absolute value of f (z) + 1 on the complex plain. We use this additive constant to avoid singularity at abs( f(z)) = 0. Plot3D@Log@Abs@f . 8z ® x + ä y<D + 1D, 8x, - 0.5‘, 1<, 8y, - 3, 2<, PlotPoints ® 61, Mesh ® False, AxesLabel ® 8"ReHzL", "ImHzL", None<, PlotRange ® All, Ticks ® 8None, None, None<, ViewPoint ® 8- 2.89‘, - 1.076‘, 2.618‘<D ReHzL ImHzL Fig. 2.4 The surface of the function log(abs (f (z)) + 1) on the complex plain. The "holes" on the surface show the approximate positions of the roots. To get better approximation, we can display Re(f(z)) = 0 and Im(f(z)) = 0 contours on the complex plain. The cross points of these contours represent locations of the roots. sol = NSolve@f 0, zD; zz = z . sol 80.051165, 0.213937 - 0.29782 ä, 0.213937 + 0.29782 ä, 0.425345 - 1.29279 ä, 0.425345 + 1.29279 ä< 22 Basics_of_Polynomials_02.nb ImHzL Show@8ContourPlot@Re@f . 8z -> x + I y<D, 8x, - 0.5‘, 1<, 8y, - 3, 2<, Contours -> 80<, ContourShading -> False, DisplayFunction -> Identity, ContourStyle -> 8RGBColor@1, 0, 0D, Thickness@0.001‘D<, PlotPoints -> 61D, ContourPlot@Im@f . 8z -> x + I y<D, 8x, - 0.5‘, 1<, 8y, - 3, 2<, Contours -> 80<, ContourShading -> False, DisplayFunction -> Identity, PlotPoints -> 61, ContourStyle -> 8RGBColor@0, 0, 1D, Thickness@0.001‘D<D, Graphics@8PointSize@0.02‘D, HPoint@8Re@ð1D, Im@ð1D<D &L zz<D<, DisplayFunction -> $DisplayFunction , FrameTicks -> None, FrameLabel -> 8"ReHzL", "ImHzL"<D ReHzL Fig. 2.5 The contour plot of f(z) on the complex plain. Along the lines the real and imaginary parts are zero. 2- 9- 2 Isograph Simulator Let us consider the exponential form of the complex numbers z = r ã i Φ , and display f(z) as function of Φ at constant r. Changing r value, find the proper r value at which the curve of f(z) crosses the origin of the coordinate system of the complex plane (0, 0). The function IsoGraphSimulator simulates this process. The numerical values of the roots are computed via NSolve. IsoGraphSimulator @eqn_Equal, var_D := Module@8p<, Show@ GraphicsGrid @HAppend@Partition@ð1, 3D, Complement@ð1, Flatten@Partition@ð1, 3DDDD &L@ HParametricPlot @Evaluate@H8Re@ð1D, Im@ð1D< &L@Subtract eqn . var ® ð1 Exp@ä pDDD, 8p, 0, 2 Π<, AspectRatio ® Automatic, Axes ® True, FrameTicks ® False, Frame ® True, AxesOrigin ® 80, 0<, PlotPoints ® 20, PlotStyle ® RGBColor@1, 0, 0D, PlotLabel ® "È" <> ToString@varD <> "È=" <> ToString@N@ð1, 3DD, DisplayFunction ® IdentityD &L Sort@x . NSolve@eqn, varD, Abs@ð1D < Abs@ð2D &DDDDD Basics_of_Polynomials_02.nb IsoGraphSimulator[(f/.z->x)==0, x] ÈxÈ=0.051165 ÈxÈ=0.213937 + 0.29782 I ÈxÈ=0.425345 + 1.29279 I ÈxÈ=0.425345 - 1.29279 I 23 ÈxÈ=0.213937 - 0.29782 I Fig. 2.6 The roots of f(z) displayed by isograph simulator. 2- 9- 3 Application of Inverse Series We consider the x = r(y), as the inverse mapping of y = f (x). Then the roots of f(x) can be computed as r(0), while f(r(0)) = 0. In order to illustrate the idea let us consider the power series expansion for following second order polynomial, about the point x = 0 to order four, Clear@aD Series@a x ^ 2 + b x + c, 8x, 0, 4<D c + b x + a x2 + O@xD5 The inverse series provides the approximation of the inverse function r(y), r = InverseSeries @%, yD y-c - a Hy - cL2 + 2 a2 Hy - cL3 b3 b - b5 5 a3 Hy - cL4 + O@y - cD5 b7 The r (0) gives the root of the polynomial f (x) Normal@rD . y ® 0 a c2 c - b 2 a2 c3 - b3 5 a3 c4 - b5 b7 One may recognize that the Hk + 1Lth term can be expressed as 24 Basics_of_Polynomials_02.nb -c^(k + 1) / b^(2k + 1) a^k Binomial[2 k, k]/(k + 1) ak b-1-2 k c1+k Binomial@2 k, kD 1+k Then, for example, considering the first four terms, we get Sum@- c ^ Hk + 1L b ^ H2 k + 1L a ^ k Binomial@2 k, kD Hk + 1L, 8k, 0, 3<D a c2 c - b 2 a2 c3 - 5 a3 c4 - b3 b5 b7 However, with infinity terms we get the analytical solution Sum@- c ^ Hk + 1L b ^ H2 k + 1L a ^ k Binomial@2 k, kD Hk + 1L, 8k, 0, Infinity<D b2 -4 a c b -1 + b2 2a Now we can apply this method to the polynomial considered as an example, Series@N@fD, 8z, 0, 20<D - 2829. + 65 593. z - 228 035. z2 + 536 375. z3 - 295 200. z4 + 222 000. z5 + O@zD21 the inverse r = InverseSeries @%, yD 0.0000152455 Hy + 2829.L + 8.08033 ´ 10-10 Hy + 2829.L2 + 5.66776 ´ 10-14 Hy + 2829.L3 + 3.91367 ´ 10-18 Hy + 2829.L4 + 2.14685 ´ 10-22 Hy + 2829.L5 + 2.00147 ´ 10-27 Hy + 2829.L6 1.89902 ´ 10-30 Hy + 2829.L7 - 3.98433 ´ 10-34 Hy + 2829.L8 - 5.76614 ´ 10-38 Hy + 2829.L9 6.85252 ´ 10-42 Hy + 2829.L10 - 6.79426 ´ 10-46 Hy + 2829.L11 - 5.16349 ´ 10-50 Hy + 2829.L12 1.66894 ´ 10-54 Hy + 2829.L13 + 3.69854 ´ 10-58 Hy + 2829.L14 + 1.05096 ´ 10-61 Hy + 2829.L15 + 1.77627 ´ 10-65 Hy + 2829.L16 + 2.38232 ´ 10-69 Hy + 2829.L17 + 2.64939 ´ 10-73 Hy + 2829.L18 + 2.32786 ´ 10-77 Hy + 2829.L19 + 1.18834 ´ 10-81 Hy + 2829.L20 + O@y + 2829.D21 One of the real root is Normal@rD . y ® 0 0.051165 Using this root, we can reduce the order of our polynomial to a quartic ff = PolynomialQuotient @f, Hz - %L, zD 55 291.7 - 201 334. z + 521 852. z2 - 283 841. z3 + 222 000 z4 The remainder close to zero PolynomialRemainder @f, Hz - %%L, zD 4.17849 ´ 10-8 Then we can use factoring to reduce this quartic. Do not forget that quintic can not be factored in general! Factor@fD - 2829 + 65 593 z - 228 035 z2 + 536 375 z3 - 295 200 z4 + 222 000 z5 However Basics_of_Polynomials_02.nb Factor@ffD 222 000. I1.85223 - 0.85069 z + z2 M I0.134466 - 0.427875 z + z2 M The roots of the second order polynomials NSolve@%@@2DD 0, zD 88z ® 0.425345 - 1.29279 ä<, 8z ® 0.425345 + 1.29279 ä<< NSolve@%%@@3DD 0, zD 88z ® 0.213937 - 0.29782 ä<, 8z ® 0.213937 + 0.29782 ä<< Now, we have all of the roots. In special case, canonical form (quintic) x 5- x - Ρ inverse series method can provide even analytical solution. Let us apply the method r = InverseSeries[Series[x^5 - x - Ρ, {x, 0, 15}], y]; Normal[r] /. y -> 0 - Ρ - Ρ5 - 5 Ρ9 - 35 Ρ13 Now the general term of the approximating series - Ρ^(4k + 1) Binomial[5k, k] / (4k + 1) Ρ1+4 k Binomial@5 k, kD 1+4k then Sum@- Ρ ^ H4 k + 1L Binomial@5 k, kD H4 k + 1L, 8k, 0, 3<D - Ρ - Ρ5 - 5 Ρ9 - 35 Ρ13 Considering infinite terms sol=Sum[- Ρ^(4k + 1) Binomial[5k, k] / (4k + 1), {k, 0, Infinity}] 1 2 3 4 1 3 5 3125 Ρ4 - Ρ HypergeometricPFQ B: , , , >, : , , >, F 5 5 5 5 2 4 4 256 Now, for example, let us to solve fff = 3 - z + z5 3 - z + z5 Employing our result we get a complex root, m = sol . Ρ ® - 3. 0.979062 - 0.625219 ä Then we can reduce the quintic to a third order polynomial ffff = PolynomialQuotient @fff, Hz - mL Hz - Conjugate@mDL, zD H2.22311 + 0. äL + H2.48479 + 0. äL z + H1.95812 + 0. äL z2 + z3 PolynomialRemainder @fff, Hz - mL Hz - Conjugate@mDL, zD I3.55271 ´ 10-15 + 0. äM - I8.88178 ´ 10-16 + 0. äM z 25 26 Basics_of_Polynomials_02.nb % Chop 0 Further reduction can be achieved with factoring Factor@ffffD Chop 1. HH0.308415 - 1.24993 äL + zL HH0.308415 + 1.24993 äL + zL H1.34129 + zL 2- 10 The zeros of Polynomial Systems 2- 10- 1 Bezout's Theorem In one variable case, the polynomial, p HxL = ad xd + ad-1 xd-1 + ... + a2 x2 + a1 x + a0 has d roots, counting multiplicities, in the field C of complex numbers according to the fundamental theorem of algebra. However in multivariable case, the situation is more complicated. To keep the discussion easy and transparent, we consider a system of two polynomials. Let us consider the following system, G = a1 + a2 x + a3 x y + a4 y; H = b1 + b2 x2 y + b3 x y2 ; BØzout’ s Theorem: Consider two polynomial equations in two unknowns: g(x,y) = h(x,y) = 0. If this system has only finitely many zeros (x, y)Î C2 , then the number of zeros is at most deg(g)* deg(h). Here deg(g) and deg(h) are the total degree of g(x,y) and h(x,y), respectively, see Section 2.2 Bezout’ Theorem is the best possible in the sense that almost all polynomial systems have deg(g)* deg(h) distinct solutions. degG = MultivariatePolynomDegree @G, 8x, y<D 2 degH = MultivariatePolynomDegree @H, 8x, y<D 3 These two polynomials have precisely four distinct zeros (x, y)Î C2 for generic choices of coefficients ai and b j . It means that a certain polynomial in the coefficients ai , b j , called the discriminant, should be non- zero. The discriminant can be computed as, R = Resultant@G, H, xD; S = Factor@Resultant@R, D@R, yD, yDD; Basics_of_Polynomials_02.nb 27 discriminantGH = Last@SD 4 a2 a33 a44 b31 b32 + a21 a23 a44 b21 b42 + 18 a1 a2 a3 a54 b21 b42 - 27 a22 a64 b21 b42 + 4 a31 a54 b1 b52 + 16 a2 a63 a4 b41 b2 b3 + 4 a21 a53 a4 b31 b22 b3 + 96 a1 a2 a43 a24 b31 b22 b3 - 132 a22 a33 a34 b31 b22 b3 + 22 a31 a33 a24 b21 b32 b3 + 94 a21 a2 a23 a34 b21 b32 b3 - 216 a1 a22 a3 a44 b21 b32 b3 + 108 a32 a54 b21 b32 b3 + 22 a41 a3 a34 b1 b42 b3 - 14 a31 a2 a44 b1 b42 b3 + 4 a21 a2 a53 b31 b2 b23 + 96 a1 a22 a43 a4 b31 b2 b23 132 a32 a33 a24 b31 b2 b23 + a41 a43 b21 b22 b23 + 116 a31 a2 a33 a4 b21 b22 b23 - 318 a21 a22 a23 a24 b21 b22 b23 + 396 a1 a32 a3 a34 b21 b22 b23 - 162 a42 a44 b21 b22 b23 + 22 a51 a23 a4 b1 b32 b23 - 30 a41 a2 a3 a24 b1 b32 b23 + 10 a31 a22 a34 b1 b32 b23 + a61 a24 b42 b23 + 4 a42 a33 a4 b31 b33 + 22 a31 a22 a33 b21 b2 b33 + 94 a21 a32 a23 a4 b21 b2 b33 216 a1 a42 a3 a24 b21 b2 b33 + 108 a52 a34 b21 b2 b33 + 22 a51 a2 a23 b1 b22 b33 - 30 a41 a22 a3 a4 b1 b22 b33 + 10 a31 a32 a24 b1 b22 b33 + 4 a71 a3 b32 b33 - 2 a61 a2 a4 b32 b33 + a21 a42 a23 b21 b43 + 18 a1 a52 a3 a4 b21 b43 27 a62 a24 b21 b43 + 22 a41 a32 a3 b1 b2 b43 - 14 a31 a42 a4 b1 b2 b43 + a61 a22 b22 b43 + 4 a31 a52 b1 b53 MultivariatePolynomDegree @discriminantGH , 8a1 , a2 , a3 , a4 , b1 , b2 , b3 , b4 <D 14 If this polynomial of degree 14 is non- zero, then the system {G(x, y) = 0, H(x, y) = 0} has four distinct complex zeros. Here the function Resultant computes the resultant of the two polynomials, see Section 2- 11- 1 and more details in Chapter 3. 2- 10- 2 Bernstein's Theorem Bezout’ s theorem would predict 2*3 = 6 common complex zeros for our system. Indeed, in projective geometry we would expect the cubic curve ( H = 0) and the quadratic curve (G = 0) to intersect in six points. To understand why is four and not six let us consider convex polygons associated with our system. A polytope is a subset of Rn which is the convex hull of a finite set of points. A 2-dimensional polytope is called polygon. Considering a polynomial f(x,y), f Hx, yL = a1 xu1 yv1 + a2 xu2 yv2 + ... + am xum yvm Each term xui yvi can be regarded as a lattice point Hui , vi L in the plane R2 . The convex hull of all these points is called the Newton polygon of f (x, y). Let us express it as, New H f L = conv HHui , vi L, i = 1, ..., mL This is a polygon in R2 having at most m vertices. In general, every polynomial in n unknowns can be represented by a Newton polytope in Rn . Let us consider the Newton polygons of our systems. The Newton polygon of the polynomial G is quadrangel with points (0,0), (1,0),(1,1) and (0,1), while that of the polynomial H is a triangle (0,0), (2,1), (1,2), see Fig. 2.7. 28 Basics_of_Polynomials_02.nb Fig. 2.7 Mixed area of Newton-polygons of the two polynomials The Minkowski sum of the two polygons, P and Q in the plane is, P + Q = {p + q : p Î P, q Î Q} The Newton polygon of the product of two polynomials is the Minkowski sum of the Newton polyon of these two polynomials, namely New (G*H) = New (G) + New (H) The product of the two polynomials, G * H Expand a1 b1 + x a2 b1 + x y a3 b1 + y a4 b1 + x2 y a1 b2 + x3 y a2 b2 + x3 y2 a3 b2 + x2 y2 a4 b2 + x y2 a1 b3 + x2 y2 a2 b3 + x2 y3 a3 b3 + x y3 a4 b3 The corresponding points can be seen on Fig. 2.7. So the Minkowski sum of the polygons mirrors the algebraic operation of multiplying polynomials. If P and Q are any two polygons then their mixed area can be defined as it follows, M (P, Q) = area (P + Q) - area (P) - area (Q) In our case, M HNew HGL, New HHLL = 13 2 -1- 3 =4 2 This number coincides with the number of common zeros of G and H. This is not an accident, but is an instance of the general theorem of Bernstein. Bernstein’s Theorem: If G and H are two generic bivariate polynomials, then the number of non-zero solutions of G(x,y) = H(x,y) =0 in C2 equals the mixed area M (New (G), New (H)). It is remarkable that Bezout’s theorem follows as a special case from Bernstein’s theorem. Namely, if g and h a general polynomials of degree d and e respectively, Basics_of_Polynomials_02.nb 29 g = a1 + a2 yd + a3 xd h = b1 + b2 ye + b3 xe then their Newton polygons are triangles, P = New (g) = conv ((0, 0), (0, d), (d, 0)) Q = New (h) = conv ((0, 0), (0, e), (e, 0)) P + Q = New (g* h) = conv ((0, 0), (0, d + e), (d + e, 0)) The areas of these triangles are, d 2 /2, e2 /2, Hd + eL2 /2, and hence M HP, QL = Hd + eL2 - 2 d2 - 2 e2 = d*e 2 Hence two general plane curves of degree d and e meet in d*c points. 2- 11 Computation zeros of Polynomial Systems 2- 11- 1 Resultants Elimination theory deals with the problem of eliminating one or more variables from a system of polynomial equations, thus reducing the problem to a smaller problem in fewer variables. For instance, if we wish to solve, U = a0 + a1 x + a2 x2 ; V = b0 + b1 x + b2 x2 ; U=V=0 with a2 ¹ 0 and b2 ¹ 0 then we can eliminate the variable x to get, Eliminate@8U 0, V 0<, xD Expand a0 a2 b21 - 2 a0 a2 b0 b2 - a0 a1 b1 b2 + a20 b22 - a22 b20 + a1 a2 b0 b1 - a21 b0 b2 This polynomial of of degree 4 is the resultant. It vanishes if and only if the given quadratic polynomials have common complex root x. Resultant@U, V, xD a22 b20 - a1 a2 b0 b1 + a0 a2 b21 + a21 b0 b2 - 2 a0 a2 b0 b2 - a0 a1 b1 b2 + a20 b22 Consider two polynomials in two variables, G(x, y) and H(x, y). Let us eliminate y ResGH y = Resultant@G, H, yD x2 a23 b1 + 2 x a3 a4 b1 + a24 b1 - x3 a1 a3 b2 x4 a2 a3 b2 - x2 a1 a4 b2 - x3 a2 a4 b2 + x a21 b3 + 2 x2 a1 a2 b3 + x3 a22 b3 We get an univariate polynomial in x of degree 4, which should be zero, ResGHy = 0 MapAExponentAResGH y , ðE &, 8x, y<E 84, 0< Similarly, 30 Basics_of_Polynomials_02.nb ResGH x = Resultant@G, H, xD a22 b1 + 2 y a2 a3 b1 + y2 a23 b1 + y a21 b2 + 2 y2 a1 a4 b2 + y3 a24 b2 - y2 a1 a2 b3 - y3 a1 a3 b3 - y3 a2 a4 b3 - y4 a3 a4 b3 So the two multivariate polynomials can be separated into two univariate polynomials. This resultant method can be extended for case n > 2 and various determinantal formulas are known for multivariate resultant, see Chapter 3. 2- 11- 2 Groebner Basis Let K be a field, K be its algebraic closure, R = K[x,y] be the algebra of polynomials in the variables {x, y}. Let G (x, y) and H (x, y) Ε R. Our objective is to solve the system f = G= H= 0. Let I be the ideal generated by G and H. Then exist polynomials g and h, that G (x, y)= Α g(x, y) + Β h (x, y) and similarly H (x, y) = Γ g (x, y) + ∆ h (x, y) If the basis {G, H} then the trivial coefficients are Α = ∆ = 1 and Γ = Β = 0. However, we can find other set of {g, h} polynomials as basis for the ideal. Groebner basis can provide a special basis, which is triangular, namely e.g., G (x, y)= Α gr1 (x) + Β gr2 (x, y) = {Α, Β}.{gr1 (x), gr2 (x, y)} where {Α, Β} is a not vanishing coefficient vector. Therefore {G, H} = 0 implies that {gr1 (x), gr2 (x, y)}= 0, and vica versa. This triangular system {gr1 (x), gr2 (x, y)}= 0 can be solved by successive elimination. In our case the Groebner basis of the ideal generated by G(x, y) and H(x, y) is, gr = GroebnerBasis @8G, H<, 8x, y<D; TableForm@grD -a22 b1 - 2 y a2 a3 b1 - y2 a23 b1 - y a21 b2 - 2 y2 a1 a4 b2 - y3 a24 b2 + y2 a1 a2 b3 + y3 a1 a3 b3 + y3 a2 a4 b3 + y4 a3 a4 b3 a2 a23 b1 + y a33 b1 + a21 a3 b2 + x a1 a2 a3 b2 - a1 a2 a4 b2 - x a22 a4 b2 + 2 y a1 a3 a4 b2 - y a2 a24 b2 + y2 a3 a24 b2 - y2 a1 a23 b3 - y3 a23 a4 b3 a1 + x a2 + x y a3 + y a4 a2 a3 b1 + y a23 b1 + a21 b2 + x a1 a2 b2 + 2 y a1 a4 b2 + x y a2 a4 b2 + y2 a24 b2 - y2 a1 a3 b3 - y3 a3 a4 b3 -a2 b1 - y a3 b1 + x y a1 b2 + x y2 a4 b2 + y2 a1 b3 + y3 a4 b3 -a3 b1 + x a1 b2 + x2 a2 b2 + x y a4 b2 + y a1 b3 + x y a2 b3 + y2 a4 b3 b1 + x2 y b2 + x y2 b3 This is a triangular system for x and y, Transpose@Map@Exponent@gr, ðD &, 8x, y<DD MatrixForm 0 1 1 1 1 2 2 4 3 1 3 3 2 2 G can be expressed in this basis. The corresponding coefficient vector is c and the r is the remainder, which should be zero, since G belonging to the ideal, Basics_of_Polynomials_02.nb 31 8c1 , r< = PolynomialReduce @G, gr, 8x, y<D :: a23 a2 + , a1 a2 a3 b2 - a22 a4 b2 a1 a2 a3 b2 - a22 a4 b2 y a3 , 0, 0, 0, 0, 0>, 0> a1 a2 a3 b2 - a22 a4 b2 indeed c1 .gr + r G Simplify True Similarly 8c2 , r< = PolynomialReduce @H, gr, 8x, y<D :: x a3 + a1 a2 a3 - a22 a4 y a3 a24 b2 Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L a33 b1 + a1 a3 a4 b2 - a2 a24 b2 Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L xy + a1 a2 a3 - a22 a4 - y2 a23 a4 b3 Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L a2 a3 b1 Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L y3 a3 a4 b3 Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L + , y Ia23 b1 + a1 a4 b2 M + Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L - y2 Ia24 b2 - a2 a4 b3 M + Ia1 a2 a3 - a22 a4 M Ha1 a3 b2 - a2 a4 b2 L , 0, 0, 0, 0, 0>, 0> and c2 .gr + r H Simplify True We can carry out the solution of the triangular Groebner basis directly, (computing Groebner basis followed by elimination) e.g. eliminating y from the Groebner basis to get x, 8gry< = GroebnerBasis @8G, H<, 8x, y<, yD 9- x2 a23 b1 - 2 x a3 a4 b1 - a24 b1 + x3 a1 a3 b2 + x4 a2 a3 b2 + x2 a1 a4 b2 + x3 a2 a4 b2 - x a21 b3 - 2 x2 a1 a2 b3 - x3 a22 b3 = and similarly 8grx< = GroebnerBasis @8G, H<, 8x, y<, xD 9- a22 b1 - 2 y a2 a3 b1 - y2 a23 b1 - y a21 b2 - 2 y2 a1 a4 b2 - y3 a24 b2 + y2 a1 a2 b3 + y3 a1 a3 b3 + y3 a2 a4 b3 + y4 a3 a4 b3 = which equal with the first polynomial in the Groebner basis, grx gr@@1DD Simplify True This is called reduced Groebner basis corresponding to variables x and y, respetively. Let us compare the result of the resultants, ResGH y and ResGH x ., ResGH y - gry Simplify True and 32 Basics_of_Polynomials_02.nb ResGH x - grx Simplify True Further details about Groebner basis and its computation can be found in Chapter 4. 2- 11- 3 Homotopy Method This method is originated from numerical algebraic geometry and belongs to the general class of numerical continuation method. The method operates in two stages. Firtsly, it exploits the structure of the system f(x) = 0 to find a root count (see Bezout’s and Bernstein Theorem) and construct a start system g(x) = 0 that has exactly as many regular solutions as the root count. This start system is embedded in the homotopy, h (x, t) = Γ (1 - t) g (x) + t f (x) = 0, t Î [0, 1] with Γ Î C a random number. Let the system to be solved, f1 = x2 + 4 y2 - 4; f2 = 2 y2 - x; an obvious the start system having the same polynomial degree, g1 = x2 - 1; g2 = y2 - 1; Forming homotopy function, Γ = ãä RandomReal@D ; H1 = Γ g1 H1 - tL + f1 t; H2 = Γ g2 H1 - tL + f2 t; Let us solve this system from t = 0 (x =1, y = 1) up to t =1 employing Newton- Raphson method. Tracing the first path from x0 = 1, y0 = 1 : t = 0.2; x0 = 1; y0 = 1; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 0.967086 - 0.00373753 ä, y ® 0.910266 + 0.0115502 ä< t = 0.4; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 1.02226 - 0.0166034 ä, y ® 0.848567 + 0.0105189 ä< t = 0.6; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 1.10047 - 0.0174594 ä, y ® 0.813419 + 0.0057322 ä< Basics_of_Polynomials_02.nb t = 0.8; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 1.17377 - 0.0102703 ä, y ® 0.795067 + 0.00194379 ä< t = 1.; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 9x ® 1.23607 + 6.31089 ´ 10-30 ä, y ® 0.786151 + 5.52203 ´ 10-29 ä= Eliminating small imaginary parts, % Chop 8x ® 1.23607, y ® 0.786151< Checking the result 8f1 , f2 < . % 90., - 2.22045 ´ 10-16 = Tracing the second path from x0 = 1, y0 = -1 : t = 0.2; x0 = 1; y0 = - 1; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 0.967086 - 0.00373753 ä, y ® - 0.910266 - 0.0115502 ä< t = 0.4; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 1.02226 - 0.0166034 ä, y ® - 0.848567 - 0.0105189 ä< t = 0.6; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 1.10047 - 0.0174594 ä, y ® - 0.813419 - 0.0057322 ä< t = 0.8; x0 = x . sol@@1DD; y0 = y . sol@@2DD; sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 8x ® 1.17377 - 0.0102703 ä, y ® - 0.795067 - 0.00194379 ä< t = 1.; x0 = x . sol@@1DD; y0 = y . sol@@2DD; 33 34 Basics_of_Polynomials_02.nb sol = FindRoot@8H1 0, H2 0<, 88x, x0 <, 8y, y0 <<D 9x ® 1.23607 + 4.73317 ´ 10-30 ä, y ® - 0.786151 - 5.52203 ´ 10-29 ä= Eliminating small imaginary parts, % Chop 8x ® 1.23607, y ® - 0.786151< Checking the result 8f1 , f2 < . % 90., - 2.22045 ´ 10-16 = The other two paths belong to the x0 = -1, y0 = 1 and x0 = -1, y0 = -1 initial conditions. We can employ GeoAlgebra package to solve the problem. First let us to load the package, << GeoAlgebra‘LinearHomotopy‘ The function we shall use LinearHomotopyFR, ? LinearHomotopyFR Computes the homotopy paths with direct path tracing. Input parameters: F - list of functions of the target system, G - list of functions of the start system, X - list of variables, X0 - list of initial values, Γ - list of complex weigths, n - number of subintervals, Λ - dummy variable. Output variables: sol@@1DD - list of the solutions, sol@@2DD - list of homotopy paths Therefore F = 8f1 , f2 <; G = 8g1 , g2 <; X = 8x, y<; X0 = 881, 1<, 8- 1, 1<, 81, - 1<, 8- 1, - 1<<; Γ = 81, 1< ä; sol = LinearHomotopyFR @F, G, X, X0, Γ, 100, ΛD; sol@@1DD 881.23607, 0.786151<, 8- 3.23607, 1.27202 ä<, 81.23607, - 0.786151<, 8- 3.23607, - 1.27202 ä<< These pairs are solution of the system, Map@8f1 , f2 < . 8x ® ð@@1DD, y ® ð@@2DD< &, sol@@1DDD 990., - 2.22045 ´ 10-16 =, 80., 0.<, 90., - 2.22045 ´ 10-16 =, 80., 0.<= The visualization of the paths can be achieved by the function Paths, Basics_of_Polynomials_02.nb 35 ? Paths Display homotopy paths. Input parameters: X - list of variables, sol - list of homotopy paths, X0 - list of initial values Paths@X, sol@@2DD, X0, ΛD yHΛL 0.15 0.10 Im Im xHΛL 0.05 0.00 -0.05 -0.10 -0.15 -0.20 -0.25 0.05 0.00 0.8 0.9 1.0 1.1 1.2 0.80 0.85 0.90 Re -3.0 -2.5 -2.0 -1.5 -1.0 1.2 1.0 0.8 0.6 0.4 0.2 0.0 0.0 0.2 Re 0.4 0.6 0.8 1.0 Re xHΛL yHΛL 0.05 0.00 -0.05 -0.10 -0.15 -0.20 -0.25 0.00 -0.05 Im Im 1.00 yHΛL 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0 Im Im xHΛL -0.10 0.8 0.9 1.0 1.1 -0.15 -1.00 -0.95 -0.90 -0.85 -0.80 1.2 Re Re xHΛL 1.4 1.2 1.0 0.8 0.6 0.4 0.2 0.0 yHΛL Im Im 0.95 Re -3.0 -2.5 -2.0 -1.5 -1.0 0.0 -0.2 -0.4 -0.6 -0.8 -1.0 -1.2 -1.0 -0.8 -0.6 -0.4 -0.2 Re 0.0 Re Fig. 2.8 Homotopy paths belonging to the different solutions of the start system Employing Global Numerical Solver (GNS), built - in Mathematica, we get, NSolve@8f1 , f2 <, 8x, y<D 88x ® - 3.23607, y ® 0. - 1.27202 ä<, 8x ® - 3.23607, y ® 0. + 1.27202 ä<, 8x ® 1.23607, y ® - 0.786151<, 8x ® 1.23607, y ® 0.786151<< A computational advantage of the homotopy method that the tracing of the different paths can be carried out simultaneously and independently, consequently the homotopy is a parallel algorithm by nature. See further details in Chapter 5. 36 Basics_of_Polynomials_02.nb A computational advantage of the homotopy method that the tracing of the different paths can be carried out simultaneously and independently, consequently the homotopy is a parallel algorithm by nature. See further details in Chapter 5.