Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Mata --- polyroots() accuracy


From   Adrian Mander <[email protected]>
To   [email protected]
Subject   st: Mata --- polyroots() accuracy
Date   Mon, 01 Nov 2010 10:28:31 +0000

I am trying to write a function with as much precision as Stata will allow.

Part of the function requires finding the roots of a polynomial and I realise that I am dealing with some very small numbers

coef12 =(1,-12,33,-110/3,165/8,-33/5,77/60,-11/70,11/896,- 11/18144,11/604800,-1/3326400,1/479001600)
polyroots( coef12 )

Stata finds one of the roots as 37.09912104447676739

 polyeval( coef12, 37.09912104447676739)

But my function is better 37.09912104446606662 gives a value that is a little closer to 0 (BUT still not great!)
 polyeval( coef12, 37.09912104446606662)

I wonder if Stata Corps thinks it worth doing polyroots to quadprecision?

Thanks
Adrian

--
Dr Adrian Mander
Leader of Cambridge Hub in Trials Methodology Research
MRC Biostatistics Unit Institute of Public Health University Forvie Site Cambridge CB2 0SR

Tel: 01223 760728       Fax: 01223 760727

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index