logd function

Log-density and its derivative values