Application Center - Maplesoft

App Preview:

Classroom Tips and Techniques: Solving Algebraic Equations by the Dragilev Method

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application




 

Classroom Tips and Techniques: Solving Algebraic Equations by the Dragilev Method

``

Robert J. Lopez

Emeritus Professor of Mathematics and Maple Fellow

Maplesoft

 

Introduction

NULL

On February 13, 2013, Markian Hirnyk  posted an animation to MaplePrimes, one frame of which is shown in Figure 1. He asked how this animation might be coded in Maple.

 

A reply on February 14 by one_man contained a link to the worksheet MECAN1.mw in which the source of the red curve in Figure 1, and a full coding of the animation, appeared. In passing, he commented "The Draghilev method is used in my animation."

 

On April 2, 2013, Markian Hirnyk made two posts to MaplePrimes, the first detailing the Dragilev method; and the second, Maple code for the animation - essentially the same as found in the MECAN1.mw worksheet.

NULL

Figure 1   One frame of Hirnyk's animation

NULL

(The alternate spelling Draghilev appears in some references.)

 

This month's article examines the Dragilev method for solving certain systems of algebraic equations, and details how it is used to obtain a parametrization of the red curve in Figure 1, the curve of intersection of two surfaces. The reader should feel free to study Hirnyk's own description of the method.

NULL

Parametrizing the Intersection of Two Surfaces

NULL

The red curve in Figure 1 is the intersection of the surfaces defined by two equations U(x, y, z) = 0, V(x, y, z) = 0, where U and V are given respectively by

 

(x-2)^2+(y-2)^2+z^2-9   and   x^6+y^6+z^6-12 

 

The first equation defines a sphere with center at 2, 2, 0 and with radius 3; the second, a box-like closed surface drawn in green in Figure 2. The curve of intersection, drawn by Maple's intersectplot command, can be seen in Figure 2.NULL

NULL

U := (x-2)^2+(y-2)^2+z^2 = 9; V := x^6+y^6+z^6 = 12; plots:-implicitplot3d([U, V], x = -2 .. 5, y = -2 .. 5, z = -3 .. 3, scaling = constrained, color = [red, green], style = surface, axes = frame, orientation = [-160, -75, 180]); unassign('U', 'V')

Figure 2   Surfaces defined by U = V and V = 0

U := (x-2)^2+(y-2)^2+z^2-9; V := x^6+y^6+z^6-12; plots:-intersectplot(U = 0, V = 0, x = -2 .. 2, y = -2 .. 2, z = -2 .. 2, scaling = constrained, axes = frame, color = red, thickness = 3); unassign('U', 'V')

Figure 3   Curve of intersection: U = V and V = 0 

NULL

When the algebra is tractable, the following procedure would provide a parametric representation of the curve of intersection of two surfaces defined respectively by equations of the form U(x, y, z) = 0 and V(x, y, z) = 0.

 

Solve U = 0 for x = x(y, z), so that V = 0 becomes `≡`(V(x(y, z), y, z), W(y, z)) = 0. Solve W = 0 for y = Y(z), so that x = x(y, z) and x(y, z) = x(Y(z), z) and x(Y(z), z) = X(z). Then, the parametrization is x = X(z), y = Y(z), z = z.

 

Applied to the given functions U and V, this process meets two difficulties. First, the attempt to obtain x(y, z) results in x = 2+`&+-`(sqrt(9-z^2-(y-2)^2)) , so this will result in a piecewise-defined parametrization. Second, and more important, solving W(y, z) = 0 for y = Y(z) requires finding the roots of polynomials of degree greater than five. Maple uses the RootOf construct to represent these solutions, but computationally, they are intractable.

NULL

A naive approach to obtaining a computationally useful parametric representation of the curve in Figure 3 is out of the question.

NULL

A Numeric Approach to the Parametrization

NULL

Since the surface defined by U = 0 is a sphere, a conversion to spherical coordinates suggests itself. Table 1 contains the details.

 

S := eval(x^6+y^6+z^6-12, [x = 2+3*sin(phi)*cos(theta), y = 2+3*sin(phi)*sin(theta), z = 3*cos(phi)])

(2+3*sin(phi)*cos(theta))^6+(2+3*sin(phi)*sin(theta))^6+729*cos(phi)^6-12

Table 1   The functions U and V converted to spherical coordinates

NULL

Unfortunately, extracting either phi(theta) or theta(phi) from S = 0 results in complicated RootOf expressions that can only be evaluated numerically and with great difficulty. Instead, a direct numeric solution for, say, phi, given a value of theta, would result in a numeric parametrization of the intersection curve shown in red in Figure 1.

 

Because the function phi(theta) has two branches (upper and lower), some method of returning a continuous value of phi as theta varies is needed. The circle C drawn in black in Figure 4 is the basis of the numeric approach taken. For each point on C, compute the nearest point on the graph of S = 0, the green curve in Figure 4.

NULL

• 

Let C be the circle defined by

 

theta = 3.9+cos(s), phi = 1.56+sin(s) 

 

• 

For each theta(s), phi(s) pair on C determined by the parameter `in`(s, [0, 2*Pi]), the nearest point on the curve defined by S = 0 is to be computed. The commands in the Optimization package minimize this distance numerically, but the most successful approach is to solve numerically the analytic equations S = 0 and

 

theta(s)-theta+(D(phi))(theta)*(phi(s)-phi) = 0 

 

where (D(phi))(theta) is computed implicitly from S = 0.

XC := 3.9+cos(s):
YC := 1.56+sin(s):
P1 := plots:-implicitplot(S,theta=0..2*Pi,phi=0..Pi,gridrefine=2,scaling=constrained,color=green):
P2 := plot([XC,YC,s=0..2*Pi],color=black):
plots:-display(P1,P2,scaling=constrained);
unassign('XC','YC','P1','P2'):

 

Figure 4   Graph of S(theta, phi) = 0 and circle C

NULL

This equation is nothing more that the derivative of the square of the distance between theta(s), phi(s) on C and theta, phi on S = 0, since this is the objective function to be minimized. The expedient of starting Newton iteration from theta(s), phi(s) is the magic that lets Maple's fsolve command quickly and robustly return a unique `#mover(mi("φ",fontstyle = "normal"),mo("ˆ"))`, `#mover(mi("θ",fontstyle = "normal"),mo("ˆ"))`-pair on S = 0 for each value of s on C. The function P(s), defined in Table 2 and which returns the Cartesian point

 

[2+3*sin(`#mover(mi("φ",fontstyle = "normal"),mo("ˆ"))`)*cos(`#mover(mi("θ",fontstyle = "normal"),mo("ˆ"))`), 2+3*sin(`#mover(mi("φ",fontstyle = "normal"),mo("ˆ"))`)*sin(`#mover(mi("θ",fontstyle = "normal"),mo("ˆ"))`), 3*cos(`#mover(mi("φ",fontstyle = "normal"),mo("ˆ"))`)] 

 

employs this approach to compute `#mover(mi("θ",fontstyle = "normal"),mo("ˆ"))`, `#mover(mi("φ",fontstyle = "normal"),mo("ˆ"))`.

``

P := proc (s) local T, F, DF, q, ft; T := 3.9+cos(s); F := 1.56+sin(s); DF := implicitdiff(S, phi, theta); q := T-theta+DF*(F-phi); ft := fsolve({S, q}, {phi = F, theta = T}); eval([2+3*sin(phi)*cos(theta), 2+3*sin(phi)*sin(theta), 3*cos(phi)], ft) end proc

Table 2   The function P(s) that returns x, y, z on the intersection of U = 0 and V = 0 

``

Figure 5 shows a graph of the intersection of U = 0 and V = 0 drawn by Maple's pointplot3d command with 500 points generated by the function P(s), 0 <= s and s <= 2*Pi. (The command itself is hidden input in the table containing the figure.) It would be difficult to distinguish between the curves in Figures 3 and 5.

``

plots:-pointplot3d([seq(P((1/250)*k*Pi), k = 0 .. 500)], scaling = constrained, view = [-2 .. 2, -2 .. 2, -2 .. 2], axes = frame, color = red, labels = [x, y, z])

Figure 5   Numerically parametrized intersection of U = 0 and V = 0 

``

The Dragilev Method

``

Markian Hirnyk's April 2, 2013, post to MaplePrimes details the Dragilev method. For the reader's convenience, the highlights of that post are paraphrased here.

 

