返回列表 回复 发帖
这个结果很有诱惑力,可是没办法完成:
pgd_Twofold2_Julia {
  ; Two-fold rotational symmetry and complementary critical
  ; point fates make for some very intertwining (and
  ; entertaining) Julia sets.
  ; f(z) = (z^2 - 1/3)/cz^3
global:
  bool foundatt1 = false
  bool foundatt2 = true
  complex att1 = 1
  complex att2 = -1
  float b = 1/@bailout
  int j = 0
  ; Locate attractor 1 goes to, if any.
  WHILE (j < #maxit)
    att1 = (sqr(att1) - 1/3)/(@seed * sqr(att1) * att1)
    j = j + 1
  ENDWHILE
  ; Is it really an attractor? Or did it just wander off
  ; and die somewhere? Is the attractor self-complementary
  ; or is there a distinct mirror attractor?
  j = 0
  complex a = att1
  WHILE (j < #maxit)
    att1 = (sqr(att1) - 1/3)/(@seed * sqr(att1) * att1)
    IF (|att1 - a| < b)
      foundatt1 = true      ; it repeated, yay!
    ENDIF
    att2 = (sqr(att2) - 1/3)/(@seed * sqr(att2) * att2)
    IF (|att2 - a| < b)
      foundatt2 = false      ; other cp went to same.
    ENDIF
    j = j + 1
  ENDWHILE
init:
  z = #pixel
  bool notdone = true
  bool landedright = false
  IF ((@what == 1) && (!foundatt1))
    notdone = false
  ENDIF
  IF ((@what == 2) && (!foundatt2))
    notdone = false
  ENDIF
  i = 0
loop:
  z = (sqr(z) - 1/3)/(@seed * sqr(z) * z)
  IF (|z| > @bailout)
    notdone = false
    landedright = (@what == 0)
  ENDIF
  IF (foundatt1)
    IF (|z - att1| < b)
      notdone = false
      landedright = (@what == 1)
    ENDIF
  ENDIF
  IF (foundatt2)
    IF (|z - att2| < b)
      notdone = false
      landedright = (@what == 2)
    ENDIF
  ENDIF
  IF (i == #maxit)
    IF (@what != 3)
      notdone = false
      landedright = false
    ENDIF
  ENDIF
  i = i + 1
  IF (!notdone)
    IF (!landedright)
      z = (501,10)  ; Tell Smooth (Generalized) 2 to color this thing solid.
    ENDIF
  ENDIF
bailout:
  notdone
default:
  title = "Twofold2 Julia"
  periodicity = 0
  maxiter = 1000
  method = onepass
  magn = 0.5
  param seed
    caption = "Julia seed"
    default = (0.75, 0)
  endparam
  param what
    caption = "Draw what"
    enum = "Main basin" "Other attractor #1" "Other attractor #2" "Trapped points"
    default = 0
  endparam
  param bailout
    caption = "Bailout"
    hint = "Escape radius (inverse is used for finite attractors)"
    default = 100000.0
    min = 0
  endparam
switch:
  type = "pgd_Twofold2_Mandel"
  bailout = bailout
}

Fractal1.jpg (52.69 KB)

Fractal1.jpg

这个应该就是分形边界的一种构造方法,把内、外部都挖空了,要通过多次迭代才能完成。
实在挡不住诱惑,虽然伤了很多脑细胞但算是有成果:

pgd_Twofold2_Julia.JPG (39.51 KB)

pgd_Twofold2_Julia.JPG

7# 柳烟


在对Z迭代之前先进行两次迭代获得一些准备数值,其它的就是按照代码依样画葫芦了。另一个它的“M"集那真是没办法了(其中有数组变量不知怎么转为几何画板能完成的),分开结构非常漂亮:
pgd_Twofold2_Mandel {
  ; Two-fold rotational symmetry and complementary critical
  ; point fates make for some very intertwining (and
  ; entertaining) Julia sets.
  ; f(z) = (z^2 - 1/3)/cz^3
init:
  z = 1
  bool notdone = true
  bool landedright = false
  int i = 0
  int j = 0
  bool odd = false
  complex z_values[@zmax]
  float b = 1/@bailout
loop:
  z = (sqr(z) - 1/3)/(#pixel * sqr(z) * z)
  IF (|z| > @bailout)
    notdone = false
    landedright = (@what == 0)
  ENDIF
  z_values = z
  IF (odd)
    IF (|z - z_values[j]| < b)
      notdone = false
      complex w = -1
      j = 0
      bool sep = true
      WHILE ((j < #maxit) && sep)
        w = (sqr(w) - 1/3)/(#pixel * sqr(w) * w)
        IF (|w - z| < b)
          sep = false
        ENDIF
        j = j + 1
      ENDWHILE
      IF (sep)
        landedright = (@what == 2)
      ELSE
        landedright = (@what == 1)
      ENDIF
    ENDIF
    j = j + 1
  ENDIF
  odd = !odd
  i = i + 1
  IF (i == @zmax)
    IF (@what != 3)
      notdone = false
      landedright = false
    ENDIF
  ENDIF
  IF (!notdone)
    IF (!landedright)
      z = (501,10)  ; Tell Smooth (Generalized) 2 to color this thing solid.
    ENDIF
  ENDIF
bailout:
  notdone
default:
  title = "Twofold2 Mandelbrot"
  periodicity = 0
  maxiter = 1000
  method = onepass
  param what
    caption = "Draw what"
    enum = "Main basin" "One finite attractor" "Two attractors" "Trapped points"
    default = 0
  endparam
  param zmax
    caption = "Max iters to record"
    default = 1000
  endparam
  param bailout
    caption = "Bailout"
    hint = "Escape radius (inverse is used for finite attractors)"
    default = 100000.0
    min = 0
  endparam
switch:
  type = "pgd_Twofold2_Julia"
  seed = #pixel
  bailout = bailout
}

捕获.JPG (94.01 KB)

捕获.JPG

10# 柳烟


做这个可是要有十足的耐心和充裕的时间哪。之前做过任意三角形的谢氏三角形,但不是UF的算法。等有空的时间再来试试。这种代码应该是可以用几何画板演绎的。
10# 柳烟


好象是有影响的,这是用函数ln(x)的结果:

捕获.JPG (38.78 KB)

捕获.JPG

15# 柳烟


面板中的开关项,值为0或1.
其实起作用的是:
IF ((imag(z1)>=.575*real(z1)) && (-.575*real(z1)<=imag(z1)))
    z1 = 2*z1-1i
  ELSEIF (real(z1)<=0)
    z1 = 2*z1+(.8660254, 0.5)
  ELSE
    z1 = 2*z1+(-.8660254, 0.5)
ENDIF
从代码看不会执行:Z1=2*Z1 ,我就把它删了。
if1:0.5*(1+sgn(sgn(modZ-@bailout)-0.5))
if2: @everyiter
if3:1-abs(sgn(done-(n+2)))
IF=sgn(if1+if2+if3)
n为迭代次数,@everyiter的值预先赋以0或1。
21# 柳烟


已经帮你改好了,顺便扫描一图:

捕获.JPG (32.73 KB)

捕获.JPG

谢氏三角形尝试.gsp (45.41 KB)

返回列表