Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档 > MATLAB技术文章
MATLAB技术文章 MATLAB Technical Articles From Mathworks
回复
 
主题工具 显示模式
旧 2025-05-04, 08:02   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,008
声望力: 66
poster 正向着好的方向发展
默认 L-systems, Plants, Fractal Curves, Turtles and Dragons - Cleve Moler on Mathematics and Computing

No, this is not the script for an episode of "Game of Thrones". It is a blog post about Lindenmayer grammars, growing plants, space-filling fractals, turtle graphics and dragon curves.

Here is the opening screen from our new program, MLogo.



Contents
L-systems

Aristid Lindenmayer (1925-1989) was a Hungarian biologist and botanist at the University of Utrecht. In 1968 he introduced a formal grammar for string rewrite rules that can describe living plants, artificial fractals, and especially, artificial fractals that model living plants.

Lindenmayer's strings drive MLogo. A simple example is

R = @(s) replace(s,"A","A+A-A");If you start with

s = "A"and repeat

s = R(s)three times, the result is

A A+A-A A+A-A+A+A-A-A+A-A A+A-A+A+A-A-A+A-A+A+A-A+A+A-A-A+A-A-A+A-A+A+A-A-A+A-AMLogo

Logo is a programming language, aimed at young students, developed in 1967 by MIT professors Wally Feurzeig, Seymour Papert, and Cynthia Solomon. Logo has been very influential, spawning hundreds of implementations and successors. MLogo, short for MATLAB Logo, is another successor.

A distinctive feature of Logo offprings is "turtle graphics". Basic Logo commands like step, turn, and draw drive a virtual tortoise, originally a motorized toy, and later a graphics cursor. Here is a sample with turtle driven by this Lindenmayer system.

A step forward+ turn left 90 degrees- turn right 90 degreess = A+A-A-A+

Dragon Curve

The dragon space-filling fractal curve was invented by NASA physicist John Heighway and his colleagues and featured in Martin Gardner's Scientific American column in 1967. I made a Cleve's Corner posting about the dragon curve in 2018.

Here is MLogo's dragon.



Here is a frame from "Numberphile" video where Brady Haran visits Don Knuth and the unique ceramic tile dragon in his home.



Hilbert Curve

David Hilbert (1862-1943), one of the most influential mathematicians of his era, introduced the space-filling fractal Hilbert curve in 1891.

Here is MLogo's Hilbert curve.



Here is a crazy application of the Hilbert curve, Randall Munroe's view of Internet addresses in 2006, https://xkcd.com/195.



https://xkcd.com/195

Gosper Fractal

Bill Gosper, one of the original MIT "hackers", has made major contributions to Lisp and Macsyma, found the "glider gun" for Conway's Game of Life, and invented the Gosper fractal.

Here is MLogo's rendition.



Dragon Nerd creates jewelry from the Gosper curve and other fractals.



https://www.etsy.com/shop/DragonNerd

Algorithmic Beauty of Plants

"The Algorithmic Beauty of Plants" is a beautiful book by Przemyslaw Prusinkiewicz and Aristid Lindenmayer, featuring over fifty color figures of computer-generated plants. The original book is available from Springer Nature. A PDF version is available from AlgormicBotany at the University of Calgary.



This is MLogo's rendition of one small example.



Software

https://blogs.mathworks.com/cleve/files/MLogo.m


Get the MATLAB code (requires JavaScript)

Published with MATLAB® R2024b
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 09:10


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.