今天高考结束后,想从UF中找一个有趣的范例来做,可是到半中间给卡住了。如何从半中间开始迭代呢?
Meet100_1_0 {
; Generic Mandelbrot set
init:
complex u = 1/#pixel - 1
complex uu = sqr(u)
complex u3i = 1/((2*u - 3)*uu + 1)
complex s = ((2*uu - 3*u)*uu + 1.5)*u3i
complex p = sqrt((9 - 6*u)*u3i)
complex a3 = 0.3333333333333333333
complex a2 = -0.5*p
complex a0 = s*p
z = a0
loop:
z = (a3*z + a2)*sqr(z) + a0
bailout:
|z| <= @bailout
default:
title = "Meet100_1_0"
center = (0, 0)
param start
caption = "Starting point"
default = (1,0)
hint = "Perturbation. Use (1,0) for the standard Mandelbrot set."
endparam
param power
caption = "Power"
default = (1,0)
hint = "This defines the power of the Mandelbrot set. Use (1,0) \
for the standard Mandelbrot set."
endparam
param bailout
caption = "Bailout value"
default = 128.0
min = 1.0
hint = "Defines how soon an orbit bails out, i.e. doesn't belong \
to the Mandelbrot set anymore."
endparam
switch:
type = "Jeet100_1_0"
seed = #pixel
power = power
bailout = bailout
}
效果图:
这个奇怪的UF中的范例,我做了两遍都与结果相去甚远:
Critper3 {
; Generic Mandelbrot set
init:
complex s = #pixel
;s=1-1/s
;s=1-1/s
complex a3 = 0.3333333333333333333
complex pp = (1/(s - s*s) - s)*3/s
complex a0 = sqrt(pp)
complex a2 = a0*((s - 1)/pp - a3)
z = -2*a2
loop:
z = (a3*z + a2)*sqr(z) + a0
bailout:
|z| <= @bailout
default:
title = "Critper3"
center = (0, 0)
param start
caption = "Starting point"
default = (1,0)
hint = "Perturbation. Use (1,0) for the standard Mandelbrot set."
endparam
param power
caption = "Power"
default = (1,0)
hint = "This defines the power of the Mandelbrot set. Use (1,0) \
for the standard Mandelbrot set."
endparam
param bailout
caption = "Bailout value"
default = 128.0
min = 1.0
hint = "Defines how soon an orbit bails out, i.e. doesn't belong \
to the Mandelbrot set anymore."
endparam
switch:
type = "Jritper3"
seed = #pixel
power = power
bailout = bailout
}
再一个Uf难题,如何把两种分形合并在一个画面上(两个分形的空白逃逸区内分别画另一个分形):
JD-SG-04 {
; Sylvie Gallet [101324,3444], 1996
; use p1 and p2 to adjust the inverted Mandel
; modified for UF multi-layer capability by
; Erik Reckase, March 2000
init:
IF (@p3==1)
z=c = pixel
ELSEIF (@p3==0)
z=c = @p1/(pixel + @p2)
ELSE
IF (whitesq)
z=c = pixel
ELSE
z=c = @p1/(pixel + @p2)
ENDIF
ENDIF
loop:
z = z*z + c
bailout:
|z| < 4
default:
title = "JD-SG-04"
periodicity = 0
maxiter = 500
magn = 1
center = (0,0)
method = multipass
param p1
caption = "2nd Mandel Scalar"
default = (-1,0)
hint = "Controls the rotation and scale of the second \
mandel. If multi-layer ,only affects Layer Option '1'"
endparam
param p2
caption = "2nd Mandel Const"
default = (0,0)
hint = "Controls the X/Y position of the second mandel. \
If multi-layer, only affects Layer Option '1'"
endparam
param p3
caption = "Layer Option"
enum = "Option 1" "Option 2" "Original"
default = 2
hint = "Options 1 and 2 are the two separate layers of this \
formula. The 'Original' option uses the original \
PHC formula."
endparam
}
这是UF中一个当型循环比较简单的范例,可一直没办法用几何画板来实现,请大家一起想想办法。如何使几何画板也能实现这类分形。
Lacunary1_M {
; iteration of f(z) = c + z + z^2 + z^4 + ... + z^(2^n)
init:
if (@degree==1)
z = -0.5
elseif (@degree==2)
z = -0.38545849852963
elseif (@degree==3)
z = -0.3828986970212
else
z = -0.38289643077689
endif
loop:
complex summand = z
int k=0
z = z+#pixel
while (k<@degree)
summand = sqr(summand)
z = z + summand
k = k+1
endwhile
bailout:
|z| < @bailout
default:
title = "Lacunary 1 Mandel"
int param degree
caption="degree n"
hint="If your coloring algorithm requires a 'power' or 'exponent', set it to 2^n. \
If you use large values here, you may have to set a small bailout or increase the precision."
default=2
min=1
endparam
float param bailout
caption = "Bailout value"
hint = "Iteration stops when z becomes larger than this bailout."
min=0
default=1e4
endparam
switch:
type="Lacunary1"
c=#pixel
degree=degree
bailout=bailout
}
UF中的一种另类M集,整了老半天不能出结果。求助:
Tah-StutterBrot {
;
;This is a version of mandelbrot that
;switches the values of C and Z every
;few (default:501) iterations.
;
init:
c = #pixel
z = @start
float f = @restart
loop:
f = f - 1
IF (f <= 0)
f = @restart
oldC = c
c = z*@sign
z = oldC
ENDIF
z = z^@power + c
bailout:
|z| <= @bailout
default:
title = "StutterBrot"
helpfile = "dmj-pub\dmj-pub-uf-stutter.htm"
center = (0,0)
periodicity = 0
maxiter = 1000
param start
caption = "Start Value"
default = (0,0)
hint = "Starting value for each point. You can use this to \
'perturb' the fractal."
endparam
param power
caption = "Exponent"
default = (2,0)
hint = "The exponent, dummy"
endparam
param bailout
caption = "Bailout"
default = 1e20
hint = "Bailout value; larger values will cause more \
iterations to be done for each point."
endparam
param restart
caption = "Restart Interval"
default = 501.0
min = 1e-10
hint = "Specifies the number of iterations before c is reset."
endparam
param sign
caption = "Sign"
default = -1.0
hint = "Specifies the sign of the new C."
endparam
switch:
type = "Tah-StutterJulia"
seed = #pixel
start = start
restart = restart
power = power
sign = sign
bailout = bailout
}
同一系列的另一个也挺有趣的:
Tah-MandelJulia {
;
;Hey, looky here! It averages the point in the
;mandelbot set with that of the julia seed!
;Sorry, this it's own switch.
;
init:
cj = @seed
zj = #pixel
cm = #pixel
zm = @start
loop:
zj = zj^@power + cj
zm = zm^@power + cm
z = (zm + zj)/2
bailout:
|z| <= @bailout
default:
title = "MandelJulia"
param power
caption = "Power"
default = (2,0)
hint = "The Exponent, stupid."
endparam
param seed
Caption = "Seed"
Default = (.26,.0016)
Hint = "The Julia-type seed."
endparam
param restart
caption = "Restart Interval"
default = 1.0
min = 1e-10
hint = "Specifies the number of iterations before c is reset."
endparam
param start
caption = "Start Value"
default = (0,0)
hint = "Mess it up."
endparam
param bailout
caption = "Bailout value"
default = 4.0
min = 1.0
hint = "Contain yourself!"
endparam
}
这个比较容易做。
给M集纹身:
这段代码,可能我在理解时有误,结果造出的图与帖图距离大。问问榕坚兄,当f<=0时,迭代公式为那般?IF后的z是指初始值z还是f>0时迭代的终值?这问题困扰着我,如果这问题解决,这个分形不成为问题。
loop:
f = f - 1
IF (f <= 0)
f = @restart
oldC = c
c = z*@sign
z = oldC
ENDIF
z = z^@power + c
bailout:
|z| <= @bailout作者: 榕坚 时间: 2010-9-28 16:33
谁能把这段英文给翻译一下(关于UF中whitesq逻辑变量的定义):This predefined symbol returns true if the x-coordinate and the y-coordinate of the pixel being calculated give an odd number when added together; otherwise, it returns false. If you think of the screen as a large checkerboard with white and black squares with the size of a single pixel, #whitesq returns true for every white pixel.
从字面上看:象素点的坐标奇、偶数是怎么定义的呢?作者: 柳烟 时间: 2010-10-9 19:16
这个UF分形,我以失败告终。
Carr2004 {
; Updated for UF2 by Erik Reckase, March 2000
; Modified Sylvie Gallet frm. [101324,3444], 1996
init:
z=c=pixel, z1=imag(p1-cos(2*(pixel)))*z-p2
int iter=0, int limit=round(real(p1)), float bailout=16
loop:
IF (iter==limit)
z = z1, c = p3
ENDIF
z=z*z+c
iter=iter+1
bailout:
|z| <= bailout
default:
title = "Carr 2004"
periodicity = 0
maxiter = 500
magn = 1.3
center = (-.4,0)
method = multipass
param p1
caption = "Iter Lim/Julia Scale"
default = (50,1)
hint = "The real part of this parameter acts as an \
iteration limit, where the formula's calculation \
changes. The imaginary part of this parameter \
scales the Julia structure."
endparam
param p2
caption = "Julia Center"
default = (-0.3,0)
endparam
param p3
caption = "Julia Params"
default = (-0.65,-0.4)
endparam
}
此分形位于carr2000.ufm中