GeoGebra勾股树制作

返回首页

效果预览

GeoGebra简介

GeoGebra(音译:几何不难)
是数形结合的神器,个人使用完全免费,并且可跨平台使用

官网https://www.geogebra.org/
经典版本下载 http://download.geogebra.org/installers/5.0/
跨平台的网页版说明
https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_Embedding
跨平台的网页版下载
https://download.geogebra.org/package/geogebra-math-apps-bundle

勾股树的本质是几何分形,为了方便理解,我们从GeoGebra的代数例子入手

分形数阵详解

问题

要求做出下面的分形数阵

1
11, 12
111, 112, 121, 122
1111, 1112, 1121, 1122, 1211, 1212, 1221, 1222
...

求解

指令:

IterationList(join(zip({10*k+1,10*k+2}, k, p)),p,{{1}},2)

结果:

{{1}, {11, 12}, {111, 112, 121, 122}}

这个一大串的东西,着实复杂,不过没关系,我们可以看下面的分析

过程分析

上面的指定用到了GeoGebra内置的三个函数,点击下面三个函数名字,可以直接跳转到官网说明

我们只需要知道每个函数可以输入什么对象,输出什么对象。接地气的说法就是:吃进什么,吐出什么。

IterationList
iterationList(p*10+1, p, {1}, 2)结果为 {1, 11, 111}.

Join
Join({{1, 2, 3}, {3, 4}, {8, 7}}) 结果为 {1, 2, 3, 3, 4, 8, 7}.
Join({5, 4, 3}, {1, 2, 3}) 结果为 {5, 4, 3, 1, 2, 3}.

Zip
Zip(f(2), f, {x+1,x+3}) 结果为 {3, 5}.
Zip(Degree(a), a, {x^2, x^3, x^6}) 结果为 {2, 3, 6}.
zip({10*k+1,10*k+2}, k, {1,2,3}) 结果为 {{11,12}, {21,22}, {31,32}}.

上面的函数,至于怎么理解,怎么翻译,全看个人!在作者看来:

理解了GeoGebra这三个内置的函数,我们再分析原来的分形数阵,这里我们从天人合一Join + 雨露均沾Zip开始

先回顾下Zip的最后一个例子zip({10*k+1,10*k+2}, k, {1,2,3}) ,它最后一个参数是一个列表{1,2,3},雨露均沾之后,每个元素都有了一个新的小家庭 {{11,12}, {21,22}, {31,32}},并且各个家庭之间都有一堵坚实的{}围墙,当然需要外修天人合一功法Join去除不必要的杂念纷争,去掉{}围墙合为一家,因此下面的命令

Join(zip({10*k+1,10*k+2}, k, {1,2,3}))

不难想到,其结果是

{11,12,21,22,31,32}

类似有
Join(zip({10*k+1,10*k+2}, k, {1}))结果是 {11,12}
Join(zip({10*k+1,10*k+2}, k, {11,12}))结果是 {111, 112, 121, 122}

这些指令明显符合代代相传的特点,总不能一直纯手动一步步输入这些指令吧,因此修行第三层代代相传IterationList功法为上策!再回头看看

IterationList(join(zip({10*k+1,10*k+2}, k, p)),p,{{1}},2)

修行代代相传IterationList功法当然要知道:祖师爷是谁,神功传了几代,每两代之间如何继承和发扬这个神功。很明显这里的祖师爷是{{1}},因为IterationList最后一个参数为2,因此神功只传了两代,这里神功继承和发扬的方法不是别的,正是前面一直提到的天人合一Join + 雨露均沾Zipjoin(zip({10*k+1,10*k+2}, k, p))

为了进一步理解三层神功,读者可以试试把祖师爷{{1}}改写成{{11,12}}。也可以修改下神功传的代数2。

勾股树详解

对前面的代数分形做个总结

雨露均沾Zip,出现很多不融合的家庭,需要天人合一功法Join去除杂念纷争,让各个家庭合成一家,最后把这种优秀的神功代代相传IterationList,必然子子孙孙无穷匮也。

对勾股树的绘制做个分析

不难知道制作勾股树最简单的做法是只绘制矩形,中间的直角三角形自然会通过矩形刻画出来。

我们需要完成下面的步骤:

具体实现

绘制矩形p1

p1 = Polygon((-1,0), (1,0), 4)

通过矩形p1得到矩形p11p12

结合天人合一 Join + 雨露均沾Zip

最后用神功代代相传IterationList可得到如下指定

IterationList(
	Join(zip(
		{Polygon(Vertex(k,4),  
		         Point(Semicircle(Vertex(k,4), Vertex(k,3)), 0.5), 
		         4),  
		 Polygon(Point(Semicircle(Vertex(k,4), Vertex(k,3)), 0.5),
		         Vertex(k,3), 
		         4)
		 }, 
	     k, 
	     p
	     )
	),
	 p,
	 {{p1}},
	 6  
)

这就意味着,先输入

p1 = Polygon((-1,0), (1,0), 4)

再输入上面那大一串的代代相传相关指定,就可以直接得到5层勾股树!
但是我们还希望用滑动条控制勾股树的层数,以及直角三角形的形状,为此只需要稍加修改,先输入两个滑条指令,

t = slider(0, 1, 0.01)
n = slider(1, 4, 1)

把上面两段代码中的0.5都换成t, 并且把6换成n

全部指定

p1 = Polygon((-1,0), (1,0), 4)
t = slider(0, 1, 0.01)
n = slider(1, 4, 1)
IterationList(Join(zip({Polygon(Vertex(k,4), Point(Semicircle(Vertex(k,4),Vertex(k,3)), t), 4), Polygon(Point(Semicircle(Vertex(k,4), Vertex(k,3)), t), Vertex(k,3), 4) }, k, p)),p,{{p1}},n)

上面的指令一行行,需要逐行指令复制Ctrl+C,再快捷键Ctrl+V粘贴到GeoGebra的命令行中

学以致用

在线试试

温馨提示: 出现难以拯救的错误不要紧,F5刷新网页重新开始

温故知新

本次教程学会了三大神功

并且学会了代数分形,几何分形相关制图

更学会了很实用的方法:复杂的几何绘图问题可以从代数开始

如果有所尝试,一定会感受到数形结合的美

返回首页

首页地址 https://kz16.top/geogebra/
本文来源 https://kz16.top/geogebra/ptree

欢迎转载,转载请指明来源,
请勿用于商业
作者:Zhou Bingzhen
2019.10.19

UEsDBBQACAgIANu4U08AAAAAAAAAAAAAAAAXAAAAZ2VvZ2VicmFfZGVmYXVsdHMyZC54bWztmk9z4jYUwM/dT6HRqT0ELIOBzcTZye5Mp5nJZjNNZqdXYQujRkiuJQfDp19ZAtssOAVDCkmTQ+Qn659/7+npSeLiUzZh4IkkkgruQ9RyICA8ECHlkQ9TNTobwE+XHy4iIiIyTDAYiWSClQ+9vGRRT0str+fmeTiOfRgwLCUNIIgZVnkVH04hAJmk51zc4gmRMQ7IfTAmE3wjAqxMK2Ol4vN2ezqdtpb9tUQStaNItTIZQqDHyqUPFw/nurmVStOOKe46Dmr/9fXGNn9GuVSYBwQC/R0hGeGUKakfCSMTwhVQs5j4MBaUKwgYHhLmw7tcAr+OEkJ+g2BRSeNx4OWHXy7kWEyBGP5NAp2nkpQU9YzQzsvo118EEwlIfNjvQxDZZOhD1/M0JRaPsQ8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