ruff-0.1: relatively useful fractal functions




External angles give rise to kneading sequences under the angle doubling map. Internal addresses encode kneading sequences in human-readable form, when extended to angled internal addresses they distinguish hyperbolic components in a concise and meaningful way.

The algorithms are mostly based on Dierk Schleicher's paper Internal Addresses Of The Mandelbrot Set And Galois Groups Of Polynomials (version of February 5, 2008)



type Angle = RationalSource

Angle as a fraction of a turn, usually in [0, 1).

double :: Angle -> AngleSource

Angle doubling map.

wrap :: Angle -> AngleSource

Wrap an angle into [0, 1).

data Knead Source

Elements of kneading sequences.



data Kneading Source

Kneading sequences. Note that the Aperiodic case has an infinite list, which the Pretty instance truncates arbitrarily.

kneading :: Angle -> KneadingSource

The kneading sequence for an external angle.

period :: Kneading -> Maybe IntegerSource

The period of a kneading sequence, or Nothing when it isn't periodic.

unwrap :: Kneading -> [Knead]Source

Unwrap a kneading sequence to an infinite list.

data InternalAddress Source

Internal addresses are a non-empty sequence of strictly increasing integers beginning with '1'.


InternalAddress [Integer] 

internalAddress :: Kneading -> Maybe InternalAddressSource

Construct an InternalAddress from a kneading sequence.

associated :: Kneading -> Maybe (Kneading, Kneading)Source

A star-periodic kneading sequence's upper and lower associated kneading sequences.

upper :: Kneading -> Maybe KneadingSource

The upper associated kneading sequence.

lower :: Kneading -> Maybe KneadingSource

The lower associated kneading sequence.

internalFromList :: [Integer] -> Maybe InternalAddressSource

Construct a valid InternalAddress, checking the precondition.

internalToList :: InternalAddress -> [Integer]Source

Extract the sequence of integers.

angledInternalAddress :: Angle -> Maybe AngledInternalAddressSource

The angled internal address corresponding to an external angle.

angledFromList :: [(Integer, Maybe Angle)] -> Maybe AngledInternalAddressSource

Builds a valid AngledInternalAddress from a list, checking the precondition that only the last 'Maybe Angle' should be Nothing, and the Integer must be strictly increasing.

externalAngles :: AngledInternalAddress -> Maybe (Rational, Rational)Source

The pair of external angles whose rays land at the root of the hyperbolic component described by the angled internal address.

stripAngles :: AngledInternalAddress -> InternalAddressSource

Discard angle information from an internal address.

parse :: String -> Maybe AngledInternalAddressSource

Parse an angled internal address, accepting some unambiguous abbreviations.