Classroom Tips and Techniques: Real Distinct Roots of a Cubic
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft

Introduction


The real distinct roots of the cubic equation
can be expressed compactly in terms of trig functions by the algorithm in Table 1. Maple's solve command does not use this algorithm, so we explore how we can interpret and compact Maple's solution of this equation.


If then three real and distinct roots.




Table 1 In trigonometric form, the real distinct roots of the cubic



Example


The cubic function
has three distinct real zeros, as suggested by its graph in Figure 1.

Figure 1 Graph of the cubic

Indeed, approximate values for these three zeros are given in Table 2.

Table 2 Approximate zeros of the cubic


Trigonometric Form of the Zeros


Application of the algorithm in Table 1 results in the exact zeros shown in Table 3.






Table 3 Trigonometric form of the zeros of

The zeros in Table 3 are not ordered according to Table 2. In fact, the approximate values of the zeros in Table 3 are given in Table 4.






Table 4 Approximate values of the zeros in Table 3

Notice that both and in Table 3 are expressed as sines, contrary to the algorithm in Table 1. To see why, we first determine that , then observe that , where .
When , Maple immediately converts to .
When , Maple immediately converts to .
When , Maple immediately converts to .
These transformations are automatic, and cannot be prevented. But they do not cause the trigonometric expressions for the zeros to be any "larger" than they would have been if these transformations did not take place.


Maple's Form for the Zeros


Maple's solution to the equation is given in the form shown in Table 5, where , , and and are as defined in Table 1.



Table 5 Maple's solution to the equation

For the equation , Maple's solve command produces the solutions






Table 6 Maple's solutions of the equation

Even though these three solutions are known to be real, they are expressed with the imaginary unit. At first glance, it wouldn't be clear that these three solutions are real!
The three solutions in Table 6 are the members of a list . To this list we apply the evalf command in an attempt to see these solutions as floatingpoint numbers.
Because of the small imaginary parts computed in floatingpoint form, even these floats do not immediately declare themselves as real numbers. It takes both the fnormal command (to set to zero floats below the threshold of ) and the simplify command to remove the "" remnant of the small imaginary parts. Hence, we get
in agreement with Table 4.
Table 7 shows the result of applying the simplify command to Maple's analytic solutions.






Table 7 Application of the simplify command to Maple's solutions

The root retains the imaginary unit, but the other two roots are now expressed in terms of trig functions. Surprisingly, the argument of these trig functions are in terms of the arctangent function, not the arccosine function. Moreover, each such root is the sum of two sine functions, so the form of these solutions is clearly not as compact as those in Table 3.
To separate into its real and imaginary parts, the evalc command can be applied. If this command is applied to the solutions in Table 6, an expression of length 1939 is obtained. If this 14line result is simplified, and are given as in Table 7, and is given as in Table 8.


Table 8 Application of simplify and evalc to in Table 7

The form of in Table 8 is the most compact we've been able to obtain for this root. However, because is given in terms of two sine functions, it is possible to make it more compact by applying the expand command that applies the addition formula for the sine of a sum to the first sine function in the expression. But because is expressed in terms of two sine functions whose arguments are sums, little compression is obtained by applying the expand and even the combine commands. These results are given in Table 9.






Table 9 The most compact form of Maple's solutions to the cubic

The final step in our journey is to investigate why Maple's combine command does not reverse the expansion of when is numeric (and not a name) and is an angle for which the sine and cosine functions evaluate to a radical.



A Maple Trig Simplification


In Maple, the identity
is implemented with the expand and combine commands. The expand command converts the lefthand side to the righthand side, and the combine command converts the righthand side to the lefthand side. However, the combine command is programmed to search for products of sines and cosines, in which case the following transformations are applied.
Of course, the sum collapses to .
This is why Maple's combine command fails to recombine an expansion such as
However, in this case, the relatively new (Maple 13) convert option "phaseamp" effects the recombination, as we see with
=
Unfortunately, even this approach fails for something like
which is precisely the case , as described after Table 9. Working with pencil and paper, one would resort to a direct application of the elementary trigonometry inherent in
where and .
For this example, we have so and . Table 10 shows how this calculation could be implemented programmatically for in Table 9.
Apply Maple's patternmatching command to from Table 9.


Examine parameters extracted by the patmatch command.

=

Apply the algorithm.


Table 10 The transformation applied to from Table 9



A Final Observation


From Table 3 we have
while from Table 8 or 9 we have
To show directly that
set , where and write .
From Figure 2, we then have
and
Hence, does ?


Using the evaluation template from the expression palette and then the Context Menu, we have
=


Notational Devices Used


There are two notational devices used in this worksheet. First, tinted cells of tables contain hidden Maple input. To see how the displayed output is generated, use the Table menu and select Properties. In this dialog box, there is a checkbox for hiding input.
The second device is even more subtle. In Table 9, is assigned its appropriate expression, but "" is converted to the status of an "Atomic Identifier." In plain English, this means that collectively, all the characters that make up the symbol have been frozen together as a single name. Unfortunately, there is no obvious way to detect this, and each time such an Atomic Identifier is used, this status must be reapplied to the symbol. About the only way to tell if something is an Atomic Identifier is to try to change it to an Atomic Identifier. If it already is an Atomic Identifier, the change can't be made.

Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2010. 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 noncommercial, nonprofit use only. Contact Maplesoft for permission if you wish to use this application in forprofit activities.
