Ravi

1. You may want to check the sqrt too.

2. Why not take log and try?

Aditya



------------------------------
On Thu 2 Jul, 2015 10:18 AM PDT Boris Steipe wrote:

>Just a wild guess, but did you check exactly which operations are actually 
>done to high precision? Obviously you will need high-resolution 
>representations of pi and e to get an improved result.
>
>B.
>
>
>
>On Jul 2, 2015, at 10:28 AM, Ravi Varadhan <ravi.varad...@jhu.edu> wrote:
>
>> Hi,
>> 
>> Ramanujan supposedly discovered that the number, 163, has this interesting 
>> property that exp(sqrt(163)*pi), which is obviously a transcendental number, 
>> is real close to an integer (close to 10^(-12)).
>> 
>> If I compute this using the Wolfram alpha engine, I get:
>> 262537412640768743.99999999999925007259719818568887935385...
>> 
>> When I do this in R 3.1.1 (64-bit windows), I get:
>> 262537412640768256.0000
>> 
>> The absolute error between the exact and R's value is 488, with a relative 
>> error of about 1.9x10^(-15).
>> 
>> In order to replicate Wolfram Alpha, I tried doing this in "Rmfpr" but I am 
>> unable to get accurate results:
>> 
>> library(Rmpfr)
>> 
>> 
>> exp(sqrt(163) * mpfr(pi, 120))
>> 
>> 1 'mpfr' number of precision  120   bits
>> 
>> [1] 262537412640767837.08771354274620169031
>> 
>> The above answer is not only inaccurate, but it is actually worse than the 
>> answer using the usual double precision.  Any thoughts as to what I am doing 
>> wrong?
>> 
>> Thank you,
>> Ravi
>> 
>> 
>> 
>>      [[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to