/*young.c */
/*   / groupe */
/* Marc F. */
/* le 15/12/2015 */
/*   xxx@etu.u-bordeaux.fr */


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


float rand1(void)
{
return rand()/(1. +RAND_MAX);
}


float I(float x,float D, float lambda,float a, float b)
{
return pow((sinc1(M_PI*b*x/(lambda*D))*cos(M_PI*a*x/(lambda*D))),2);
}


int main()
{
float D=2;
float lambda = 550e-9;

float a = 0.5e-3;
float b = 0.1e-3;
int Nphotons;
float xmax = 3e-2;
float ymax = 1e-2;
float x;
float y;
float p;
char nomfichier[100];

/* sprintf permet de construire une chaine de caracteres a partir d’arguments */
/* fonctionne sur le meme modele que printf ou fprintf */
sprintf(nomfichier,"Fentes_Young_%i_photons.txt",Nphotons);

/* pour chaque photon, on tire sa position x et y sur l’ecran */
/* on tire alors z entre 0 et 1 et on le compare a la probabilite de presence I(x,...) */
/* du photon en x */

x = xmax * (2*rand1()-1);
y = ymax * (2*rand1()-1);
p = rand1();

return 0;
}

