成都学网站建设,网站建设项目规划书案例,360营销平台,wordpress安装到空间简单产生复杂#xff0c;混沌孕育秩序
0. 引言
a. 分形 fractal
【也叫碎形】 分形是一种具有自相似性和复杂结构的几何图形。在分形结构中#xff0c;无论放大多少次#xff0c;局部的结构特征都与整体结构相似。这种特性在自然界中广泛存在#xff0c;比如树木枝干、山…简单产生复杂混沌孕育秩序
0. 引言
a. 分形 fractal
【也叫碎形】 分形是一种具有自相似性和复杂结构的几何图形。在分形结构中无论放大多少次局部的结构特征都与整体结构相似。这种特性在自然界中广泛存在比如树木枝干、山脉轮廓、云的形状等。
一些常见的分形 规则分形理想的数学模型自相似性是明显的。包括但不限于科赫曲线科赫雪花谢尔宾斯基三角形谢尔品斯基地毯康托尔集皮亚诺曲线等。 无规分形在物理学或自然界存在的分形自相似是近似的或统计的。包括但不限于雪花、海岸线、海绵、叶脉和毛细血管茱利亚集曼德尔布罗特集合等。
b. 混沌 chaos
混沌系统是指具有高度敏感性和不确定性的动态系统其行为在长期预测中极为复杂。混沌系统通常表现出对初始条件的敏感性蝴蝶效应即微小的变化可以导致完全不同的结果而且其行为往往看似随机但实际上是由确定的规则产生的。
一些常见的混沌系统 洛伦兹吸引子罗西尔系统Henon映射杜福尔系统物流映射摆的混沌干涉系统螺旋混沌等。
c. 分形与混沌
分形强调几何图形和自相似性的特性而混沌系统则侧重于动态行为和时间演化的性质。
分形具有缩放对称性在标度变换下仍具有分形整体上相似的复杂性和不规则性即无穷层次的自相似性在某些情况下分形可以是混沌系统的一种表现形式出现在其分析中但并非所有分形都是混沌系统。 有些分形例如洛伦兹吸引子曼德尔布罗特集合展示了混沌特性而其他一些分形例如康托尔集则缺乏动态的混沌行为。
d. 分维 D
零维的点、一维的线、二维的面、三维的立体、四维的时空然而空间维数也可以是分数不是整数。
分维fractional dimension D l o g M l o g n D\frac{logM}{logn} DlognlogM
图形由M个相等的部分组成其在先行尺度上是原图形的 1 n \frac{1}{n} n1 则 M × ( 1 n ) D 1 M×{(\frac{1}{n})}^D1 M×(n1)D1 .
比如
谢尔品斯基地毯 D l g 3 l g 2 ≈ 1.585 \begin{align} D \frac{lg3}{lg2} ≈ 1.585\\ \end{align} Dlg2lg3≈1.585
科赫曲线 D l g 4 l g 3 ≈ 1.262 \begin{align} D \frac{lg4}{lg3} ≈ 1.262\\ \end{align} Dlg3lg4≈1.262
二维扩散置限凝聚 D 1.66 ∼ 1.71 \begin{align} D 1.66 ∼ 1.71\\ \end{align} D1.66∼1.71
1. 常见的分形
a. 蕨菜叶分形 fern f ( x , y ) [ a b c d ] [ x y ] [ e f ] [ a x b y e c x d y f ] f(x,y) \left[ \begin{matrix} a b\\ c d\\ \end{matrix} \right] \left[ \begin{matrix} x\\ y\\ \end{matrix} \right]\left[ \begin{matrix} e\\ f\\ \end{matrix} \right] \left[ \begin{matrix} axbye\\ cxdyf\\ \end{matrix} \right] f(x,y)[acbd][xy][ef][axbyecxdyf] ω \omega ωabcdefp产生的部分ƒ10000.16000.01茎ƒ20.850.04−0.040.8501.600.84连续变小的小叶子ƒ30.20−0.260.230.2201.600.07最大的左侧叶ƒ4−0.150.280.260.2400.440.07最大的右侧叶
a-f 系数p 概率因子 所有变换的概率总和等于1以保证在随机选择时只有一项变换会被选中。
最知名的蕨菜叶分形是Barnsley Fern. Barnsley fern 茎 f 1 ( x , y ) [ 0 0 0 0.16 ] [ x y ] [ 0 0 ] [ 0 0.16 y ] f_1(x,y) \left[ \begin{matrix} 0 0\\ 0 0.16\\ \end{matrix} \right] \left[ \begin{matrix} x\\ y\\ \end{matrix} \right]\left[ \begin{matrix} 0\\ 0\\ \end{matrix} \right] \left[ \begin{matrix} 0\\ 0.16y\\ \end{matrix} \right] f1(x,y)[0000.16][xy][00][00.16y]
连续变小的小叶子: f 2 ( x , y ) [ 0.85 0.04 − 0.04 0.85 ] [ x y ] [ 0 1.6 ] [ 0.85 x 0.04 y − 0.04 x 0.85 y 1.6 ] f_2(x,y) \left[ \begin{matrix} 0.85 0.04\\ -0.04 0.85\\ \end{matrix} \right] \left[ \begin{matrix} x\\ y\\ \end{matrix} \right]\left[ \begin{matrix} 0\\ 1.6\\ \end{matrix} \right] \left[ \begin{matrix} 0.85 x 0.04y\\ -0.04x 0.85y 1.6\\ \end{matrix} \right] f2(x,y)[0.85−0.040.040.85][xy][01.6][0.85x0.04y−0.04x0.85y1.6]
最大的左侧叶: f 3 ( x , y ) [ 0.2 − 0.26 0.23 0.22 ] [ x y ] [ 0 1.6 ] [ 0.2 x − 0.26 y 0.23 x 0.22 y 1.6 ] f_3(x,y) \left[ \begin{matrix} 0.2 -0.26\\ 0.23 0.22\\ \end{matrix} \right] \left[ \begin{matrix} x\\ y\\ \end{matrix} \right]\left[ \begin{matrix} 0\\ 1.6\\ \end{matrix} \right] \left[ \begin{matrix} 0.2x - 0.26y\\ 0.23x 0.22y 1.6\\ \end{matrix} \right] f3(x,y)[0.20.23−0.260.22][xy][01.6][0.2x−0.26y0.23x0.22y1.6]
最大的右侧叶: f 4 ( x , y ) [ − 0.15 0.28 0.26 0.24 ] [ x y ] [ 0 0.44 ] [ − 0.15 x 0.28 y 0.26 x 0.24 y 0.44 ] f_4(x,y) \left[ \begin{matrix} -0.15 0.28\\ 0.26 0.24\\ \end{matrix} \right] \left[ \begin{matrix} x\\ y\\ \end{matrix} \right]\left[ \begin{matrix} 0\\ 0.44\\ \end{matrix} \right] \left[ \begin{matrix} -0.15x 0.28y\\ 0.26x 0.24y 0.44\\ \end{matrix} \right] f4(x,y)[−0.150.260.280.24][xy][00.44][−0.15x0.28y0.26x0.24y0.44]
通过这些参数可以创建不同的蕨类品种比如变化为Thelypteridaceae fern. Thelypteridaceae fern ω \omega ωabcdefp产生的部分ƒ10000.250-0.40.02茎ƒ20.950.005−0.0050.93-0.0020.50.84连续变小的小叶子ƒ30.035−0.20.160.04-0.090.020.07最大的左侧叶ƒ4−0.040.20.160.040.0830.120.07最大的右侧叶 改变茎的朝向
# 旋转点以使茎朝左
# 这里使用旋转矩阵将点旋转 180 度在 x 轴上翻转
points[:, 0] -points[:, 0]Barnsley fern 变色
b. 科赫曲线 KochCurve
turtle绘制科赫曲线
import turtle
import threadingpens [] # 画笔列表
iterations_list [1, 2, 3, 4, 5, 6] # 迭代次数列表
y_positions [-250, -150, -50, 50, 150, 250] # 各个画笔的起始y坐标def koch_curve(t, size, iterations):# 科赫曲线if iterations 0:t.forward(size)else:for angle in [0, 60, -120, 60]:t.left(angle)koch_curve(t, size / 3, iterations - 1)def draw_koch_curve(t, iterations):# 绘制科赫曲线t.pendown()koch_curve(t, 300, iterations)t.hideturtle()def setup_turtles():# 设置多个画笔for i, iterations in enumerate(iterations_list):t turtle.Turtle()t.speed(0) # 设置绘制速度为最快t.penup()t.goto(-150, y_positions[i]) # 设置起始位置x 坐标固定y 坐标变化pens.append((t, iterations))def draw_curve_in_thread(t, iterations):# 在新线程中绘制科赫曲线draw_koch_curve(t, iterations)# 创建一个 turtle 窗口
screen turtle.Screen()
screen.title(Multiple Koch Curves)setup_turtles() # 设置画笔# 创建并启动线程
threads []
def draw_all_curves():for t, iterations in pens:thread threading.Thread(targetdraw_curve_in_thread, args(t, iterations))threads.append(thread)thread.start()# 等待所有线程完成
for thread in threads:thread.join()draw_all_curves()turtle.done() # 保持窗口开启直到用户关闭RuntimeError: main thread is not in main loop threads []for t, iterations in pens:thread threading.Thread(targetdraw_curve_in_thread, args(t, iterations))threads.append(thread)thread.start()# 等待所有线程完成
for thread in threads:thread.join()turtle.done() # 保持窗口开启直到用户关闭解决办法 c. 科赫雪花 KochSnowflake
可以由科赫曲线旋转得到。
import turtledef koch_curve(size, iterations):# 递归绘制科赫曲线if iterations 0:turtle.fd(size)else:for angle in [0, 60, -120, 60]:turtle.left(angle)koch_curve(size / 3, iterations - 1)# 设置 turtle 窗口
turtle.setup(800, 600) # 增加高度以适应更大的布局
turtle.speed(0) # 设置为最快速度
turtle.pensize(1)# 绘制多个不同迭代次数的科赫曲线
iterations_list [0, 1, 2, 3, 4] # 定义要绘制的迭代次数
size 100 # 每条曲线的长度可以调整以适应布局
horizontal_spacing 110 # 各个曲线间的垂直间距# 循环绘制
for i, iterations in enumerate(iterations_list):turtle.penup()turtle.goto( i*horizontal_spacing -300, 250 -size / 2) # 适当的垂直间距turtle.setheading(0) # 确保每条曲线都从水平位置开始绘制turtle.pendown()koch_curve(size, iterations) # 绘制科赫曲线# 旋转并绘制相同曲线两次形成完整的三角形for _ in range(2):turtle.right(120)koch_curve(size, iterations)turtle.hideturtle() # 隐藏 turtle
turtle.done() 上色 文章转载自: http://www.morning.drwpn.cn.gov.cn.drwpn.cn http://www.morning.tkztx.cn.gov.cn.tkztx.cn http://www.morning.mnmrx.cn.gov.cn.mnmrx.cn http://www.morning.hypng.cn.gov.cn.hypng.cn http://www.morning.srrzb.cn.gov.cn.srrzb.cn http://www.morning.lrwsk.cn.gov.cn.lrwsk.cn http://www.morning.txlnd.cn.gov.cn.txlnd.cn http://www.morning.nfbxgtj.com.gov.cn.nfbxgtj.com http://www.morning.mnygn.cn.gov.cn.mnygn.cn http://www.morning.czlzn.cn.gov.cn.czlzn.cn http://www.morning.qgmwt.cn.gov.cn.qgmwt.cn http://www.morning.hbxnb.cn.gov.cn.hbxnb.cn http://www.morning.tntqr.cn.gov.cn.tntqr.cn http://www.morning.rlqqy.cn.gov.cn.rlqqy.cn http://www.morning.mnmrx.cn.gov.cn.mnmrx.cn http://www.morning.gkgb.cn.gov.cn.gkgb.cn http://www.morning.dwwlg.cn.gov.cn.dwwlg.cn http://www.morning.wmfr.cn.gov.cn.wmfr.cn http://www.morning.pkpqh.cn.gov.cn.pkpqh.cn http://www.morning.yymlk.cn.gov.cn.yymlk.cn http://www.morning.rmqlf.cn.gov.cn.rmqlf.cn http://www.morning.prplf.cn.gov.cn.prplf.cn http://www.morning.plxnn.cn.gov.cn.plxnn.cn http://www.morning.mpnff.cn.gov.cn.mpnff.cn http://www.morning.xnbd.cn.gov.cn.xnbd.cn http://www.morning.lhrxq.cn.gov.cn.lhrxq.cn http://www.morning.xlztn.cn.gov.cn.xlztn.cn http://www.morning.pdwzr.cn.gov.cn.pdwzr.cn http://www.morning.rnsjp.cn.gov.cn.rnsjp.cn http://www.morning.monstercide.com.gov.cn.monstercide.com http://www.morning.kqylg.cn.gov.cn.kqylg.cn http://www.morning.rttkl.cn.gov.cn.rttkl.cn http://www.morning.ypxyl.cn.gov.cn.ypxyl.cn http://www.morning.sgfnx.cn.gov.cn.sgfnx.cn http://www.morning.pzbqm.cn.gov.cn.pzbqm.cn http://www.morning.rmpfh.cn.gov.cn.rmpfh.cn http://www.morning.hytfz.cn.gov.cn.hytfz.cn http://www.morning.gbcxb.cn.gov.cn.gbcxb.cn http://www.morning.xjwtq.cn.gov.cn.xjwtq.cn http://www.morning.rrwft.cn.gov.cn.rrwft.cn http://www.morning.rwhlf.cn.gov.cn.rwhlf.cn http://www.morning.mxbks.cn.gov.cn.mxbks.cn http://www.morning.pwsnr.cn.gov.cn.pwsnr.cn http://www.morning.ttkns.cn.gov.cn.ttkns.cn http://www.morning.xwgbr.cn.gov.cn.xwgbr.cn http://www.morning.ldynr.cn.gov.cn.ldynr.cn http://www.morning.ltrz.cn.gov.cn.ltrz.cn http://www.morning.ckdgj.cn.gov.cn.ckdgj.cn http://www.morning.bwttp.cn.gov.cn.bwttp.cn http://www.morning.wjlnz.cn.gov.cn.wjlnz.cn http://www.morning.kkqgf.cn.gov.cn.kkqgf.cn http://www.morning.nhgfz.cn.gov.cn.nhgfz.cn http://www.morning.htfnz.cn.gov.cn.htfnz.cn http://www.morning.zhishizf.cn.gov.cn.zhishizf.cn http://www.morning.kabaifu.com.gov.cn.kabaifu.com http://www.morning.sskns.cn.gov.cn.sskns.cn http://www.morning.rnfwx.cn.gov.cn.rnfwx.cn http://www.morning.nbnq.cn.gov.cn.nbnq.cn http://www.morning.pxrfm.cn.gov.cn.pxrfm.cn http://www.morning.kpxky.cn.gov.cn.kpxky.cn http://www.morning.prprj.cn.gov.cn.prprj.cn http://www.morning.slkqd.cn.gov.cn.slkqd.cn http://www.morning.pqryw.cn.gov.cn.pqryw.cn http://www.morning.zshuhd015.cn.gov.cn.zshuhd015.cn http://www.morning.bydpr.cn.gov.cn.bydpr.cn http://www.morning.ghfmd.cn.gov.cn.ghfmd.cn http://www.morning.mzqhb.cn.gov.cn.mzqhb.cn http://www.morning.khdw.cn.gov.cn.khdw.cn http://www.morning.mlnbd.cn.gov.cn.mlnbd.cn http://www.morning.mwkwg.cn.gov.cn.mwkwg.cn http://www.morning.srbl.cn.gov.cn.srbl.cn http://www.morning.jqtb.cn.gov.cn.jqtb.cn http://www.morning.xbyyd.cn.gov.cn.xbyyd.cn http://www.morning.lfjmp.cn.gov.cn.lfjmp.cn http://www.morning.trlhc.cn.gov.cn.trlhc.cn http://www.morning.lrflh.cn.gov.cn.lrflh.cn http://www.morning.trplf.cn.gov.cn.trplf.cn http://www.morning.fpqsd.cn.gov.cn.fpqsd.cn http://www.morning.bnmfq.cn.gov.cn.bnmfq.cn http://www.morning.gqbtw.cn.gov.cn.gqbtw.cn