Page 61 - Numerical Analysis Using MATLAB and Excel
P. 61
Chapter 2 Root Approximations
p 1 2 1 3
-
x = y + -- a = -- 3q –( - p ) b = ------ 2p –( 9pq + 27r ) (2.10)
3 3 27
For the solution it is convenient to let
3 2 3 3 2 3
a
a
----- +
----- +
------ +
------ +
A = – b b ------ B = – – b b ------ (2.11)
2 4 27 2 4 27
Then, the values of for which the cubic equation of (2.11) is equal to zero are
x
–
–
A + B AB A + B AB
x = A + B x = – -------------- + -------------- – 3 x = – -------------- – -------------- – 3 (2.12)
3
2
1
2
2
2
2
If the coefficients , , and are real, thenpq r (2.13)
b 2 a 3
If ----- + ------ > 0 one root will be real and the other two complex conjugates
4 27
2
3
b
a
If ----- + ------ < 0 the roots will be real and unequal
4 27
2
3
b
a
If ----- + ------ = 0 there will be three real roots with at least two equal
4 27
While MATLAB handles complex numbers very well, spreadsheets do not. Therefore, unless we
know that the roots are all real, we should not use a spreadsheet to find the roots of a cubic equa-
tion by substitution in the above formulas. However, we can use a spreadsheet to find the real
root since in any cubic equation there is at least one real root. For real roots, we can use a spread-
sheet to define a range of values with small increments and compute the corresponding values
x
y
x
x
of y = f x() . Then, we can plot versus to observe the values of that make f x() = 0 . This
procedure is illustrated with the examples that follow.
Note: In our subsequent discussion we will omit the word cell and the key <enter>. Thus B3,
C11, and so on will be understood to be cell B3, cell C11, and so on. Also, after an entry has been
made, it will be understood that the <enter> key was pressed.
Example 2.3
Compute the roots of the polynomial
3 2
–
y = f x() = x – 7x + 16x 12 (2.14)
using Excel.
2−8 Numerical Analysis Using MATLAB® and Excel®, Third Edition
Copyright © Orchard Publications