分形介紹
分形是一個(gè)悖論。
它驚人的簡(jiǎn)單,卻又無限的復(fù)雜。
它很新,卻又比塵埃更古老。
分形是什么?它們是從哪里來的?我們?yōu)槭裁匆诤酰?/p>
20世紀(jì)非傳統(tǒng)的數(shù)學(xué)家Benoit Mandelbrot在1975年從拉丁詞fractus(意思是不規(guī)則的或破碎的)創(chuàng)造了分形這個(gè)詞。
我們周圍到處都可以看到分形的影子。
從最基本的角度看,分形是重復(fù)模式或公式的視覺表達(dá),開始時(shí)很簡(jiǎn)單,然后逐漸變得更復(fù)雜。
在數(shù)學(xué)中,分形是歐氏空間的子集,其分形維數(shù)嚴(yán)格超過其拓?fù)渚S數(shù)。
分形在不同的尺度上表現(xiàn)相同,如Mandelbrot集合的連續(xù)放大。
分形通常在越來越小的尺度上表現(xiàn)出類似的模式,這種特性稱為自相似性,也稱為擴(kuò)展對(duì)稱或展開對(duì)稱。
如果這種復(fù)制在每個(gè)尺度上都完全相同,就像在門格爾海綿中一樣,那么它就被稱為仿射自相似。
分形幾何屬于度量理論的數(shù)學(xué)分支。
分形結(jié)果


分形源碼
#?coding:?utf-8
import?turtle
import?math
import?random
import?time
import?colorsys
window?=?turtle.Screen()
window.screensize()
window.setup(width=1.0,?height=1.0,?startx=None,?starty=None)
turtle.speed(0)
turtle.hideturtle()
#turtle.tracer(0)
turtle.bgcolor('black')
def?draw_square(x,y,direction,length,c):
????turtle.color(c)
????turtle.up()
????turtle.goto(x,y)
????turtle.seth(direction)
????turtle.back(length/2)
????turtle.left(90)
????turtle.back(length/2)
????turtle.seth(direction)
????turtle.down()
????turtle.fillcolor(c)
????turtle.begin_fill()
????for?_?in?range(4):
????????turtle.fd(length)
????????turtle.left(90)
????turtle.end_fill()
colors?=?["white",?"black"]
#colors?=?["lawngreen",?"red"]
index?=?1
def?square_spiral(x,y,direction,length):
????if?length?<?5:?return
????global?index
????draw_square(x,y,direction,length,?colors[1-index])
????index?=?1-index
????square_spiral(x,y,direction+alpha,length/(math.sin(math.radians(alpha))?+?math.cos(math.radians(alpha))))
time.sleep(6)
alpha=5
square_spiral(0,0,0,800)


黑白方形螺旋 #分形 #解壓 #python
視頻號(hào)

彩色方形螺旋 #分形 #解壓 #python
視頻號(hào)


本文使用 文章同步助手 同步