Chapter 1
Chapter 1
Introduction
-2
-2 0 2 4 6
Fig. 1.1 Geometrical representation of a multivariate polynomial system
Local solution employs a guess value and iterates. You will get one of the solutions. Employing quess values {4, -1} and Newton - method
to iterate,
the solution is
{x 2.73186, y 0.887092}
-2
-2 0 2 4 6
Fig. 1.2 Local solution with initial guess and iteration
However, if the initial guess is not proper - for example {0, 0} - then, we may have problem
FindRoot::jsing : Encountered a singular Jacobian at the point {x, y} = {0., 0.}. Try perturbing the initial point(s).
Then we got both solution without guessing initial value and without iteration. Solving the second order system first,
1 1
y 195 - 2 2639 , y 195 + 2 2639
104 104
Then employing these roots for y, the corresponding values of x can be computed from the second equation,
1
x 130 + 3 2639
104
1
x 130 - 3 2639
104
Let us visualize the two solutions
6
-2
-2 0 2 4 6
Fig. 1.3 Global solution - all solution without initial guess and iteration
Althoug symbolic technique seems very elegant here, but if the system is complicated, there too many variables symbolic global solution
techniques (Gröbner basis, Dixon resultant) can fail. This difficulty may be overcome by global numerical methods, like homotopy
method!
1
Solution of algebraic polynomial systems
The monomials are x3 y2, with coefficient 1, and x1y0 with coefficient 2 and x0, y2 with coefficient 1. The degree of such a monomial is
defined as the sum of the involved exponents of the variables. For example, the second 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 deg (p) = max( 5, 1, 2) = 5.
Now considering a polynomial system like
g (x, y) = a1 + a2 x + a3 x y + a4 y (1.2)
h (x, y) = b1 + b2 x2 y + b3 x y2 (1.3)
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)∈ 2 , 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).
namely
-1 y 0 x0
-
y2 - 4 0 1 x1 = 0 (1.6)
x2
We need a third equation (polynomial) ! This should be linearly independ from p(x), let say x p(x). Since
x p // Expand
- x + x2 y
Then
-1 y 0
M (y) = y2 - 4 0 1 (1.7)
0 -1 y
Therefore
-1 y 0
Det y2 - 4 0 1
0 -1 y
- 1 + 4 y2 - y4
1 - 4 y2 + y4
1 - 4 x2 + x4
The solutions of these two polynomials are the solutions of the system {p (x, y), g (x, y)}.
Roots[- 1 + 4 y2 - y4 0, y]
y 2- 3 || y - 2- 3 || y 2+ 3 || y - 2+ 3
Roots[1 - 4 x2 + x4 0, x]
x 2- 3 || x - 2- 3 || x 2+ 3 || x - 2+ 3
These solutions can be computed directly via the built function Solve, too
sol = Solve[{p 0, g 0}, {x, y}]
3/2
x - 2- 3 , y -4 2- 3 + 2 - 3 ,
3/2
x 2- 3 ,y4 2- 3 - 2 - 3 ,
3/2
x - 2+ 3 , y -4 2+ 3 + 2 + 3 ,
3/2
x 2+ 3 ,y4 2+ 3 - 2 + 3
- 2+ 3
The main handicap of the Sylvester resultant that it can be employed only for systems of two polynomials.
The roots of the system {p (x, y), g (x, y)} is the same as the roots of this Dixon polynomial for any value of the parameter b. The Dixon
polynomial can be written as
δ (x, y, b) = b0 -4 x + x3 + y + b1 (1 - x y) (1.10)
Then the following homogeneous linear system should have solution for every b
-4 x + x3 + y = 0
1- x y = 0
or
-4x +x
3 1 y0 = 0
1 -x y1
therefore
- 4 x + x3 1
Det
1 -x
- 1 + 4 x2 - x4
b - 4 x + x3 + y - b x y
- 1 + 4 x2 - x4
- 1 + 4 y2 - y4
Remark
Here a and b are dummy formal variables, should be symbolic variables without assigned values.
Dixon reultant method can be applied to polynomial systems of more than two polynomials, too.
P = x + y + z;
G = x - 2 y + z3 ;
S = x2 - 2 y3 + z;
or
% / 12 // Expand
27 z + 12 z2 + 2 z3 + 12 z4 - 6 z5 + 3 z6 + 6 z7 - 2 z9
v = 6 + 11 x + 6 x2 + x3;
2 + 3 x + x2
{{4 + 5 x + x2 }, 0}
(2 + 3 x + x2) (4 + 5 x + x2 )
Expand[%]
8 + 22 x + 21 x2 + 8 x3 + x4
{{3 + x}, 0}
and
Cv gcd
(3 + x) (2 + 3 x + x2 )
Expand[%]
6 + 11 x + 6 x2 + x3
5
This means that the original polynomials s(x) and v(x) can be expressed as the linear combination of the GCD, like
s(x) = Cs(x) gcd(x) + 0 gcd(x)
and
v(x) = 0 gcd(x) + Cv(x) gcd(x)
or
s (x) = Cs (x) 0 gcd (x)
(1.11)
v (x) 0 Cv (x)
It is clear that the roots of the gcd(x), the GCD of these two polynomials { s(x), v(x)} are the roots of the polynomial system, namely the
roots of gcd = 2 + 3 x + x2 = 0
1.5
1.0
0.5
-1.0
-1.5
-1 + x y
- 4 + x2 + y2
In case of more than one variables the greatest common divisior is the Gröbner basis
{G1, G2} = GroebnerBasis[{p, g}, {x, y}]
{1 - 4 y2 + y4 , x - 4 y + y3 }
A kétváltozós rendszer kifejezhető a Gröbner-bázis polinomjainak lineáris kombinációjaként, ahol az együtthatók maguk is polinomok.
Ennek alapján a p(x,y) polinom kifejezhető. Osszuk el a p(x) polinomot a Gröbner bázis polinomjaival
Then similarly to the case of inivariate case, in case of two variables (x, y), the original system can be expressed as the linear combination
of the polynomials of the Gröbner basis {G1 (y), G2(x,y)}, where the coefficients are also polynomials. The coefficients are the
remainders.
{c1, r1} = PolynomialReduce[p, {G1, G2}, {x, y}]
{{-1, y}, 0}
and
{c2, r2} = PolynomialReduce[g, {G1, G2}, {x, y}]
{{-4 + y2 , x + 4 y - y3 }, 0}
then g(x, y)
6
G1
{- 4 + y2 , x + 4 y - y3 }. // Simplify
G2
{- 4 + x2 + y2 }
In matrix form
-1 y
p (x, y) = G1 (y)
g (x, y) -4 + y2 x + 4 y - y3 G2 (x, y)
or
p (x, y) -1 y
= G1 (y) + G2 (x, y) (1.12)
g (x, y) -4 + y2 x + 4 y - y3
The roots of the system {p(x,y),g(x,y)} are the same as the roots of the system {G1(y), G2(x,y)}. Let us realize that this basis consists of
special polynomials, since G1(y) is a univariate polynomial!
In generally speaking, the original polynomial system {p(x,y),g(x,y)} can be expressed as the linear combination of the basis polynomials
{G1(x,y) , G2(x,y)}.
There are many other basis polynomials, too and the set of these basis polynomials is called the ideal of the original polynomial. However,
the Gröbner basis is a special basis, since one of its polynomials is a univariate one! If the Gröbner basis is 1, the polynomials have no
common divisiors, consequently they have no common roots.
Let us employ the built-in function for the system {P, S, G} considered in Section 2.2.2
GroebnerBasis[{P, S, G}, {x, y, z}]
{- 27 z - 12 z2 - 2 z3 - 12 z4 + 6 z5 - 3 z6 - 6 z7 + 2 z9 , 3 y + z - z3 , 3 x + 2 z + z3 }
x2 + y2 1
V = x2 + y2 == 2
x2 + y2 2
{1}
There is no common roots, see Fig. 2.3, however the upper limit of the number of roots is 2 × 2 = 4.
-1
-2
-2 -1 0 1 2
Fig. 2.3 No common roots of polynomials
{- 21 y - 23 y2 - 30 y3 - 36 y4 - 9 y5 + 6 y6 - 12 y7 + 8 y8 }
{- 27 z - 12 z2 - 2 z3 - 12 z4 + 6 z5 - 3 z6 - 6 z7 + 2 z9 }
1.4 Applications
Problem
Let consider a 1D steady-state heat conduction problem in a slab with temperature dependent heat conductuion coefficient,
d dθ
λ (θ) =0
dx dx
The boundary conditions are
θ (0) = 0 és θ (1) = 1
and
λ (θ) = 1 + k θ
Let us employ the following trial function for the temperature profile
Solution
In[86]:= Clear["Global`*"]
Out[87]= 1+kθ
Out[88]= x + (- x + x2 ) c1 + (- x + x3 ) c2
The global error is the integral of the square of the local error
8
1
In[90]:= r = eq2 x
0
1
Out[90]= k2 + 4 k c1 + 2 k2 c1 + 4 c21 + 4 k c21 + 4 k2 c21 + k2 c41 + 6 k c2 + 4 k2 c2 +
5
4 6
12 c1 c2 + 20 k c1 c2 + 16 k2 c1 c2 + k2 c21 c2 + k2 c31 c2 + 12 c22 + 24 k c22 +
5 5
84 12 20 64 111 48
k2 c22 + k2 c1 c22 + k2 c21 c22 + k2 c32 + k2 c1 c32 + k2 c42
5 5 7 35 35 35
Now we should minimized this r (c1 ,c2, k) function respect to c1 and c2. Considering the necessary conditions,
In[91]:= eq1 = D[r, c1 ]
4
Out[91]= 4 k + 2 k2 + 8 c1 + 8 k c1 + 8 k2 c1 + k2 c31 + 12 c2 + 20 k c2 +
5
8 18 12 40 111
16 k2 c2 + k2 c1 c2 + k2 c21 c2 + k2 c22 + k2 c1 c22 + k2 c32
5 5 5 7 35
In[92]:= eq2 = D[r, c2 ]
4 6
Out[92]= 6 k + 4 k2 + 12 c1 + 20 k c1 + 16 k2 c1 + k2 c21 + k2 c31 + 24 c2 + 48 k c2 +
5 5
168 k2 c2 24 40 192 333 192
+ k2 c1 c2 + k2 c21 c2 + k2 c22 + k2 c1 c22 + k2 c32
5 5 7 35 35 35
In[93]:= {solc1} = GroebnerBasis[{eq1, eq2}, {c1 , c2 }, { c2 }]
Out[93]= {2 222 640 000 k + 25 041 744 000 k2 + 106 983 636 480 k3 + 216 207 482 400 k4 + 217 869 466 458 k5 +
105 383 544 084 k6 + 21 747 027 960 k7 + 982 690 800 k8 + 4 445 280 000 c1 + 45 638 208 000 k c1 +
172 774 344 960 k2 c1 + 305 473 573 440 k3 c1 + 294 315 313 236 k4 c1 + 170 466 205 476 k5 c1 +
78 560 129 424 k6 c1 + 27 948 563 160 k7 c1 + 4 880 962 800 k8 c1 + 4 834 771 200 k2 c21 +
14 644 375 200 k3 c21 + 3 743 455 968 k4 c21 - 11 828 581 632 k5 c21 - 15 676 868 844 k6 c21 -
6 328 977 648 k7 c21 - 849 050 160 k8 c21 + 398 664 000 k2 c31 - 377 496 000 k3 c31 + 1 763 997 312 k4 c31 +
2 443 968 240 k5 c31 + 2 017 898 358 k6 c31 + 441 062 580 k7 c31 + 61 164 425 k8 c31 + 52 698 240 k4 c41 +
370 528 368 k5 c41 + 323 358 168 k6 c41 + 197 374 240 k7 c41 + 18 557 000 k8 c41 - 4 040 400 k4 c51 -
27 938 400 k5 c51 - 12 698 784 k6 c51 - 6 985 752 k7 c51 + 4 109 544 k8 c51 - 1 465 920 k6 c61 -
716 616 k7 c61 - 872 028 k8 c61 + 55 600 k6 c71 + 18 640 k7 c71 + 58 568 k8 c71 - 3120 k8 c81 + 100 k8 c91 }
Let k = 1 and solve this polynomial system. The reduced Groebner basis for c1
{solc1} = GroebnerBasis[{eq1, eq2} /. k 1, {c1 , c2 }, { c2}]
{696 438 232 182 + 1 104 502 580 496 c1 - 11 460 875 916 c21 + 6 749 258 915 c31 +
962 516 016 c41 - 47 553 792 c51 - 3 054 564 c61 + 132 808 c71 - 3120 c81 + 100 c91}
and for c2
solc2 = GroebnerBasis[{eq1, eq2} /. k 1, {c1 , c2 }, { c1 }]
{- 3 224 994 388 + 16 440 204 032 c2 + 2 331 033 488 c22 +
1 352 335 222 c32 - 8 809 024 c42 + 993 132 c52 + 892 430 c62 + 58 212 c72 + 1560 c82 + 75 c92 }
{{c1 - 12.9293 - 3.66147 }, {c1 - 12.9293 + 3.66147 }, {c1 -0.625134},
{c1 2.52044 - 8.1913 }, {c1 2.52044 + 8.1913 }, {c1 2.71118 - 38.721 },
{c1 2.71118 + 38.721 }, {c1 23.6103 - 0.232818 }, {c1 23.6103 + 0.232818 }}
9
sol2 = NSolve[solc2, c2 ]
{{c2 - 14.5317 - 6.04274 }, {c2 - 14.5317 + 6.04274 }, {c2 -1.91375 - 26.8494 },
{c2 - 1.91375 + 26.8494 }, {c2 - 0.996856 - 3.33813 }, {c2 - 0.996856 + 3.33813 },
{c2 0.190454}, {c2 6.94707 - 7.44282 }, {c2 6.94707 + 7.44282 }}
{c1 - 0.625134}
{c2 0.190454}
It is well known that the visualization of curves and surfaces is easy and confortable via parametric explicite equations of the geometrical
objects. However sometimes the implicit form of these equations are needed. For example one should like to decide whether a point is on
10
objects. However sometimes the implicit form of these equations are needed. For example one should like to decide whether a point is on
the curve or surface or it is not. Finding the common points of two or more geometrical objects is just the generalization of this task
Problem 1 Let us compute the implicite equation of a 2D circle!
y(α) = sin(α)
in addition we know that
sin2 (α) + cos2 (α) = 1
Solution
Therefore we are looking for the solution of the following equation system with unknowns (x, y, α)
In[3]:= Join[Together[{x, y} - gk[α]], {Cos[α] ^ 2 + Sin[α] ^ 2 - 1}]
Now we should eliminate the variable (parameter) α. Let us compute the Groebner basis for the x and y
In[4]:= GroebnerBasis[%, {x, y}, {α, Cos[α], Sin[α]}]
Out[4]= {- 1 + x2 + y2 }
Problem 2 Now let us compute the common points of a cardioide and a cirle!
Out[14]= 0
-1
-2
0 1 2 3 4
Fig. 2.5 A cardioide curve
Solution
Out[9]= {- 4 x3 + x4 - 4 y2 - 4 x y2 + 2 x2 y2 + y4 }
Out[10]= 0
-1
-2
-1 0 1 2 3 4
Fig. 2.6 Visualization of the cardioide curve via implicite equation
Out[15]= 0
-1
-2
-2 -1 0 1 2 3 4
Fig. 2.7 The circle
Out[16]= 0
-1
-2
-2 -1 0 1 2 3 4
Fig. 2.8 The two geometrical objects together
The next step is the computation of the common points employing these implicite equations,
In[17]:= g1 = - 4 x3 + x4 - 4 y2 - 4 x y2 + 2 x2 y2 + y4
Out[17]= - 4 x3 + x4 - 4 y2 - 4 x y2 + 2 x2 y2 + y4
12
In[18]:= g2 = x2 + y2 - 2
Out[18]= - 2 + x2 + y2
Out[19]= {- 1 - 2 x + x2 }
Out[20]= {- 7 + 2 y2 + y4 }
Out[21]= 1 - 2 ,- -1 + 2 2 , 1 - 2 , -1 + 2 2 ,
There are only two real solutions! Let us visualize the common points,
Out[24]= 0
-1
-2
-2 -1 0 1 2 3 4
Fig. 2.9 The common points of the two geometrical objects