# st: AW: mata polyroots issue

 From "Martin Weiss" To Subject st: AW: mata polyroots issue Date Fri, 8 May 2009 16:00:49 +0200

```<>

http://www.stata.com/statalist/archive/2009-05/msg00215.html

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von John Bates
Gesendet: Freitag, 8. Mai 2009 15:25
An: Stata
Betreff: st: mata polyroots issue

<>
Hi,

I am running Stata 10.1 on Mac OS 10.4.  The following issue is perplexing
me:

-------
mata:
mata clear
polynomial1 =
(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-30,29)
polyeval(polynomial1,1)
polyroots(polynomial1)
-------

The
polyeval line makes it clear that x=1 is a root for this polynomial.
However, 1 is not a reported result for polyroots.  What is odd is that
if I add or subtract a zero term to the polynomial, polyroots() will
then correctly report x=1 as a root.  i.e., the following works:

-------
mata:
mata clear
polynomial1 =
(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-30,29)
polynomial2 =
(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-30,29)
polynomial3 =
(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-30,29)
polyroots(polynomial2)
polyroots(polynomial3)
-------

Does anybody know what is going on here?

Lirac

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```