Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

Why does the MATLAB command poly(roots(b)) fail to always return the original vector 'b'?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-15ROS
Product:   MATLAB
Reported in Release:   No Release
Platform:   All Platforms
Operating System:   All OS
 

Subject:

Why does the MATLAB command poly(roots(b)) fail to always return the original vector 'b'?

Problem Description:

Here is an example:
roots(poly(ones(1,6))


ans =

1.0034 + 0.0020i
1.0034 - 0.0020i
1.0000 + 0.0039i
1.0000 - 0.0039i
0.9966 + 0.0019i
0.9966 - 0.0019i

Solution:

This problem is caused by a roundoff error which demonstrates a fundamental problem with the way computers deal with floating point numbers. For more information about the way computers represent floating point numbers (more precisely, ANSI/IEEE Standard 754, double precision, for Binary Floating-Point Arithmetic), there is an excellent "Cleve's Corner" article discussing this. You can find it at

http://www.mathworks.com/company/newsletter/pdf/Fall96Cleve.pdf

You might also want to look at the Related Solution listed below at the bottom of the page.

Because the accuracy of floating point computations is limited, a round-off error can occur in the intermediate computations used in ROOTS and POLY. The roots of a polynomial are very sensitive to slight changes in the coefficients; this sensitivity can cause ROOTS and POLY to produce results that differ from what was expected. Because of this, it's often preferable to deal with a polynomial in one form, either its roots or its coefficients, and avoid switching between the two.

The example of determining polynomial coefficients from roots and vice versa is often used as an example of a poorly conditioned problem in many numerical methods textbooks. You might want to take a look at the following:


Forsythe, G.E., M.A. Malcolm and C.B. Moler, Computer Methods for
Mathematical Computations, Prentice-Hall, 1977.
This textbook discusses in greater depth why this problem is numerically difficult to solve.

 

Related Solutions:

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page