Skip to content
Back to formatted view

Raw Message

Message-ID: <loom.20100119T185125-108@post.gmane.org>
Date: 2010-01-19T17:55:43Z
From: Ben Bolker
Subject: problem with the precision of numbers

kayj <kjaja27 <at> yahoo.com> writes:

> 
> 
> Hi All,
> 
> I was wodering if it is possible to increase the precision using R. I ran
> the script below in R and MAPLE and I got different results when k is large.
> Any idea how to fix this problem? thanks for your help
> 
> for (k in 0:2000){
>  s=0
>  for(i in 0:k){
>  s=s+((-1)^i)*3456*(1+i*1/2000)^3000
>  }
> }


(1) see
http://wiki.r-project.org/rwiki/doku.php?id=misc:r_accuracy:high_precision_arithmetic

(2) consider whether there is more accurate algorithm you
could use. I don't recognize the series, but perhaps it
has a closed form solution, maybe as a special function?
How much accuracy do you really need in the solution?

  Ben Bolker