/* iterative Berechnung von K(sin(phi_0/2)) by RV, 20.01.97 */
#include <stdio.h>
#include <math.h>

float a, arithm, b, c, geom, k, phi_0;
int i;

float GaussIteration(float phi_0)
{
 for(i=1;i<=5;i++)
 {  
  a = cos(phi_0/2.0);
  b = 1.00;
  geom = sqrt(a*b);  /* geometrisches Mittel  */
  arithm = (a+b)/2;  /* arithmetisches Mittel */
  a = geom;
  b = arithm;
 }
}
int main (int argc, char ** argv)
{
 if (argc != 2)
 {
   fprintf(stderr, "usage: %s <Winkel in rad> \n" \
                   "       z.B.: %s 2.12 \n", argv[0], argv[0]);
   return(1); 

 }
 printf("result: %f \n",GaussIteration( atof(argv[1]) ) );
 return (0);
}


