Mandelbrot集的最新变化形态一览——MandelBox,Mandelbulb,Burning Ship,NebulaBrot

二维Mandelbrot——Burning Ship

采用以下迭代公式

(x4-6*x2*y2+y4,4*|x|3*|y|-4*|y|3*|x|)

看不懂的,可以去学习深造了。。。

 

Mandelbulb

这个3D的Mandelbrot集采用的是以下公式,这应该算是超复数的一种,人称“triplex”,三元复数

 

数学上的N次方

其中:

一般情况下,n取8。

简单说来,三元复数的平方的计算机表示为

xx = (x*x+y*y) * (1-z*z/(x*x+y*y));

yy = 2*x*y * (1-z*z/(x*x+y*y));

zz = -2*z*sqrt(x*x+y*y);

详情请参见http://en.wikipedia.org/wiki/Mandelbulb

以下内容摘自http://www.skytopia.com/project/fractal/2mandelbulb.html

{x,y,z}^n = r^n { sin(theta*n) * cos(phi*n) ,sin(theta*n) * sin(phi*n) , cos(theta*n) }
...where:
r = sqrt(x^2 + y^2 + z^2)
theta = atan2( sqrt(x^2+y^2), z )
phi = atan2(y,x)

And the addition term in z -> z^n + c is similar tostandard complex addition, and is simply defined by:

{x,y,z}+{a,b,c} = {x+a, y+b, z+c}

The rest of the algorithm is similar to the 2D Mandelbrot!

Here is some pseudo code of the above:

r = sqrt(x*x + y*y + z*z )
theta = atan2(sqrt(x*x + y*y) , z)
phi = atan2(y,x)

newx = r^n * sin(theta*n) * cos(phi*n)
newy = r^n * sin(theta*n) * sin(phi*n)
newz = r^n * cos(theta*n)

...where n is the order of the 3D Mandelbulb. Use n=8to find the exact object in this article.


 

上图是16阶的MandelbrotBulb

 

放大之后的某部分

 

 

n=8时候的图形

 

 

迭代次数取100时候的情形

金色大峡谷

 


神秘洞穴




魔法球花甘蓝




“Mandelbrot花园



八阶的MandelBulb




圣诞节珊瑚球




冰激凌~~



贝壳~~




冰封地狱

 

 

 

 

 

 

 

 

 

 

 

3DMandelbrot——Mandelbox

一个很奇妙的视频演示。“飞越曼德布罗盒子”

http://wimp.com/mandelboxflythrough/

具体算法核心代码:

for (each axis)

  if (v[axis]>1) v[axis] =2-v[axis];

  else if (v[axis]<-1) v[axis] =-2-v[axis];

if (v.magnitude() < 0.5) v *= 4;

else if (v.magnitude() < 1) v /= square(v.magnitude());

v = scale*v + c;

 

 

 

 

详情参见“超复数分形”

http://www.bugman123.com/Hypercomplex/index.html

 

n = 100; norm[x_] := x.x;

TriplexPow[{x_, y_, z_}, n_] := If[x == y == 0.0, 0.0, Module[{r =Sqrt[x^2 + y^2 + z^2], theta = n ArcTan[x, y], phi}, phi = n ArcSin[z/r];

r^n{Cos[theta]Cos[phi], Sin[theta]Cos[phi], -Sin[phi]}]];
Mandelbulb[c_] := Module[{p = {0, 0, 0}, i = 0}, While[i < 24 &&norm[p] < 4, p = TriplexPow[p, 8] + c; i++]; i];
image = Table[z = 1.1; While[z >= -0.1 && Mandelbulb[{x, y, z}] <24, z -= 2.2/n];

z, {y, -1.1, 1.1, 2.2/n}, {x, -1.1, 1.1, 2.2/n}];
ListDensityPlot[image, Mesh -> False, Frame -> False, PlotRange ->{-0.1, 1.1}]

 

 

上图是Lambdabulb

 

上图所用迭代公式:{x,y,z}2 = {x2-y2-z2,2xy, -2xz}

 

 

上图是四元数Mandelbrot集,所用迭代公式:{x,y,z,w}2= {x2-y2-z2-w2, 2xy, 2xz, 2xw}

 

 

上图名叫Glynn Julia set

 

 

 

上面两幅图是4D Bicomplex Mandelbrot("Tetrabrot")

所用迭代公式:{x,y,z,w}2 = {x2-y2-z2+w2,2(xy-zw), 2(xz-yw), 2(xw+yz)}

 

  

上面三幅图叫做NebulaBrot,是BuddhaBrot的三维形式

这些图均由20亿个点进行计算渲染而成

 

 

上图叫做3DChristmas Tree Mandelbrot Set,使用的迭代公式:

{x,y,z}n = rn{cos(θ)cos(φ),sin(θ)cos(φ), sin(φ)}
r=sqrt(x2+y2+z2), θ=n atan2(y,x), φ=natan2(z,x)

 

 

 

{x,y,z}n = rn{cos(θ)cos(φ),sin(θ)cos(φ), cos(θ)sin(φ)}
r=sqrt(x2+y2+z2), θ=n atan2(y,x), φ=n sin-1(z/r)

 

 

 

 

 

上图叫做"Roundy" Mandelbrot Set 。迭代公式:

{x,y,z,w}2 = {x2-y2-z2-w2,2(xy+zw), 2(xz+yw), 2(xw+yz)}

 

 

上图是Bristorbrot Set

所用迭代公式:{x,y,z}2 = {x2-y2-z2,y(2x-z),z(2x+y)}


上图所用迭代公式:{x,y,z}2 = {x2-y2-z2,2xy, 2(x-y)z}

作者DavidMakin

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Mandelbrot合是一个非常有趣的数学图形,可以使用多线程来实现它的绘制。下面是一个使用Python的多线程实现Mandelbrot合的示例代码: ```python import threading import numpy as np import matplotlib.pyplot as plt def mandelbrot(xmin, xmax, ymin, ymax, width, height, max_iter): x = np.linspace(xmin, xmax, width).reshape(1, width) y = np.linspace(ymin, ymax, height).reshape(height, 1) c = x + y * 1j z = np.zeros_like(c) for i in range(max_iter): z = z**2 + c mandelbrot_set = (abs(z) < 2) return mandelbrot_set def mandelbrot_thread(xmin, xmax, ymin, ymax, width, height, max_iter, row, result): for i in range(row[0], row[1]): result[i] = mandelbrot(xmin, xmax, ymin, ymax, width, 1, max_iter)[0] def mandelbrot_multithread(xmin, xmax, ymin, ymax, width, height, max_iter, num_threads=4): rows = np.array_split(range(height), num_threads) result = [None] * height threads = [] for i in range(num_threads): t = threading.Thread(target=mandelbrot_thread, args=(xmin, xmax, ymin, ymax, width, height, max_iter, rows[i], result)) threads.append(t) t.start() for t in threads: t.join() mandelbrot_set = np.vstack(result) return mandelbrot_set if __name__ == '__main__': xmin, xmax, ymin, ymax = -2, 1, -1.5, 1.5 width, height = 800, 600 max_iter = 100 mandelbrot_set = mandelbrot_multithread(xmin, xmax, ymin, ymax, width, height, max_iter) plt.imshow(mandelbrot_set, cmap='hot', extent=[xmin, xmax, ymin, ymax]) plt.show() ``` 这个示例代码使用了numpy和matplotlib库。首先,我们定义了一个单线程的函数mandelbrot,它接受Mandelbrot合的参数,计算出每个点是否属于Mandelbrot合,并返回一个布尔类型的数组。 然后,我们定义了一个多线程的函数mandelbrot_multithread。它将要绘制的图形划分成多行,每行分配给一个线程。每个线程计算它分配到的行的Mandelbrot合,并将结果储存在一个列表中。 最后,我们使用numpy的vstack函数将每个线程计算的结果合并成一个二维数组,并使用matplotlib将其绘制出来。 注意,由于多线程的计算可能会导致不同线程之间的计算顺序不确定,因此绘制出来的图形可能会有一些小的变化。但这不会影响图形的正确性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值