[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C Program confused me



> I encountered following program in one of the Linux Howtos. This calculates
> the value of pai. But how does it do this? I am not asking the programming
> details, but on what theory the formula is based on. Can anybody help? Is
> there any better place to look for help?

First of all, remove ';' after #include instructions :)

The formula is:

4* Integral(from 0 to 1) of 1/(1+x^2) dx = 4 * (arctan(1) - arctan(0))=
4* ( Pi/4 - 0) = Pi

Alex Y.

-- 
   _ 
 _( )_
(     (o___           +-------------------------------------------+
 |      _ 7           |            Alexander Yukhimets            |
  \    (")            |       http://pages.nyu.edu/~aqy6633/      |
  /     \ \           +-------------------------------------------+


Reply to: