Making Pi with dinner

I just wanted to try this because of a thought I had about dimensionality.

#include <stdio.h>
#include <math.h>
/* Doing Pi   Add sqrt(1-x^2) from 0 to 1 divide by steps */
int main(int argc, char *argv[])
{
 double s,stepsize,MyPi=0.0,d,fsteps=100000000.0;
 int i,steps=100000000;stepsize=1/(fsteps);
 for (i=1;i<steps;i++)
  {
  s = sqrt(1-(stepsize*i)*(stepsize*i));
  MyPi=MyPi+s;
  }
 d=MyPi/fsteps;
 printf (" it is %f %f\n",4*d,M_PI);
 return 0;
}

It is compiled with "gcc program.c -o program -lm" and run as "./program" which yields 3.141593

That seems rather odd to me somehow that on the range, 0 to 1, ∑(1-x²)½Δx=PI? It could just be the day as I sometimes have transient confusion when I am changing perspective on dimensional space.

ALSO:
∫(1-x²)½δx
I could use a trigonometric substitution and just do the work, but I wanted to play with mirror inversion of formulas in several dimensions, branching to infinity relationships and how this relates to other equations that have PI as a limit or factor.

0 comments:

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen