朱莉娅·塞特简介 在复杂动力学这一数学主题中,Julia集和Fatou集是从函数定义的两个互补集(Julia“laces”和Fatou“dusts”)。非正式地说,函数的Fatou集由一些值组成,这些值的性质是,在函数的重复迭代下,所有附近的值都表现出类似的行为,Julia集由一些值组成,这些值使得任意小的扰动都可以导致迭代函数值序列中的剧烈变化。因此,函数在Fatou集上的行为是“正则的”,而在Julia集上的行为是“混沌的”。 函数f的Julia集通常表示为J(f),Fatou集通常表示为f(f)。这些集合是以法国数学家加斯顿·朱莉娅和皮埃尔·法图的名字命名的,他们的工作在20世纪初开始研究复杂动力学。[来源] 维基 ]
生成Julia分形的方程式为:
其中c是一个复杂的参数。该系统的Julia集是复平面的子集,由下式给出:
现在我们试着在上图中创建一个分形。
要做到这一点,我们需要 枕头 python的模块,使处理图像和其他内容变得容易。
要通过pip安装pillow,请在命令提示符下键入以下命令。
pip install Pillow
现在使用这个库来创建分形图像。
# Python code for Julia Fractal from PIL import Image # driver function if __name__ = = "__main__" : # setting the width, height and zoom # of the image to be created w, h, zoom = 1920 , 1080 , 1 # creating the new image in RGB mode bitmap = Image.new( "RGB" , (w, h), "white" ) # Allocating the storage for the image and # loading the pixel data. pix = bitmap.load() # setting up the variables according to # the equation to create the fractal cX, cY = - 0.7 , 0.27015 moveX, moveY = 0.0 , 0.0 maxIter = 255 for x in range (w): for y in range (h): zx = 1.5 * (x - w / 2 ) / ( 0.5 * zoom * w) + moveX zy = 1.0 * (y - h / 2 ) / ( 0.5 * zoom * h) + moveY i = maxIter while zx * zx + zy * zy < 4 and i > 1 : tmp = zx * zx - zy * zy + cX zy,zx = 2.0 * zx * zy + cY, tmp i - = 1 # convert byte to RGB (3 bytes), kinda # magic to get nice colors pix[x,y] = (i << 21 ) + (i << 10 ) + i * 8 # to display the created fractal bitmap.show() |
输出:
也请参考以下视频: 数字档案 了解更多信息。
理解代码后,尝试通过更改变量的值来绘制其他分形图,并在注释部分将您的github链接发布到代码,如果出现任何错误,我将很乐意帮助您。
本文由 Subhajit Saha .如果你喜欢GeekSforgek,并想贡献自己的力量,你也可以使用 贡献极客。组织 或者把你的文章寄到contribute@geeksforgeeks.org.看到你的文章出现在Geeksforgeks主页上,并帮助其他极客。
如果您发现任何不正确的地方,或者您想分享有关上述主题的更多信息,请写下评论。