function f=niglogdens(x,a,b,d,m)
% the parameters a,b,d,m  are alpha, beta, delta, mu. I corrected the first term to log(a*d) on May 6, 2004
c=sqrt(d^2+(x-m).^2);
f=log(a*d)-log(pi)+d*sqrt(a^2-b^2)+b*(x-m)+log(besselk(1,a*c))-log(c);