BUG: Fix initialization of f&g; ENH: Add pdf() method to nodes.

Initialization was not working properly because f and g were set
to zeros after the initialization. Now this was moved before
initialization.

New methods pdf and logpdf enable one to get the density function
of nodes. This can be used, for instance, for plotting the
approximate posterior distributions on a mesh grid.
BUG: Ensure that input is numpy array