In principle, n equations f[k] = 0, k = 1, () .. (), n, in n+1 variables x[k], k = 1, () .. (), n+1, can solved for, say, the first n of the unknowns in terms of x[n+1]. This amounts to a parametrization of the solution of the equations.

 

The Dragilev method obtains this parametrization by assuming x[k] = x[k](t), k = 1, () .. (), n+1, and solving the following initial-value problem.

 

sum(`&PartialD;`(f[j])*(diff(x[k](t), t))/`&PartialD;`(x[k]), k = 1 .. n+1) = 0, j = 1, () .. (), n 

diff(x[n+1](t), t) = -`&PartialD;`(f[1], () .. (), f[n])/`&PartialD;`(x[1], () .. (), x[n])

x[k](0) = p[k], k = 1, () .. (), n+1 

 

If F is the vector whose n components are the functions f[k], and x is the vector whose n+1 components are the parametrized variables x[k](t), then the left-hand sides of the first n differential equations can be realized as the product of the Jacobian matrix for F (taken with with respect to x) times diff(x(t), t). The right-hand side of the last differential equation is the negative of the Jacobian of F taken with respect to x[1], () .. (), x[n]. The numbers p[k], k = 1, () .. (), n+1, are the coordinates of one solution of F = 0.

 

Table 3 displays the Dragilev differential equations for the case n = 2. Note that the right-hand side of the last equation is the negative of the Jacobian of f[1] and f[2] considered as functions of just x[1] and x[2].

``

`&PartialD;`(f[1])*(diff(x[1](t), t))/`&PartialD;`(x[1])+`&PartialD;`(f[1])*(diff(x[2](t), t))/`&PartialD;`(x[2])+`&PartialD;`(f[1])*(diff(x[3](t), t))/`&PartialD;`(x[3]) = 0 

`&PartialD;`(f[2])*(diff(x[1](t), t))/`&PartialD;`(x[1])+`&PartialD;`(f[2])*(diff(x[2](t), t))/`&PartialD;`(x[2])+`&PartialD;`(f[2])*(diff(x[3](t), t))/`&PartialD;`(x[3]) = 0 

diff(x[3](t), t) = -LinearAlgebra[Determinant](Matrix(2, 2, {(1, 1) = `&PartialD;`(f[1])/`&PartialD;`(x[1]), (1, 2) = `&PartialD;`(f[1])/`&PartialD;`(x[2]), (2, 1) = `&PartialD;`(f[2])/`&PartialD;`(x[1]), (2, 2) = `&PartialD;`(f[2])/`&PartialD;`(x[2])})) = -(`&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[1])*`&PartialD;`(x[2]))-`&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[1])*`&PartialD;`(x[2]))) = -`&PartialD;`(f[1], f[2])/`&PartialD;`(x[1], x[2])

Table 3   The equations of the Dragilev method for n = 2

``

If Cramer's rule is used to solve for diff(x[1](t), t) and diff(x[2](t), t) in the first two equations of Table 3, the equations for Dragilev's method when n = 2 can be written as the explicit equations in Table 4.

 

diff(x[1](t), t) = `&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[3])*`&PartialD;`(x[2]))-`&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[3])*`&PartialD;`(x[2])) = `&PartialD;`(f[1], f[2])/`&PartialD;`(x[3], x[2])

diff(x[2](t), t) = `&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[1])*`&PartialD;`(x[3]))-`&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[1])*`&PartialD;`(x[3])) = `&PartialD;`(f[1], f[2])/`&PartialD;`(x[1], x[3])

