The Standard Distribution Functions for the 3D NFW Profile

Density, distribution function, quantile function and random generation for the 3D Navarro, Frenk & White (NFW) profile. For details see Robotham & Howlett (2018) .

title: "NFW Distribution Sampling" output: github_document

knitr::opts_chunk$set(echo = TRUE)

This package lets you sample from the NFW as a true PDF with the only variable being the concerntration (con in the package).


Load with:



Here we see that our random draws (using the rnfw via the qnfw function) produces the right PDFs (as per dnfw):

for(con in c(1,5,10,20)){
  plot(density(rnfw(1e6,con=con), bw=0.01))
  lines(seq(0,1,len=1e3), dnfw(seq(0,1,len=1e3),con=con),col='red')
  legend('topright',legend=paste('con =',con))


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.0 by Aaron Robotham, 9 months ago

Browse source code at

Authors: Aaron Robotham

Documentation:   PDF Manual  

GPL-3 license

Suggests knitr, gsl, lamW

See at CRAN