Magnitude Expression

Home • Gallery • Tutorials • Download • Purchase • Site Map

Magnitude Expression Properties Page

The Fractal Science Kit fractal generator Magnitude Expression page is used to set the Magnitude distance metric and defines how to compute the magnitude of a point.

See also:

When you set the Magnitude (distance metric) property on the Mandelbrot / Julia / Newton properties page to Magnitude Expression, the Magnitude Expression properties page is activated (made visible) in the page hierarchy on the left and you can select it to view the page.

Fractal Science Kit - General Properties Magnitude Expression

The Magnitude Expression section defines how to compute the magnitude of a point.


magnitude = z.x^2 + z.y^2

This setting sums the squares of the z.x and z.y coordinates and assigns the result to the variable magnitude. This is identical to the default Magnitude setting. A positive real value is required. If magnitude is complex, the imaginary component of magnitude is ignored. If magnitude is negative, the absolute value of magnitude is used instead.

Built-in Variables:

  • magnitude
  • z
  • c
  • dwell
  • pixel
  • zprev1
  • zprev2

The variable magnitude is used to return the magnitude of the point z. All of the remaining variables are read-only.

z is the current orbit point. c is the pixel value for Mandelbrot fractals and the Julia Constant for Julia fractals. dwell is the current dwell value. On the 1st iteration, dwell=0, on the 2nd iteration, dwell=1, and so on. pixel is the point on the complex plane associated with the orbit.

zprev1 and zprev2 are the previous 2 values of z in the current orbit. In addition to zprev1 and zprev2, you can access the entire set of orbit points using the Orbit Functions.


if (Orbit.Count() < 4) {
  magnitude = AbsSqr(z)
} else {
  Triangle t = Triangle(z, zprev1, zprev2)

  if (Triangle.CollinearPoints(t)) {
    magnitude = AbsSqr(z)
  } else {
    magnitude = AbsSqr(Triangle.CircumCenter(t))

This example sets the magnitude to the AbsSqr of the CircumCenter of the last 3 orbit points. Because this is executed inside the fractal iteration, it will have a significant impact on performance so try to avoid expensive processing.

Finally, if you use the Magnitude Expression with convergent fractals, you should return a magnitude relative to the previous orbit point not relative to the origin as in the previous examples.


dz = z - zprev1
magnitude = AbsSqr(dz)

This is the default magnitude used for convergent fractals. First, dz is assigned the relative difference of the orbit point z from the previous orbit point zprev1. Then dz is used in the magnitude calculation. This is typical for convergent fractals.


Copyright © 2004-2016 Hilbert, LLC
All rights reserved