function [density_estimation] = estimate_density_gauss_kernel(P,domain,bandwidth)


%%Very Slow....
%density_estimation = zeros(length(domain),1);

%for kk=1:length(domain)
%    distances=(domain(kk)-P)/bandwidth;
%    density_estimation(kk)=sum(exp(-distances.^2./2)./sqrt(2*pi))/(length(P)*bandwidth);
%end

%%Faster...
shared_divisor=sqrt(2*pi)*length(P)*bandwidth;
local_density=@(cur_domain) sum(exp(-((cur_domain-P)./bandwidth).^2./2))/shared_divisor;

density_estimation=arrayfun(local_density, domain);




