[R] Solving 100th order equation

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon May 26 09:03:57 CEST 2008


Rolf Turner wrote:
>
> On 26/05/2008, at 10:38 AM, Hans W. Borchers wrote:
>
>> Rolf Turner <r.turner <at> auckland.ac.nz> writes:
>>
>>>
>>>       [...]
>>>
>>>     However uniroot(p,c(1.995,2.005)) gives
>>>
>>>     $root
>>>     [1] 1.999993
>>>
>>>     $f.root
>>>     [1] -4.570875e+24
>
>     Whoops!  I read that e+24 as e-24, so scrub all that I said.
>     (You'd think, that having seen Bill Venables make a similar
>      error --- which he corrected in the follow-up posting to which
>      I was replying --- I would've been more careful.  Well, you'd
>      think wrong.  Actually it *was* e-24 when I posted; then the
>      Gremlins got in and changed everything. :-) )
Hehe....

If you think about it, if you have x^100 in the expression, then when 
you get out to about x=2, you'll need 100 binary digits to store the 
value to integer precision, so anything working with standard finite 
precision arithmetic is going to go wrong because the measly "4000" in 
the equation is going to be completely swamped out.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list