Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Mata - polyroots() issue


From   John Bates <[email protected]>
To   Stata <[email protected]>
Subject   st: Mata - polyroots() issue
Date   Wed, 6 May 2009 20:22:43 -0700 (PDT)

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index