选自叶瑞松论文:《复动力系统生成的拟3D图象》
该论文地址:http://115.com/file/e76qbelp#
用几何画板如何按:z=z^2-0.5*z+0.563,w=z=z^2-0.5*v+0.563,v=z,w=z.我刚才用几何画板白干一场。
我试着用UF做,结果好象正确。UF代码是:
叶瑞松J {
;
; Generic Julia set.
;
init:
z = #pixel
loop:
z = z^@power -0.5*z+@seed
w= z^@power -0.5*v+@seed
v=z
z=w
bailout:
|z| <= @bailout
default:
title = "叶瑞松范例J"
helpfile = "Uf*.chm"
helptopic = "Html\formulas\standard\julia.html"
$IFDEF VER50
rating = recommended
$ENDIF
param seed
caption = "Julia seed"
default = (0.563, 0)
hint = "Use this parameter to create many different Julia sets. A good \
way to set this parameter is with the Switch, Eyedropper, or \
Explore features."
endparam
param power
caption = "Power"
default = (2,0)
hint = "This parameter sets the exponent for the Julia formula. \
Increasing the real part to 3, 4, and so on, will multiply the \
symmetry of the Julia figure. Non-integer real values and non-zero \
imaginary values will create distorted Julia fractals. Use (2, 0) \
for the standard Julia set."
endparam
param bailout
caption = "Bailout value"
default = 128.0
min = 1.0
$IFDEF VER40
exponential = true
$ENDIF
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
switch:
type = "J233"
power = power
bailout = bailout
}作者: 柳烟 时间: 2012-5-3 18:39
UF中的KochCurve代码,内含三个开关项,代码太长,解读困难,为降低难度,我将其代码精简为只整一个开关项,此精简后的代码在UF中运行后无误,我今晚试做了一下,结果不成功,扫出的图怪得很,大家帮忙看看,能否作成。榕坚兄有空时,看看,如何用GSP实现。
KochCurve {
init:
z = #pixel
x = real(z)
y = imag(z)
sq3 = sqrt(3)
i = 0
loop:
i = i + 1
if i == 2
arg = atan2(z)
if (y + 1/sq3 > 0) && (sq3*x - y + 2/sq3 > 0) \
&& (sq3*x + y - 2/sq3 < 0)
bail = true
endif
if (-y + 1/sq3 > 0) && (sq3*x + y + 2/sq3 > 0) \
&& (sq3*x - y - 2/sq3 < 0)
bail = true
endif
if (arg > 5/6*pi) || (arg < -pi/2)
z = z*exp(1i*4/3*pi)
endif
if (arg < pi/6) && (arg > -pi/2)
z = z*exp(1i*2/3*pi)
endif
z = z - 1i*1/sq3
elseif i > 2
z = 3*z
x = real(z)
y = imag(z)
if (y > 0) && (sq3*x - y + sq3 > 0) \
&& (sq3*x + y - sq3 < 0)
bail2 = true
endif
z = z/3
x = real(z)
y = imag(z)
if x < -1/3
z = 3*z + 2
elseif x > 1/3
z = 3*z - 2
else
if x < 0
z = z + 1/3
z = z*exp(-1i*pi/3)
z = 3*z - 1
else
z = z - 1/3
z = z*exp(1i*pi/3)
z = 3*z + 1
endif
endif
endif
bailout:
bail == false && bail2 == false
default:
title = "Koch Curve1"
helpfile = "sam-help/kochcurves.htm"
helptopic = "kcurve"
magn = 1.5
center = (0.0002,0)
maxiter = 50
}作者: 柳烟 时间: 2012-6-14 01:48
将前面的KochCurve曲线代码,删除了一段没用的代码,再浓缩成下面的代码:
KochCurve {
init:
z = #pixel
x = real(z)
y = imag(z)
sq3 = sqrt(3)
bail = false
bail2 =false
i = 1
loop:
i = i + 1
if i == 2
arg = atan2(z)
if (-y + 1/sq3 > 0) && (sq3*x + y + 2/sq3 > 0) \
&& (sq3*x - y - 2/sq3 < 0)
bail = true
endif
if (arg > 5/6*pi) || (arg < -pi/2)
z = z*exp(1i*4/3*pi)
endif
if (arg < pi/6) && (arg > -pi/2)
z = z*exp(1i*2/3*pi)
endif
z = z - 1i*1/sq3
elseif i > 2
z = 3*z
x = real(z)
y = imag(z)
if (y > 0) && (sq3*x - y + sq3 > 0) \
&& (sq3*x + y - sq3 < 0)
bail2 = true
endif
z = z/3
x = real(z)
if x < -1/3
z = 3*z + 2
elseif x > 1/3
z = 3*z - 2
else
if x < 0
z = z + 1/3
z = z*exp(-1i*pi/3)
z = 3*z - 1
elseif x> 0
z = z - 1/3
z = z*exp(1i*pi/3)
z = 3*z + 1
endif
endif
endif
bailout:
bail == false && bail2 == false
default:
title = "Koch Curve1"
helpfile = "sam-help/kochcurves.htm"
helptopic = "kcurve"
magn = 1.5
center = (0.0002,0)
maxiter = 50
}
作了几次,每次都不一样,查起来费劲,每干一次,扫出的图均不一样,怪。不过,倒是取得了进展,扫出的图有些地方可看到局部的科赫曲线影子。不知是不是我解读上面的代码,有误。
if x < -1/3
z = 3*z + 2
elseif x > 1/3
z = 3*z - 2
else
if x < 0
z = z + 1/3
z = z*exp(-1i*pi/3)
z = 3*z - 1
elseif x> 0
z = z - 1/3
z = z*exp(1i*pi/3)
z = 3*z + 1
这段代码,理解起来有些费劲,可能我的解读有偏差。作者: 柳烟 时间: 2012-6-17 23:51
UF中科赫雪花的第二个开关项抽出后的代码如下:
KochCurve {
init:
z = #pixel
x = real(z)
y = imag(z)
sq3 = sqrt(3)
bool bail2 = false
bool bail = false
i = 0
loop:
i = i + 1
if i == 2
arg = atan2(z)
if |x| > 1 || x/sq3 + y - 2*sq3/3 > 0 \
|| x/sq3 + y + 2*sq3/3 < 0 || x/sq3 \
- y + 2*sq3/3 < 0 || x/sq3 - y - \
2*sq3/3 > 0
bail = true
endif
if (abs(arg) < pi/6)
z = z*exp(-1i*pi/2)
elseif (arg > pi/6) && (arg < pi/2)
z = z*exp(-1i*5*pi/6)
elseif (arg > pi/2) && (arg < 5*pi/6)
z = z*exp(1i*5*pi/6)
elseif (abs(arg) > 5*pi/6)
z = z*exp(1i*pi/2)
elseif (arg < -pi/6) && (arg > -pi/2)
z = z*exp(-1i*pi/6)
elseif (arg < -pi/2) && (arg > -5*pi/6)
z = z*exp(1i*pi/6)
endif
z = z + 1i
z = sq3*z
elseif i > 2
z = 3*z
x = real(z)
y = imag(z)
if (y > 0) && (sq3*x - y + sq3 > 0) \
&& (sq3*x + y - sq3 < 0)
bail2 = true
endif
z = z/3
x = real(z)
y = imag(z)
if x < -1/3
z = 3*z + 2
elseif x > 1/3
z = 3*z - 2
elseif (x < 0)&&(x>-1/3)
z = z + 1/3
z = z*exp(-1i*pi/3)
z = 3*z - 1
elseif (x > 0)&&(x<1/3)
z = z - 1/3
z = z*exp(1i*pi/3)
z = 3*z + 1
endif
endif
bailout:
bail == false && bail2 == false
default:
title = "Koch Curve"
helpfile = "sam-help/kochcurves.htm"
helptopic = "kcurve"
magn = 1.5
center = (0.0002,0)
maxiter = 50
juliatrap(BOTH) {
; By Samuel Monnier, 1999
init:
bool first = true
count = 0
float stdz = 0.0
start = @seed
loop:
trz = exp(flip(-pi/180*@rot))*(#z-@center)/@size
x = 1/sqrt(@r)*real(trz)
y = sqrt(@r)*imag(trz)
if @freq != 0
x = 2*sin(2*pi*@freq*x)
y = 2*sin(2*pi*@freq*y)
endif
trz = x + flip(y)
zz = trz
float i = 0
iter = @niter
float dz = 0.0
start = zz
zz = @seed
while i < @niter
i = i + 1
zz = zz^2 + start
if |zz| > 1e20
iter = i
i = @niter
endif
修改了那段费解代码,按下面代码作,在UF中对照了一下,好象与UF中的效果一致。
juliatrap1(BOTH) {
; By Samuel Monnier, 1999
init:
float dz = 0.0
float stdz = 0.0
start = @seed
loop:
trz = exp(flip(-pi/180*@rot))*(#z-@center)/@size
x = 1/sqrt(@r)*real(trz)
y = sqrt(@r)*imag(trz)
if @freq != 0
x = 2*sin(2*pi*@freq*x)
y = 2*sin(2*pi*@freq*y)
endif
start = x + flip(y)
iter = @niter
zz = @seed
float i = 0
while i < @niter
i = i + 1
zz = zz^2 + start
if |zz| > 1e20
iter = i
i = @niter
endif