# Sample Functions Support

The Fractal Science Kit fractal generator Sample functions are used by several of the built-in Orbital Equations that search for interesting fractals.

Complex Sample.Density(sample[,])
Complex Sample.Mean(sample[,])
Complex Sample.Variance(sample[,])
Complex Sample.BCD(sample[,], count)

Sample.Add is used to count the orbit points that fall within a user defined area. Sample.Density, Sample.Mean, Sample.Variance, and Sample.BCD are used to cull potential fractal results based on user supplied criteria.

The sample[,] array used by all of the methods and is required to be dimensioned as:

Complex sample[48, 48]

Call Sample.Add to add the point z to the sample array. A uniform square grid is defined about the origin that is 2*radius units along each side. The sample array is mapped to the set of boxes formed by the grid. The sample array element is incremented if the point z falls inside the associated sample box.

Sample.Density returns the density of sample array as a number between 0 and 1. The density is the number of non-0 array elements divided by the total number of array elements. Sample.Density provides a measure of how concentrated the points are with respect to the sample grid. Fractals associated with density values that are too small (e.g., 0.1) or too large (e.g., 0.4) tend to be uninteresting.

Sample.Mean returns the mean of the non-0 elements in sample array. Sample.Variance returns the variance of the non-0 elements in sample array with respect to the mean. Small variance values (e.g., 0.4) tend to indicate a uniform (and uninteresting) appearance.

Sample.BCD returns the box-counting dimension of the area. The box-counting dimension is defined as:

dimension = Log(S/T)/Log(2)

S is the number of samples in the 48 x 48 sample array greater than count. T is the number of samples greater than count in an array dimensioned 24 x 24 covering the same area.