[R] Value of 'pi'

Mike Marchywka marchywka at hotmail.com
Mon May 30 11:48:37 CEST 2011












----------------------------------------
> Date: Sun, 29 May 2011 23:09:47 -0700
> From: jwiley.psych at gmail.com
> To: vincy_pyne at yahoo.ca
> CC: r-help at r-project.org
> Subject: Re: [R] Value of 'pi'
>
> 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 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?

You could do this if you trust your trig functions since
that is presumably what you want a value of pi for,

> atan(1)
[1] 0.7853982
> atan(1)*4
[1] 3.141593

> atan(1)*4*7-22
[1] -0.008851425

> atan(1)*4-pi
[1] 0





> >
> > 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/
>
> ______________________________________________
> 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. 		 	   		  


More information about the R-help mailing list