So any idea how i would go about with implementing those, in UF for example? I can probably make sense of the formulas themselves, but i don't know exactly what the configuration files are supposed to contain...
The "ordinary" formula template is pretty straightforward - the formulas just go in plain text files but with the extension ".ufm" instead of ".txt".
The standard Mandelbrot looks like this at its simplest:
StandardMandelbrot {
;
; Standard Mandelbrot set.
;
init:
z = @start
loop:
z = z^@power + #pixel
bailout:
|z| <= @bailout
default:
title = "Standard Mandelbrot"
center = (-0.5, 0)
param start
caption = "Starting point"
default = (0,0)
hint = "The starting point parameter can be used to distort the Mandelbrot \
set. Use (0, 0) for the standard Mandelbrot set."
endparam
param power
caption = "Power"
default = (2,0)
hint = "This parameter sets the exponent for the Mandelbrot formula. \
Increasing the real part to 3, 4, and so on, will add discs to \
the Mandelbrot figure. Non-integer real values and non-zero \
imaginary values will create distorted Mandelbrot sets. Use (2, 0) \
for the standard Mandelbrot set."
endparam
float param bailout
caption = "Bailout value"
default = 4.0
min = 1.0
hint = "This parameter defines how soon an orbit bails out while \
iterating. Larger values give smoother outlines; values around 4 \
give more interesting shapes around the set. Values less than 4 \
will distort the fractal."
endparam
}
So if you change the above "loop:" section calculation to your funky formulas then you'd have your own formula - obviously you should think up your own name for it (often authors use names based on the shapes produced by the formula).
Note that ideally you should extend your formula to take advantage of Ultra Fractal's switch facility that allows switching to Julia Sets based on a position on the Mandelbrot.
There are two ways to do this - you can either write a separate Julia formula that the Mandelbrot switches to or you can write the one formula so it handles both Mandelbrot and Julia variations and switches to itself.
Here's an example of a formula that switches to itself:
MMFSa-Standard {
;
; Generic Mandelbrot set with extended switching.
; IMPORTANT NOTE - After switching by replacing
; the value of one of the parameters by the switched
; value if you wish to switch by replacing a DIFFERENT
; parameter with the switched value then you must
; first copy the current switched value into the
; parameter it is replacing.
;
; Created 21st April 2002
;
; © David Makin 2002
;
init:
complex px = #pixel
if @usescale != 1.0
px = px/@usescale
endif
if @usecentre != (0,0)
px = px + @usecentre
endif
complex z = @start
complex c = @c
complex s = @s
complex p = @p*4
complex m = @m
complex n = @n
if @mjmode<5
z = @value
elseif @mjmode<10
c = @value
elseif @mjmode<15
s = @value
elseif @mjmode<20
p = @value*4
elseif @mjmode<25
m = @value
elseif @mjmode<30
n = @value
endif
if @mjmode==5 || @mjmode==10 || @mjmode==15 || @mjmode==20 || @mjmode==25
z = px
elseif @mjmode==0 || @mjmode==11 || @mjmode==16 || @mjmode==21 || @mjmode==26
c = px
elseif @mjmode==1 || @mjmode==6 || @mjmode==17 || @mjmode==22 || @mjmode==27
s = px
elseif @mjmode==2 || @mjmode==7 || @mjmode==12 || @mjmode==23 || @mjmode==28
p = px*4
elseif @mjmode==3 || @mjmode==8 || @mjmode==13 || @mjmode==18 || @mjmode==29
m = px
elseif @mjmode==4 || @mjmode==9 || @mjmode==14 || @mjmode==19 || @mjmode==24
n = px
endif
float x = real(z)
float y = imag(z)
float t = x
complex zold = (0,0)
complex zo = zold
complex zs = (0,0)
complex zp = (1,0)
float ang = #pi*@ang/180.0
float ca = cos(ang)
float sa = sin(ang)
float r0c0 = real(m)*ca-real(n)*sa
float r0c1 = real(m)*sa+real(n)*ca
float r1c0 = imag(m)*ca-imag(n)*sa
float r1c1 = imag(m)*sa+imag(n)*ca
bool bail = true
loop:
zo = zold
zold = z
if @sigma == true
z=z+zs
zs=z
endif
if |z|>0 && @product == true
z = z*zp
zp = z
endif
z = @fn1(z)
if @selfrot > 0
t = cabs(z)
if t > 0
z = z*z/t
endif
if @selfrot == 2
z = z + px
endif
endif
x = real(z)
y = imag(z)
t = x
x = x*r0c0 + y*r1c0
y = t*r0c1 + y*r1c1
z = x + flip(y)
if @fractal == 0
z = s*z^p + c
elseif @fractal == 1
z = s*z^p + zo + c
elseif @fractal == 2
z = s*zo*z^p + c
endif
if @smallbail == true && |z-zold| < @bailout1
bail = false
endif
bailout:
bail && ((@test == 0 && |z| <= @bailout) || \
(@test == 1 && sqr(real(z)) <= @bailout) || \
(@test == 2 && sqr(imag(z)) <= @bailout) || \
(@test == 3 && (sqr(real(z)) <= @bailout && sqr(imag(z)) < @bailout)) || \
(@test == 4 && (sqr(real(z)) <= @bailout || sqr(imag(z)) < @bailout)) || \
(@test == 5 && (sqr(abs(real(z)) + abs(imag(z))) <= @bailout)) || \
(@test == 6 && (sqr(real(z) + imag(z)) <= @bailout)) || \
(@test == 7 && (abs(sqr(real(z))/imag(z)) <= @bailout)) || \
(@test == 8 && (abs(sqr(imag(z))/real(z)) <= @bailout)) || \
(@test == 9 && (sqr(real(z))/imag(z) <= @bailout)) || \
(@test == 10 && (sqr(imag(z))/real(z) <= @bailout)))
default:
title = "Switch Standard"
center = (-0.5, 0)
method = multipass
periodicity = 0
param value
caption = "Switched value"
default = (0,0)
hint = "This is the value passed using the switch function. \
After switching it should be copied into the parameter \
that was replaced using the switch (before you use the \
switch again replacing a different parameter)."
endparam
param start
caption = "Start z"
default = (0,0)
hint = "The starting z value for the Mandelbrot modes. \
Used in all modes except the 'J' ones, or the \
(Zstart) ones."
endparam
param c
caption = "Constant"
default = (0.5,0)
hint = "The constant c in s*z^p+c, used in all modes except the 'Mc' ones \
or the (Constant) ones."
endparam
param s
caption = "Scale"
default = (1,0)
hint = "The scale s in s*z^p+c, used in all modes except the 'Ms' ones \
or the (Scale) ones."
endparam
param p
caption = "Power/4"
default = (0.5,0)
hint = "The power p/4 in s*z^p+c, used in all modes except the 'Mp' ones \
or the (Power) ones). \
The actual exponent used is 4* the displayed value - this \
is to allow a better range of values for switching."
endparam
param fractal
caption = "Fractal type"
default = 0
enum = "s*z^p+c" "s*z^p+zold+c" "s*zold*z^p+c"
hint = "Choose the classic standard Mandelbrot, the classic 'Manowar' or \
the third option which uses zold like Manowar but multiplies by it \
instead of adding it."
endparam
param m
caption = "Matrix col 0 (m)"
default = (1,0)
hint = "Column 0 of a generalised \
transformation matrix - use (1,0) \
for the identity matrix. Used in all \
modes except the 'Mm' ones or the (Matrix m) ones."
endparam
param n
caption = "Matrix col 1 (n)"
default = (0,1)
hint = "Column 1 of a generalised \
transformation matrix - use (0,1) \
for the identity matrix. Used in all \
modes except the 'Mn' ones or the (Matrix n) ones."
endparam
param ang
caption = "Rotation (degrees)"
default = 0.0
hint = "Rotational transformation applied at each \
iteration. Really only signficant when First \
function is not ident."
endparam
param sigma
caption = "Iterate the sum"
default = false
hint = "When enabled instead of z1=f(z0), z2=f(z1), z3=f(z2) etc. \
z1=f(z0), z2=f(z0+z1), z3=f(z0+z1+z2) etc. "
endparam
param product
caption = "Iterate the product"
default = false
hint = "When enabled instead of z1=f(z0), z2=f(z1), z3=f(z2) etc. \
z1=f(z0), z2=f(z0*z1), z3=f(z0*z1*z2) etc. The process is \
fudged slightly if zn is zero at any time."
endparam
param selfrot
caption = "Self-rotation"
default = 0
enum = "Disabled" "Enabled" "Plus c"
hint = "When enabled z is rotated by atan2(z) at the start of each iteration. \
Plus c does the same but also adds #pixel to the rotated value, it's \
only here as it produces some interesting results."
endparam
param test
caption = "Bailout Test"
default = 0
enum = "mod" "real" "imag" "or" "and" "manh" "manr" "abs(x*x/y)" \
"abs(y*y/x)" "x*x/y" "y*y/x"
hint = "Modifies the divergent bailout test condition, some modes \
will require smaller bailout values to produce a good effect. \
'x*x/y' and 'y*y/x' were added for MMFrac compatibility."
endparam
param bailout
caption = "Bailout value"
default = 65536.0
min = 1.0
hint = "Defines how soon an orbit bails out, i.e. doesn't belong \
to the Mandelbrot set anymore."
endparam
param smallbail
caption = "Convergence"
default = false
hint = "Enables or disables convergence testing."
endparam
param bailout1
caption = "Small bailout"
default = 1e-5
hint = "Bailout for detecting convergence."
endparam
param usescale
caption = "Current scale adjust"
default = 1.0
hint = "Used for switching in combination with the Switch scale adjust. \
After switching you should really set this value back to 1.0."
endparam
param usecentre
caption = "Current centre adjust"
default = (0,0)
hint = "Used for switching in combination with the Switch centre adjust. \
After switching you should really set this value back to (0,0)."
endparam
param swscale
caption = "Switch scale adjust"
default = 1.0
hint = "Used for switching in combination with the Current scale adjust. \
Modify the value to zoom the switch preview. 0<values<1.0 will \
reduce the switch, values>1.0 will magnify the switch. Particularly \
useful for finding interesting small Julias."
endparam
param swcentre
caption = "Switch centre adjust"
default = (0,0)
hint = "Used for switching in combination with the Current centre adjust. \
Modify the value to centre the switch preview. Particularly useful \
for finding interesting small Julias."
endparam
param mjmode
caption = "Current mode"
default = 0
enum = "Mc(Zstart)" "Ms(Zstart)" "Mp(Zstart)" "Mm(Zstart)" "Mn(Zstart)" \
"J(Constant)" "Ms(Constant)" "Mp(Constant)" "Mm(Constant)" "Mn(Constant)" \
"J(Scale)" "Mc(Scale)" "Mp(Scale)" "Mm(Scale)" "Mn(Scale)" \
"J(Power)" "Mc(Power)" "Ms(Power)" "Mm(Power)" "Mn(Power)" \
"J(Matrix m)" "Mc(Matrix m)" "Ms(Matrix m)" "Mp(Matrix m)" "Mn(Matrix m)" \
"J(Matrix n)" "Mc(Matrix n)" "Ms(Matrix n)" "Mp(Matrix n)" "Mm(Matrix n)"
hint = "Works for switching in combination with the Switch to parameter. \
The item in brackets indicates which parameter is \
replaced by the switched value. The J modes are where \
#pixel is used as Zstart and n in Mn indicates how #pixel \
is used otherwise."
endparam
param swmode
caption = "Switch using"
default = 5
enum = "Mc(Zstart)" "Ms(Zstart)" "Mp(Zstart)" "Mm(Zstart)" "Mn(Zstart)" \
"J(Constant)" "Ms(Constant)" "Mp(Constant)" "Mm(Constant)" "Mn(Constant)" \
"J(Scale)" "Mc(Scale)" "Mp(Scale)" "Mm(Scale)" "Mn(Scale)" \
"J(Power)" "Mc(Power)" "Ms(Power)" "Mm(Power)" "Mn(Power)" \
"J(Matrix m)" "Mc(Matrix m)" "Ms(Matrix m)" "Mp(Matrix m)" "Mn(Matrix m)" \
"J(Matrix n)" "Mc(Matrix n)" "Ms(Matrix n)" "Mp(Matrix n)" "Mm(Matrix n)"
hint = "Works for switching in combination with the Current mode parameter. \
After switching the Switched value parameter is used instead of the \
parameter in brackets and should be copied into that parameter before \
switching a different parameter - see the hints for Current mode."
endparam
func fn1
caption = "First function"
default = ident()
hint = "Try using Conj or Flip."
endfunc
switch:
type = "MMFSa-Standard"
value = #pixel
start = start
c = c
s = s
p = p
fractal = fractal
m = m
n = n
ang = ang
sigma = sigma
product = product
selfrot = selfrot
test = test
bailout = bailout
smallbail = smallbail
bailout1 = bailout1
usescale = swscale
usecentre = swcentre
swscale = swscale
swcentre = swcentre
mjmode = swmode
swmode = swmode
fn1 = fn1
}
Note that the above allows viewing of the formula in many different ways.
Also see the help for writing formulas that's built into Ultra Fractal as it is pretty comprehensive.