返回列表 回复 发帖

分形这玩意儿

自从到这个论坛以来,看着这个论坛中的分形板块的发展,着实没想到,刚开始在这里谈分形时,大家都抢着往前跑,跑了一阵之后,现在都回到最初的出发点,开始研究最基本的分形,不可谓学习习惯之中的种种都在这里显现。这是个好现象。结果发现没有急于往前跑的最后反而跑到了前面,后来者踞上!
21.GIF
10.GIF
12.GIF
13.GIF
如果最初要不是急于前行,把这些最基本的基础的东西玩好了,也许现在早已走到另一个世界里了
!现在沉下来还为时不晚。
回顾我在粗论分形一帖中就发现有这种现象,就是当我们对画板分形有一定的认识各自开始了自己的分形之旅时,就能体会到用画板作分形的不易,有些板友开始有所保留,正常也可以理解。但很多时候人就是那么一种陋习,保守。现在大家都说要开诚布公,我非常赞同这种观点,画板分形的开拓应该是一个系统性的工程,也是一个漫长的过程。是用纯数学的方法去演绎分形的原理。让所有懂数学的人都可以成为分形图形生成的技能拥有者和开拓者。提个想法,分形图形学中最精彩的部分莫过于复变分形那一部分,也就是从第三章开始的。我们就从头来用画板把那里的每一种作法的原理及画板的实现展示在这里,但我不知,对这个提议有多少人真正能投入和做到无私,有意的板友就请你跟帖。无意的板友就当你没有看见!
复分形的基础载体是复方程f(z)=z^2,而不是f(z)=z^2+c.如果刚开始就去探讨MJ集的数学原理,难度太大。也不利于后续的思考。f(z)=z^2之所以选其作为载体是由其图形更接近于我们平时经常接触到的圆。
M集的绘制程序:
The drawing procedure

  p = 0.009

  cri = (p/2)1/3

  r = 1.0E200 (square of the bail-out radius)

  u = log(log(r))

  v = 1/log(2) (2 is the degree of the rational function)

  ax = -0.7028233689263 (x-coordinate of lower left corner)

  ay = 0.1142331238418 (y-coordinate of lower left corner)

  h = 0.0092906805859 (width of the section)

  g = h/800

  m = 850 (maximum iteration number)

  thick = h * 0.0005 (thickness of the boundary)

  dens = 24.9 (density of the colours)

  disp = 432.0 (displacement of the colour scale)

for i = 0 to 799 do

  begin

    cx = ax + i * g (x-coordinate of pixel (i, j))

    for j = 0 to 599 do

      begin

        cy = ay + j * g (y-coordinate of pixel (i, j))

        x = cri

        y = 0

        xd = 0

        yd = 0

        f = 0

        n = 0

        while (n < m) and (f < r) do

          begin

            n = n + 1

            x1 = x * x - y * y

            y1 = 2 * x * y

            f = x * x + y * y

            x2 = 2 * x - p * x1 / (f * f)

            y2 = 2 * y + p * y1 / (f * f)

            temp = xd

            xd = x2 * xd - y2 * yd + 1

            yd = x2 * yd + y2 * temp

            fd = xd * xd + yd * yd

            x = x1 + p * x / f + cx

            y = y1 - p * y / f + cy

            f = x * x + y * y

          end

        if (n = m) or (log(f) * sqrt(f) < thick * sqrt(fd)) then

          setpixel(i, 599 - j, 0)

        else

          begin

            s = n - v * (log(log(f)) - u)

            n = round(dens * s + disp) mod 720

            col = paletteRGB(col1[n], col2[n], col3[n])

            setpixel(i, 599 - j, col)

          end

      end

  end
说明:
We have set c = cx + icy, z = x + iy, z' = xd + iyd and x1 + iy1 = (x + iy)2, and we have used that 1/z = z-/|z|2.

The successive calculation of the derivative z' is xd + iyd = (x2 + iy2)*(xd + iyd) + 1, where x2 + iy2 = 2*(x + iy) - p*(x1 - iy1)/(f*f) and f = x2 + y2. The next point in the iteration is x + iy = (x1 + iy1) + p*(x - iy)/f + (cx + icy). The distance function is

log(√f)*√f/√fd   (= log(f)*√f/(2*√fd))

for the last z-value, here f = x2 + y2 and fd = xd2 + yd2. The number in the interval [0, 1] to be subtracted from the iteration number (in order to get the real iteration number), is log(log(|z|)/log(r))/log(2) = v*(log(log(f)) - u), for the last z, here v = 1/log(2) and u = log(log(r)).

paletteRGB(r, g, b) is the integer indexing the colour with RGB-values (r, g, b), 0 gives black. col, col2 and col3 are the arrays from 0 to 719 of integers from 0 to 255 constructed in the next section.
返回列表