Dear R helpers, I have one basic doubt about the value of pi. In school, we have learned that pi = 22/7 (which is = 3.142857). However, if I type pi in R, I get pi = 3.141593. So which value of pi should be considered? Regards Vincy [[alternative HTML version deleted]]
Dear Vincy, I hope that in school you also learned that 22/7 is an approximation. Please consult your local mathematician for a proof that pi != 22/7. A quick search will provide you with volumes of information on what pi is, how it may be calculated, and calculations out to thousands of digits. Cheers, Josh On Sun, May 29, 2011 at 11:01 PM, Vincy Pyne <vincy_pyne at yahoo.ca> wrote:> Dear R helpers, > > I have one basic doubt about the value of pi. In school, we have learned that > > pi = 22/7 (which is = 3.142857). However, if I type pi in R, I get pi = 3.141593. So which value of pi should be considered? > > Regards > > Vincy > > > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
Pi is an irRATIOnal number, meaning that it is not equal to the ratio of any integers ("whole numbers"). Hence, 22/7 is ONLY an approximation. The built-in value for pi in R is also just an approximation (pi has no terminal digit on the right of the decimal point so any finite number of digits will just be an approximation). Yet, the built-in value for pi in R is a more precise approximation, which is usually preferred... On May 30, 2011 2:02 AM, "Vincy Pyne" <vincy_pyne@yahoo.ca> wrote:> Dear R helpers, > > I have one basic doubt about the value of pi. In school, we have learnedthat> > pi = 22/7 (which is = 3.142857). However, if I type pi in R, I get pi 3.141593. So which value of pi should be considered? > > Regards > > Vincy > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]