返回列表 回复 发帖
N_sin_M {
; newton's method applied to f(z) = sin(z) - c
; Q(z) = z - f(z)/f'(z) = z - ((sin(z)-c)/cos(z))

global:
   
init:
  z = 0
  complex delta_z = 0
  complex c = #pixel
  bool continue = true
  
loop:
  delta_z = ( sin(z) - c ) / cos(z)
  
  if |delta_z| < @delta
    continue = false
    if @zmode=="step"
        z = delta_z
    endif ; zmode
  else
    z = z - delta_z
  endif ; < @delta
  
bailout:
; -- this isn't the bailout but the continuing condition
;    false = bail; true = continue
  continue
  
default:
  title = "Newton-M, sin(z)-c" ; [v1.0]
  magn = 0.25
  periodicity = 0
  
  heading
    caption = "Bailout"
  endheading
  float param delta
    caption="Bailout delta"
    hint="Square of max step. Use small values."
    default=1e-8
    min=0
  endparam
  param zmode
    caption = "final z"
    enum = "z" "step"
    default = 1
  endparam
  
switch:
  type = "N_sin_J"
  cv = #pixel
  delta = delta
  zmode = zmode
  
}
大家自已仿照前面的解读UF程序,自已解读。我看了面板,面板上的开关项有两个,一个是z,一个是step我点了这两个开关项看了看,发现完全一样,至少我没看出区别,所以就按牛M集造。而上楼的则是牛J集,牛J集是对z着色,而牛M集则是对c着色。造的过程大体一样。 if |delta_z| < @delta
    continue = false
    if @zmode=="step"
        z = delta_z
    endif ; zmode
  else
这段代码我没考虑,直接计算出 z = z - delta_z然后进行迭代。
N_sin_M(UF)的视频:
http://u.115.com/file/f63b39515f#
N_sin_M.gsp (22.97 KB)
扫一图:
未命名(5).jpg
19# 柳烟


将三个开关项整在一起了:

未命名1.gsp (22.93 KB)

25# 榕坚
刚从外地归来,问好榕兄,新春快乐。下载文件,学习研究。
25# 榕坚
榕坚兄的原文件中,计算的每一步几乎都按UF程序进行,且算式清晰明了,大家结合UF程序并对照原文件中的每一步,很容易作出。故而视频文件不再制作,大家尝试自已完成。
bobm000.ufm中。
Bob28 {
; Bob Margolis
init:      
  z=c=fn1(1/(pixel*pixel))
fn1代表不同的复函数,你从UF面板上的函数开关处,选取不同的函数,就得到不同的复分形。在其它的UF程序中, 除fn1外,还有fn2、fn3,均是面板上的函数开关。从面板上看,有近二十多个函数
loop:
  z=z*z+c
bailout:  
  |z| <= 4
按精典M集造,迭代得出et、em后,着色前,将z、与点c定位在: fn1(1/(pixel*pixel))即可。
}
整了11个带函数开关的分形。上楼文件的制作视频如下:
http://u.115.com/file/f6d05c7226#
Bob28.gsp (37.36 KB)
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
}
返回列表