The Boy Who Loved Math

The most simple perfect squared square (zoom, in Wikimedia Commons and SVG)
The most simple perfect squared square (in 750px, Wikipedia and SVG)

The Boy Who Loved Math: The Improbable Life of Paul ErdősThe Boy Who Loved Math: The Improbable Life of Paul Erdős is a funny children book about the legendary Hungarian mathematician. Author of the book, Deborah Heiligman has got the help of Erdős’s friends and colleagues, also the illustrator of the book, Le Uyen Pham has traveled to Budapest to create great illustrations about the place of birth and childhood of the world wanderer Paul Erdős. According to the New York Times’s review (Nate Silver: Beautiful Minds), this book “should make excellent reading for nerds of all ages.” It contains also several interesting mathematical problems, including the illustrated one: how can we tile a square using other squares whose sizes are all different and have integer lengths. The squaring on the picture is the simplest one, and it was discovered by A. J. W. Duijvestijn in 1978, see its interesting history on Squaring.net.
The LibreLogo source code of the illustration uses the mapping and grid drawing procedures of the tangram drawing example of the previous post, also the new procedure box for drawing a square with random filling color with 50% transparency (using the new FILLTRANSPARENCY command of LibreOffice 4.3) and a title showing the actual size: The Boy Who Loved Math bővebben…

Draw tangram

drawtangram_previewLibreLogo can export SVG animations in the upcoming LibreOffice 4.3. The attached picture is the animated GIF preview of the SVG/SMIL Wikipedia animation about tangram drawing, see the SVG animation in your browser.
Saving animated SVG pictures needs to use only the SLEEP command within the PICTURE block. If the PICTURE block ends also with a SLEEP command, the result will be a looping SVG animation, as in this example.

TO place x y
POSITION [200+x*40, 400-y*40]
END

TO line x y x2 y2
PENUP place x y
PENDOWN place x2 y2
END

TO grid x y x2 y2
REPEAT y2-y+1 [
    line x y+REPCOUNT-1 x2 y+REPCOUNT-1
]
REPEAT x2-x+1 [
    line x+REPCOUNT-1 y x+REPCOUNT-1 y2
]
END

PICTURE “drawtangram.svg” [
PENSIZE 2 HIDETURTLE
PENCAP “ROUND”
PENCOLOR “SILVER”
grid 0 0 4 4 SLEEP 1000
PENCOLOR “BLACK”
line 0 4 4 0 SLEEP 1000
line 2 4 4 2 SLEEP 1000
line 1 3 2 4 SLEEP 1000
line 0 0 3 3 SLEEP 1000
line 3 3 3 1 SLEEP 1000
FILLCOLOR “RED” line 0 0 0 4 place 2 2 FILL
FILLCOLOR “BLUE” line 0 0 4 0 place 2 2 FILL
FILLCOLOR “GREEN” line 0 4 2 4 place 1 3 FILL
FILLCOLOR “PURPLE” line 2 4 4 4 place 4 2 FILL
FILLCOLOR “LIME” line 3 1 2 2 place 3 3 FILL
FILLCOLOR “FUCHSIA” line 2 4 1 3 place 2 2 place 3 3 FILL
FILLCOLOR “YELLOW” line 3 1 3 3 place 4 2 place 4 0 FILL
SLEEP 2000
]

Note: this code shows an example to use arbitrary Cartesian coordinate system with LibreLogo: the procedure place moves the turtle to the given coordinate, mapping it to the PostScript like coordinate system of LibreOffice. Procedure line calls place two times to draw a line. With combining line with place calls it’s possible to draw the filled tangram shapes using simple Cartesian coordinates.

The tangram is a popular dissection puzzle (see the LibreLogo turtle). Chinese mathematicians Fu Traing Wang and Chuan-Chih Hsiung proofed in 1942, that there are only 13 convex polygons can be formed by the tangram. Solving them is a good play (especially with a real tangram set):
convex_tangram_shapes_black
[The solution (with an extended LibreLogo source code moving the origin of the Cartesian coordinate system to draw multiple shapes with simple Cartesian coordinates): convex tangram shapes (SVG).]