Click on the image to see its parameters.
Tutorial: Alternating Functions Fractal Formula
Text and Images © 2013
This formula allows you to create fractals using several different functions.
The functions are alternated, one being used each iteration. The ways in which
they are alternated can be changed, as well as the value that is sent to the
Each iteration, one formula is chosen from a group of up to six. Those
functions are chosen from a palette of 12 possibilities: two Mandelbrots, two Julias,
four Newtons, and four Popcorn fractal formulas.
The Mandelbrots are of the standard variety, iterating the function z = zn
+ c, where z is initialized to a constant value (typically, 0) and c takes on the
value of the pixel. Each Mandelbrot can have its own power, n.
Likewise, the Julias are of the standard variety. They iterate the function z =
zn + c, where z is initialized to the pixel value and c takes on a specific
parameter value. Each Julia can have its own power, n, and parameter, c.
To see why there are four Newton functions, consider how the Newton function is
typically used. A standard Newton fractal could be created by using Newton's method
to find the fourth roots of 1, that is, find z such that z4 = 1. This is
a Julia form of Newton fractal; the initial value of z is taken from the pixel and
the value c is a constant for all pixels (1, in this example). In this formula, this
function is denoted "Newton J." There is also a Mandelbrot form of the Newton fractal,
denoted here as "Newton M." With a Newton M, the initial value of z is an input parameter
and c is taken from the pixel value. See the below figure for examples of each. The
Alternating Functions fractal formula allows for two different Newton M functions and
two different Newton J functions. Click on the images to see their parameters.
z4 = pixel
initial z = 1
z4 = 1
initial z = pixel
There are also four Popcorn functions, two each of two different types. The basic Popcorn
algorithm splits z into its real and imaginary parts, x and y, respectively. Then, each
component is iterated independently and the new components are combined into the new z:
While this was intended to be implemented with real values of x, y, step, and frequency,
there's no reason why they can't be complex. The real-valued function is Popcorn R and
the complex function is Popcorn C. You can use two of each.
- xold = the real part of zold and
yold = the imaginary part of zold.
- xnew = xold - step × fouter(yold +
finner(frequency × yold)) and
ynew = yold - step × fouter(xold +
finner(frequency × xold)).
- znew = xnew + (0, 1) × ynew.
Up to six of the 12 functions can be used in the alternating pool. You choose the number
of functions in the pool and then define the functions. For example, you could have three
functions, #1 being a Mandelbrot, #2 being a Newton M, and #3 being a Popcorn R. Then, you
can specify how the functions are alternated. The "ramp" oscillator just repeatedly runs up
through the numbers: 1, 2, 3, 1, 2, 3, 1, 2, 3, etc. The "sine" and "cosine" methods tend
to put more emphasis are some of the functions. With three functions, the sine method would
use them in this order for the first 12 iterations: 2, 3, 3, 2, 1, 1, 1, 3, 3, 3, 1, and 1.
The cosine method yields: 3, 3, 1, 1, 1, 3, 3, 3, 2, 1, 1, and 2. The last two methods,
"random msb" and "random lsb" are two different ways to randomly choose functions, based on
Ultra Fractal's random() function.
Once the function is chosen and iterated, you can determine what value is sent to the coloring
formula. The idea for this was taken from Newton fractals. With the Newton formula, z
usually settles down to one of a few values. However, the difference between the old and
new values of z can be interesting. So, this formula allows you to send the new z (iterate),
the difference between the old and new values, their ratio, or some other combination.
The parameters are in three groups: general, those for the functions being alternated, and those for the oscillator (determining the alternating order).
Alternating function Parameters
- initial z type: Choose "manual" to enter the real and imaginary components of the
initial z value, or "pixel" to have the pixel be the intial z value.
- bailout: For the Mandelbrot, Julia, and Popcorn functions, bailout is based on
the value of znew. For Newton functions, bailout is based on the reciprocal
of the difference between zold and znew. (This allows the Newton
iteration to converge while still using a large bailout value.)
- z type: The number sent to the coloring formula. Choose from "iterate"
(znew), the "difference" between zold and znew, the
"ratio" of znew to zold, and a "weird" combination of the two
- # of functions: How many functions are in the alternating pool, from 1 to 6. If
you choose 1, then the same function is used for every iteration.
- function 1: The type of formula for function 1. Choose from:
This parameter is repeated for the number of functions that you've chosen above.
- (a blank choice--this is explained below)
- Mandelbrot 1 or Mandelbrot 2,
- Julia 1 or Julia 2,
- Newton M 1 or Newton M 2,
- Newton J 1 or Newton J 2,
- Popcorn C 1 or Popcorn C 2, or
- Popcorn R 1 or Popcorn R 2.
- specific parameters for each function: These include the powers for Mandelbrot,
Julia, and Newton types, specific c parameters for the Julia and Newton J types,
and the step, frequency, outer function and inner function for the Popcorn types.
This also includes weights for the Mandelbrot and Julia types and nova factors (weights)
for the Newton functions.
- oscillator type: The choices are: ramp, sine, cosine, random msb, and random lsb.
- initial seed: The initial seed for the random number generator, for either random mode.
- If you want to play with just one type of function, set the number of
functions to 1.
- Mandelbrot/Julia, Newton, and Popcorn formulas have very different dynamics. Thus,
combining them in this way will probably lead to very unpredictable results. It may
be easier to figure out what is going on if you start with just a few functions of the
same basic type.
- Because you can combine Mandelbrot and Julia types into the same image, there's no
ability to "switch" as with a standard Mandelbrot to a standard Julia.
- With the "function 1," "function 2," etc., parameters, the first choice in the
pull-down menu is blank. Selecting this will remove their specific parameters from
the window. For example, let's say that you were using three functions with Newton J 1
as the third. If you then reduced to two functions, the Newton J 1 parameters will
still be visible. To prevent them from showing up, select the blank choice for
function 3 and then change the number of functions to 2.
- Use the weights to reduce the effect of an added function (e.g., the second with 2
alternating functions) to understand how combining it will change the fractal. To
do this, set the weight of the added function to a very small number (like 0.001).
Setting it to 0 will turn it off. For the Mandelbrot and Julia functions, these are
the weights (e.g., "Mandelbrot 1 weight"). For the Newton functions, the weights are
the nova factors (e.g., "Newton M1 nova factor"). With the Popcorn functions, the
step size works as a weight.
to Tutorials page
to my home page