Cayley-mand {
; Ron Barnett, February 1999
; based upon the formula z = z^3 - az - c + 1
; convergence methods added 10/2/2004
init:
complex fz = 0
complex fzp = 0
complex fzp2 = 0
#z = 0
(这是z的定位初值,注意,着色前,不能直接将z合并到原点,另造(0,0)的点,
再将z合并到该点) complex oldz = 0
complex a = #pixel
(这句意思是将#pixel的值赋给a,让a参与后面的复函数式的运算。但在画板中,
往往是让a先参与运算,迭代后,再将其合并到#pixel最后对#pixel着色。但在此例中,
不涉及a的迭代问题,合并不合并无关系,所以就将a当成#pixel即可。) float iterate = 0
loop:
iterate = iterate + 1
oldz = #z
fz = #z^3 - a*z - a + 1
fzp = 3*#z^2 - a
fzp2 = 6*#z
if @converge == 0 ; Newton
#z = #z - fz/fzp
elseif @converge == 1 ; Householder
#z = #z - fz/fzp*(1 + fz*fzp2/(2*fzp^2))
elseif @converge == 2 ; Halley
#z = #z - 2*fz*fzp/(2*fzp^2 - fz*fzp2)
elseif @converge == 3 ; Schroder
#z = #z - fz*fzp/(fzp^2 - fz*fzp2)
elseif @converge == 4 ; Ho custom
#z = #z - fz/fzp*(1 + fz*fzp2/(@custom*fzp^2))
elseif @converge == 5 ; Ha custom
#z = #z - 2*fz*fzp/(@custom*fzp^2 - fz*fzp2)
elseif @converge == 6 ; H_S custom
#z = #z - @custom*fz*fzp/(@custom*fzp^2 - fz*fzp2)
elseif @converge == 7 ; Mixed1
if iterate % 2 == 0
(查UF中的帮助,知道:a % b = a - trunc(a/b) * b)
#z = #z - fz/fzp*(1 + fz*fzp2/(2*fzp^2))
else
#z = #z - fz/fzp
endif
elseif @converge == 8 ; Mixed2
if iterate % 2 == 0
#z = #z - 2*fz*fzp/(2*fzp^2 - fz*fzp2)
else
#z = #z - fz/fzp
endif
elseif @converge == 9 ; Mixed3
if iterate % 2 == 0
#z = #z - fz*fzp/(fzp^2 - fz*fzp2)
else
#z = #z - fz/fzp
endif
elseif @converge == 10 ; Mixed4
if iterate % 2 == 0
#z = #z - @custom*fz*fzp/(@custom*fzp^2 - fz*fzp2)
else
#z = #z - fz/fzp
(Newton、Householder、Halley、Schroder、Ho custom……这些都是复分开关,在每个开关里,
都可找到相应的复分形迭代式。可仿照前面的做法弄在一个文件中,但是怕秀气的几何画板吃不消,
扫不动。所以先弄少许的几个,然后改变计算式,再弄出其余的几个,再将就原文件进行修改,
弄出其余的几个,将负载减少。各别开关项里有@custom,你在UF面板上调出相应的开关项时,
立刻在该开关项的下面,就会出现H_S constant,里面的值就是@custom.这是可变参数。) endif
endif
bailout:
|#z - oldz| >= @bailout
default:
title = "Cayley Mandel"
maxiter = 1000
center = (0.3593516980975, 0)
magn = 360
method = multipass
periodicity = 0
heading
caption = "Cayley Mandelbrot"
endheading
$ifdef VER40
heading
text = "This is a 'convergent' fractal that uses multiple convergence \
methods and has Mandelbrot-like regions for several convergence methods."
endheading
$else
heading
caption = "This is a 'convergent' fractal"
endheading
heading
caption = "that uses multiple convergence"
endheading
heading
caption = "methods and has Mandelbrot-like regions"
endheading
heading
caption = "for several convergence methods."
endheading
$endif
param version
caption = "Formula Version"
default = 1.0
hint = "You should never see this parameter; it's used internally to track \
which version of the formula was used to create your image, so that \
if a bug is found which breaks backwards-compatibility, the formula \
can adapt transparently."
visible = false
endparam
param bailout
caption = "Bailout value"
default = 0.000001
endparam
heading
caption = "Convergence Methods"
endheading
param converge
caption = "Convergence Method"
default = 0
enum = "Newton" "Householder" "Halley" "Schroder" "Ho Custom" \
"Ha Custom" "H_S Custom" "Mixed1" "Mixed2" "Mixed3" "Mixed4"
endparam
float param custom
caption = "H_S Constant"
default = 1.5
(custom即为UF面板上的H_S Constant",为1.5,也可为其它的值,为可变参数)
visible = @converge==4 || @converge==5 || @converge==6 || @converge==10
endparam
switch:
type = "Cayley-jul"
bailout = @bailout
converge = @converge
p1 = #pixel
custom = @custom
} |