diff(x[3](t), t) = `&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[1])*`&PartialD;`(x[2]))-`&PartialD;`(f[1])*`&PartialD;`(f[2])/(`&PartialD;`(x[1])*`&PartialD;`(x[2])) = -`&PartialD;`(f[1], f[2])/`&PartialD;`(x[1], x[2])

Table 4   Explicit equations for Dragilev's method when n = 2

``

Notice that the right-hand side of each equation is actually a Jacobian. An application of the formalism in Table 4 to the equations u(x, y, z) = 0 and v(x, y, z) = 0 results in the equations listed in Table 5, where subscripts indicate partial derivatives.

 

diff(x(t), t) = u[z]*v[y]-u[y]*v[z] 

diff(y(t), t) = u[x]*v[z]-u[z]*v[x] 

diff(z(t), t) = u[y]*v[x]-u[x]*v[y] 

Table 5   The Dragilev differential equations for u(x, y, z) = 0 and v(x, y, z) = 0

NULL

Table 6 lists the Dragilev differential equations in the case n = 3.

 

diff(x(t), t) = `&PartialD;`(f, g, h)/`&PartialD;`(w(t), y(t), z(t)), diff(y(t), t) = `&PartialD;`(f, g, h)/`&PartialD;`(x(t), w(t), z(t)), diff(z(t), t) = `&PartialD;`(f, g, h)/`&PartialD;`(x(t), y(t), w(t)), diff(w(t), t) = -`&PartialD;`(f, g, h)/`&PartialD;`(x(t), y(t), z(t))

Table 6   The Dragilev differential equations for f(v) = g(v) and g(v) = h(v) and h(v) = 0, where v = [x, y, z, w]^T

 

It should be easy to visualize the right-hand sides of the Dragilev differential equations when n > 3; each is a Jacobian with the variables of differentiation systematically varied with the pattern in Cramer's rule.

 

Example

``

To apply Dragilev's method to the equations U = 0 and V = 0, the initial solution L = [x(0), y(0), 0], computed in Table 7, is first found.

 

U := (x-2)^2+(y-2)^2+z^2-9; V := x^6+y^6+z^6-12; temp := fsolve(eval({U, V}, z = 0), {x, y}); L := eval([x, y, 0], temp)
 = [1.496446999, -.9574371296, 0]

Table 7   Calculation of an initial point for Dragilev's method

``

The right-hand sides of the differential equations required for applying Dragilev's method to the equations U = 0, V = 0, are listed in Table 8.

 

M := [x = x(t), y = y(t), z = z(t)]; R[1] := eval((diff(U, z))*(diff(V, y))-(diff(U, y))*(diff(V, z)), M); R[2] := eval((diff(U, x))*(diff(V, z))-(diff(U, z))*(diff(V, x)), M); R[3] := eval((diff(U, y))*(diff(V, x))-(diff(U, x))*(diff(V, y)), M)

6*(2*y(t)-4)*x(t)^5-6*(2*x(t)-4)*y(t)^5

Table 8   Right-hand sides of the differential equations needed when applying Dragilev's method to U = 0, V = 0 

``

The numeric solutions for x(t), y(t), z(t) are found with the calculations in Table 9.

 

Q := dsolve({diff(x(t), t) = R[1], diff(y(t), t) = R[2], diff(z(t), t) = R[3], x(0) = L[1], y(0) = L[2], z(0) = L[3]}, {x(t), y(t), z(t)}, numeric, output = listprocedure); X := rhs(Q[2]); Y := rhs(Q[3]); Z := rhs(Q[4])

Table 9   Numeric solutions for x(t), y(t), z(t) 

NULL

Figures 3 and 5 show that x(t), y(t), z(t), `in`(t, [0, T]), defines a closed curve in real^3. One way to determine T is suggested by Figure 6, a graph of Z(t).

 

• 

Figures 3 and 5 show that x(t), y(t), z(t), `in`(t, [0, T]), defines a closed curve in real^3, provided Z(0) = Z(T).

• 

 One way to determine an appropriate value of T is suggested by Figure 6, a graph of Z(t).

 

• 

The zero of Z(t) in the interval [0.4e-1, 0.5e-1] is the first t for which the loop in Figures 3 and 5 closes.

• 

Apply the fsolve command to determine this value of T.

plot(Z, 0 .. 0.6e-1, labels = [t, Z])

Figure 6   Graph of Z(t) 

T := fsolve(Z(t), t = 0.4e-1 .. 0.5e-1)

0.4611222614e-1

 

Figure 7 is a graph of the intersection of U = 0 and V = 0 drawn from the parametric representation determined by the Dragilev method.

 

plots:-spacecurve([X(t), Y(t), Z(t)], t = 0 .. T, scaling = constrained, view = [-2 .. 2, -2 .. 2, -2 .. 2], color = black, axes = frame)

Figure 7   Graph of the intersection of U = 0 and V = 0 drawn from the parametric representation obtained with the Dragilev method

 

The graph in Figure 7 is consistent with the graphs in Figures 3 and 5.

``

``

Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2013. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.