All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.maths.chaos.CantorDust Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.maths.chaos;

/**
* The CantorDust class provides an object that encapsulates the Cantor dust fractal.
* @version 0.1
* @author Mark Hale
*/
public abstract class CantorDust extends Object {
        public CantorDust() {}
        public double hausdorffDimension() {
                return Math.log(2.0)/Math.log(3.0);
        }
        /**
        * The recursive algorithm for Cantor dust.
        * @param start the start of the line.
        * @param end the end of the line.
        * @param n the number of recursions.
        */
        public void recurse(double start, double end, int n) {
                if(n==0)
                        return;
                final double l_3=(end-start)/3.0;
                eraseLine(start+l_3, end-l_3);
                recurse(start, start+l_3, n-1);
                recurse(end-l_3, end, n-1);
        }
        /**
        * Erases a line segment.
        * This need not be an actual graphical operation,
        * but some corresponding abstract operation.
        */
        protected abstract void eraseLine(double start, double end);
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy