function [ prob ] = cvmcdf(x)
%CVMCDF [prob]=cvmcdf(x)
%   Cramer-von Mises limiting CDF
%    x:  input >= 0
%   prob:  P(W_n <= x)--> [prob]=cvmcdf(x), n--> infinity
% BV 2014
sum=0;
i=-1;
ad=1;
while ad > 0.00001
    i = i+1;
    k= 4*i+1;
    ad = gamma(i+1/2)/gamma(1/2)/gamma(i+1) * ...
        sqrt(k) * exp(-k^2/(16*x))* ...
        (besseli(-1/4, k^2/(16 * x) )-besseli(1/4, k^2/(16*x))) ;
 sum=sum+ad;
end
prob=1/sqrt(2*x) * sum;
