Attractor: Guide and examples

Attractor is a tool to generate and animate images based on iterated functions of complex numbers.

Background

Wikipedia: Complex number, Iterated function, Julia set, Mandelbrot set, Newton's method

Simon Tatham's notes on fractals derived from Newton-Raphson iteration

Program

The Program pane is where you define a function that will be iterated.

Plots

A plot shows how the program's result depends on the value of a selected program parameter as that parameter varies within a region of the complex plane.

To render a plot, the app runs your program at each pixel (with the help of WebGL and your graphics hardware) and interprets the result as a color.

Example: Crown - two plots, one for each program parameter.

Coming soon (maybe): plots with multiple varying parameters; non-axis-parallel slices of parameter space, continuous “crossfading” between different independent parameters.

Automation

The Parameters pane is where you set reference values for your program parameters.

You can control a parameter indirectly by enabling automation for it ("☋" button).

Examples:

Program modes

Arbitrary map

You specify a function that maps xn to xn+1, and we iterate it.

Example: The Mandelbrot set and associated Julia sets, arising from the map xx2 + c.

Newton's method

You specify a function and we iterate Newton's method on it.

Internally, the app differentiates your expression to obtain an exact expression for the Newton's method step.

Examples:

Newton's method (ODE)

You specify a polynomial by giving its derivative and a single point value, and we iterate Newton's method on it. All three expressions can contain parameters.

This mode enables direct manipulation of critical points, which correspond to the flower-like "centers" in the state-space fractal (as observed by Tatham under "dissection").

Internally, the app converts your polynomial to standard form (using an "expression FFT": substituting roots of unity for x and recombining the results to obtain expressions for the coefficients), then integrates it symbolically to get f(x) in standard form.

Examples:

Coloring

Program results are mapped to colors as follows:

  1. Start with a color derived from the ending value xn using a smooth, periodic coloring of the plane (a hardcoded combination of red, green, and blue “waves” going in different directions).
    • For an escape result, use 0 as the ending value (maps to white).
    • For a cycle result (where the program converged to a repeating cycle of values), select a cycle member based on the pixel’s image coordinates so as to produce diagonal stripes in regions where the limit cycle varies smoothly.
  2. Darken based on n, the number of iterations that happened. More iterations = darker.
    • This is scaled based on the configured iteration limit, so a higher limit yields a brigher image.
    • Iteration counts for fixed-point and escape results are smoothed by comparing the final step to the termination threshold using Tatham's heuristic (under "decoration").
Coming soon (maybe): customizable coloring, some kind of automatic white balance.

About

Made by Karl Dray in 2020 with funding from dookie cough, San Francisco's leading canine wardrobe consultancy and venture anticapitalism firm.

Make a sweet fractal? Have feedback on the app? Want to contribute? Want to work on other math-related web apps? E-mail me.