Creating a new formula

This topic shows step by step how to create your first fractal formula, a basic Mandelbrot set.

  1. Create a new fractal. It does not matter which formula is selected, since it will be replaced by your own.
  2. Click New on the File menu, and then click Fractal Formula File. The formula editor appears with an empty file.
  3. Click New Formula on the Insert menu. Enter “My Mandelbrot” as the title and click OK. The new entry should now appear in the formula editor.
  4. After the init: label, insert the following line:
    z = 0
    This initializes the complex variable z to (0,0).
  5. After the loop: label, insert the following line:
    z = z * z + #pixel
    This is the main equation for the Mandelbrot set. #pixel refers to the coordinates of the pixel being computed and will be different for every pixel. The statements in the loop section will be executed repeatedly.
  6. After the bailout: label, insert the following line:
    |z| < 4
    This defines when Ultra Fractal should stop repeating (or iterating) the statements in the loop section. With this condition, the loop section will be iterated as long as |z| (equal to sqr(real(z)) + sqr(imag(z))) remains smaller than (4,0).
  7. The formula should now look like this:
      MyMandelbrot {  init:    z = 0  loop:    z = z * z + #pixel  bailout:    |z| < 4  default:    title = "My Mandelbrot"  }    
  8. Save the new formula by clicking Save As on the File menu. Enter “My Formulas.ufm” as the filename and click Save.
  9. Now, click the Browse button in the Formula tab of the Layer Properties tool window. Select “My Mandelbrot” from the file “My Formulas” and click OK.
  10. Congratulations! You have just created your first fractal formula.

Notes

  • If compiling the formula results in compiler errors, make sure you have entered the formula correctly. Highlight the error in the Compiler Messages tool window and click the Trace button to see where the first error occurred. Correct the error and click the Reload button in the Formula tab to try again (changes in the formula will be saved automatically).
  • Try to experiment with the loop section. For example, change z * z into z * z * z and see what happens. Click the Reload button in the Formula tab to reload the formula after you have changed it.

Next: Formula files and entries

See Also
Fractal formulas
Formula editors

Creating a new formula