Functions for calculating fractal dimension.