function [binomial_probability,standard_normal_density_integral]=Compare_binoPROB_sndINT( n,p,low_bound, up_bound )
%COMPARE_BINOPROB_NDINT compares the actual values of the binomial
%distribution to the estimates provided by integrals of the standard normal density
%function. Of course estimates are involved in the ND integrals since this
%program itself is numerical. This program is intended only for
%illustrative purposes, and does not provide any other functionality.

%get the binomial distribution data.
bino_base=low_bound:up_bound;
bino_pdf_vals=binopdf(bino_base,n,p);

%setup the stanard normal density function.
F = @(x)1/sqrt(2*pi)*exp(-(x^2)/2);

%setup the print format so that we get more digits.
format('long')

%compute and print the results.
binomial_probability=sum(bino_pdf_vals)
standard_normal_density_integral=...
    quadv(F,...
    (low_bound-.5-n*p)/(sqrt(n*p*(1-p)))...
    ,(up_bound+.5-n*p)/(sqrt(n*p*(1-p))))

%return the print format settings to default for the user.
format('short')

end