Skip to content

User Formulas

J.B. Langston edited this page Jan 11, 2020 · 16 revisions

XaoS supports entering your own custom formulas:

  1. Select User formula from the Fractal menu to define a custom fractal formula.
  2. (Optional) Select User initialization to calculate a different starting point z0 for each pixel. By default z0 is set to 0.

User formulas should be interpreted as functions in the form Z(n+1) = formula (Z(n), Z(n-1), C). Here Z(0) is the same as z0 above.

Variables

In user formulas, as shown above, three variables are available:

variable meaning
Z current sequence point Z(n)
C current plane 'point'
P previous sequence point Z(n-1)
N current iteration number n (beginning with 1)

Constants

Format for complex numbers is {re;im}, e.g. {3;2} is complex number 3+2i. You must write constants for the coordinates. Note that you need to use a semicolon. Also, parameters in functions must be separated by semicolons (see below).

The number {0;1} can also be written as I. If you need to express a complex number with a non-constant, split it to real and imaginary parts like this: (RE(Z)+IM(Z)*I)^2+C.

Real numbers can be used as usual.

Functions

Available functions are listed below:

Basic operations

+, -, *, /, ^

The multiplication sign may be omitted in most cases.

Real and imaginary part

  • RE(z) - real part of z
  • IM(z) - imaginary part of z

Power functions

  • POWI(z;n) - power of z with integer exponent n (fastest)
  • POWD(z;n) - power of z with real exponent n
  • POWDC(z;n) - power of z with complex exponent n
  • POW(z;n) - same as powd(z;n) The symbol ^ can also be used (see above) without explicitly defining the number set for the exponent.

Basic trigonometry

  • SIN(z), COS(z), TAN(z), COT(z), ASIN(z), ACOS(z), ATAN(z), ACOT(z), SINH(z), COSH(z), TANH(z), COTH(z) can be used for computing trigonometrical functions

Exponential and logarithmic functions

  • EXP(z), LOG(z) - exponential and natural logarithm of z
  • LOG2(z), LOG10(z) - logarithm of z in base 2 and 10
  • LOGN(n;z) - logarithm of z in base n (where n is integer)
  • LOGCN(c;z) - logarithm of z in base c (where c is complex)
  • SQRT(z) - square root of z

Other functions

  • RAND(max) - random real number in range [0, max)
  • ABS(z) - absolute value of z

Examples

  • Z^2+C and Z^3+C produce the quadratic and cubic Mandelbrot sets. Z^2.5+C produces another fractal "between them".
  • (RE(Z)+IM(Z)I)^2+C also produces the quadratic Mandelbrot set.
  • POWD(Z;2)+C creates the quadratic Mandelbrot set. A minor change in the formula, by using POWDC(Z;{2;0.1})+C is equivalent to Z^{2;0.1}+C.
  • (ABS(RE(Z))+I*ABS(IM(Z)))^2+C produces the Burning Ship fractal.
  • Z^2+C*(-1)^N expresses the iteration (((z0^2-C)^2+C)^2-C)^2+....

Notes

  • The entered formula is case insensitive. But it will always be rewritten in capitalized letters if the parsing was successful.
  • Handling user formulas is still in experimental phase. Please expect random crashes or malfunctioning in some cases.
  • Fast computation of user formulas is based on Mateusz Malczak's SFFE library.
Clone this wiki locally