Go to the documentation of this file.00001
00002 #include "pdf1d_prob_ks.h"
00003
00004
00005
00006
00007
00008 #include <vcl_cmath.h>
00009
00010 const double f1 = 0.001;
00011 const double f2 = 1.0e-8;
00012
00013
00014
00015
00016 double pdf1d_prob_ks(double x)
00017 {
00018 double k=2.0,sum=0.0,term,previous_term=0.0;
00019
00020 double a2 = -2.0*x*x;
00021 for (int j=1;j<=100;j++)
00022 {
00023 term=k*vcl_exp(a2*j*j);
00024 sum += term;
00025 if (vcl_fabs(term) <= f1*previous_term || vcl_fabs(term) <= f2*sum) return sum;
00026 k = -k;
00027 previous_term=vcl_fabs(term);
00028 }
00029 return 1.0;
00030 }