[Fuxi Bagua Diagram] (Python&Matlab implementation)

content

1 Conversation with Darwin

2 Dialogue with Lao Tzu

2.1 Python implementation

2.2 Matlab implementation                           


1 Conversation with Darwin

140 years ago, on July 1, 1858, Darwin published his outstanding treatise on natural selection on the Isle of England. He proposed that the law of biological development is natural selection. After the competition of things, nature selects and retains the species with the most life advantage. These species are getting stronger and stronger. It is an indisputable fact that man has become omnipotent and has become the species that dominates the world. But in the long evolutionary history of the earth, we have seen again that the behemoth dinosaurs that once ruled the earth died out. Some scientists attribute it to the impact of the asteroid on Earth. But right before our generation, the tiger, the king of beasts, is disappearing day by day. We know that in the timeline of its demise, the asteroid did not collide with Earth.


Following Darwin's thinking , we know that animals are stronger than plants, and tigers are stronger than mice. The later species are stronger because they are the result of natural selection. The strong survive and the weak are eliminated. But looking around, the plants are lush, the mice are in groups, and the tiger, the king of beasts, is dying day by day.

Looking further, the most primitive species of single-celled organisms born 3.5 billion years ago are still the life forms with the strongest survival, the largest biomass, and the widest distribution on the earth. Species like mammals are going extinct at the fastest rate. Re-examining archaeology from a different perspective, we will find that among more than 99% of the biological species that have been extinct for hundreds of millions of years, the more evolved species have a higher probability of elimination and a faster extinction rate, that is, the lower the survival rate. .

Why does the "strong" die out and the "weak" endure? That is to say, behind the apparent phenomenon of "natural selection, survival of the fittest", there is actually a hidden "natural selection" The one-dimensional regulation of the weakening products of survival pushing out layer by layer”. The Hindu poet Tagore said: "We see the world wrong, but the world deceives us." Is the great Darwin wrong, or is there another law in the world beyond our limited cognition
? Physicists, chemists, biologists, and sociologists have thought about this problem and can't figure it out, or have come to the door of this problem and have no idea what to do. The large number of difficult and incomprehensible texts he left behind are mostly related to this.

2 Dialogue with Lao Tzu

2.1 Python implementation

     ​​



#====导入相关库========
import turtle
import time

#====欢迎关注公众号:电力系统与算法之美======
#====更多惊喜,更多浪漫,更多算法等你=====
angle = 270
turtle.title('我与老子对话')
#=====太极图=======
def tai():
    r = 200  # 设置半径
    turtle.penup()  # 拿起画笔
    turtle.goto(0, 0)  # 到画布中心
    turtle.setheading(angle)  # 设置当前朝向为angle角度
    turtle.fd(r)  # 前进r的距离
    turtle.pendown()  # 放下画笔
    turtle.right(90)  # 调整海龟角度

    #======画阳鱼======
    turtle.fillcolor("white")  # 填充为白色
    turtle.begin_fill()  # 开始填充
    turtle.circle(-r / 2, 180)
    turtle.circle(r / 2, 180)
    turtle.circle(r, 180)
    turtle.end_fill()  # 填充结束

    #=====画阴鱼=========
    turtle.fillcolor("black")  # 填充为黑色
    turtle.begin_fill()
    turtle.circle(r, 180)
    turtle.right(180)
    turtle.circle(-r / 2, 180)
    turtle.circle(r / 2, 180)
    turtle.end_fill()

    #=======画阴鱼眼==========
    turtle.penup()
    turtle.setheading(angle)
    turtle.fd(-r / 2)
    turtle.pendown()
    turtle.dot(r / 4, "white")  # dot()绘制具有特定大小和颜色的圆点

    #=========画阳鱼眼=========
    turtle.penup()
    turtle.fd(-r)
    turtle.pendown()
    turtle.dot(r / 4, "black")
    turtle.penup()

turtle.tracer(0)  # 将刷新率置为0,即不刷新
for i in range(10000):  # 这里设置了1w次,也可以是其他次数
    tai()
    turtle.update()  # 更新绘图
    time.sleep(0.01)  # 休眠时间,这一句可以没有,但是如果没有的话,太极转的会很快
    turtle.clear()  # 清空画布
    angle += 1

2.2 Matlab implementation 

                           


%% 太极八卦图

%%~~~~~~~欢迎关注公众号:电力系统与算法之美~~~~%%

clc;clear;close all;
t=0:.1:pi;
T=0:.1:2*pi;
c=@(t)cos(t);s=@(t)sin(t);
x=c(t);y=s(t);
X=c(t);Y=s(-t);
x1=.1*c(T)-.5;y1=.1*s(T);
x2=x1+1;%y2=y1;
x3=.5*c(t)-.5;y3=.5*s(t);
x4=x3+1;%y4=-y3;
hold on
f=@(x,y,c)fill([x,flip(x3,2),flip(x4,2)],...
    [y,flip(y3,2),flip(-y3,2)],c);
f(X,Y,'k');
f(x,y,'w');
fill(x2,y1,'k',x1,y1,'w')
axis square off

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326988164&siteId=291194637