PDA

查看完整版本 : L-systems, Plants, Fractal Curves, Turtles and Dragons - Cleve Moler on Mathematics and Computing


poster
2025-05-04, 08:02
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.

http://blogs.mathworks.com/cleve/files/MLogo.png

Contents


L-systems (#e4c73f18-5203-41ab-aae7-29dfc3c677bc)
MLogo (#2b729287-e100-42ba-9e7f-ceab5a7a41a4)
Dragon Curve (#fb091433-870d-4ce0-82f6-4310e751f537)
Hilbert Curve (#984588f4-4cb8-4fa5-8978-ec6e07b244b2)
Gosper Fractal (#27758267-deb0-4d68-9287-7f7af46ef0ec)
Algorithmic Beauty of Plants (#164f12f3-6e87-42af-b4e5-b38dd5d03010)
Software (#b0adc2d3-245d-4aca-b9f1-6a19fc7af2f3)

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 (https://en.wikipedia.org/wiki/Logo_(programming_language)) 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+http://blogs.mathworks.com/cleve/files/Turtle-2.gif

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 (https://blogs.mathworks.com/cleve/2018/04/06/the-dragon-curve) posting about the dragon curve in 2018.

Here is MLogo's dragon.

http://blogs.mathworks.com/cleve/files/Dragon-1.gif

Here is a frame from "Numberphile" video where Brady Haran visits Don Knuth (https://www.youtube.com/watch?v=v678Em6qyzk) and the unique ceramic tile dragon in his home.

http://blogs.mathworks.com/cleve/files/Knuth.png

Hilbert Curve

David Hilbert (https://en.wikipedia.org/wiki/David_Hilbert) (1862-1943), one of the most influential mathematicians of his era, introduced the space-filling fractal Hilbert curve (https://en.wikipedia.org/wiki/Hilbert_curve) in 1891.

Here is MLogo's Hilbert curve.

http://blogs.mathworks.com/cleve/files/Hilbert.gif

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

http://blogs.mathworks.com/cleve/files/xkcd.png

https://xkcd.com/195

Gosper Fractal

Bill Gosper (https://en.wikipedia.org/wiki/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.

http://blogs.mathworks.com/cleve/files/Gosper-1.gif

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

http://blogs.mathworks.com/cleve/files/DragonNerd.png

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 (https://link.springer.com/book/10.1007/978-1-4613-8476-2). A PDF version is available from AlgormicBotany (https://algorithmicbotany.org/papers/#abop) at the University of Calgary.

http://blogs.mathworks.com/cleve/files/abop.png

This is MLogo's rendition of one small example.

http://blogs.mathworks.com/cleve/files/Plant-2.gif

Software

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


Get the MATLAB code (requires JavaScript) (javascript:grabCode_038066df016b4e6685a8571703c3f9db())

Published with MATLAB® R2024b