/*  ATK IV NUMERICAL PROGRAMMING (2006)  */
/* Excercise 2.3b - Recurrence relations */

#include<stdio.h>
#include<math.h>

int main(void){

  float besselJ[22]; /* Remember that indices start from 0 */
  int n;
  float x = 1.0;

  besselJ[20] = 3.8735030E-25;
  besselJ[21] = 9.2276220E-27;
  
  /* Now the backward recurrence relation is simply */
  /* J_n-1(x)= 2*n*J_n(x)/x - J_n+1(x) */

  for(n=20;n>=1;n--){
    besselJ[n-1] = 2*n*besselJ[n]/x - besselJ[n+1];
  }

  for(n=0;n<=21;n++){
    printf("%f\n", besselJ[n]);
  }

  return 0;
}