Pythagoras Tree Script: Iterative Rotation Fractal Construction

Pythagoras Tree Script: Iterative Rotation Fractal Construction
Loading the math board and drawing, please wait…
2021-01-23 11:47
This GeoGebra example demonstrates how the Pythagoras tree fractal can be generated from a starting right-triangle configuration by repeatedly rotating and attaching new triangle branches. The key mathematical ideas include fractal geometry (self-similarity via iteration), right-triangle relationships inspired by the Pythagorean theorem, and transformation-based construction using angles, midpoints, and semicircles. Construction highlights: Sequence controls the recursion depth; Zip and Remove help manage sets of created objects across iterations; Polygon builds triangle/polygon pieces; Midpoint computes key split points; Semicircle creates semicircular arcs used in the geometry; Point and Angle define critical vertices and angle parameters; Rotate together with BasePoints applies rotation iteratively around chosen pivot points; Join combines segments into the final structured figure. It uses layered point collections (e.g., pointsBase, points1, points2) and naming/visibility variables to manage multiple branches. Suitable for secondary school through early university topics on iterative geometry, transformation geometry, and introductory fractal visualization.

GeoGebra Commands & Parameters

  1. Sequence(1, M) → Lm
  2. Sequence(1, N) → LN
  3. Zip("S" + (Text[n]), n, LN) → Sname
  4. Sequence(k, k, 1, 2^(2), 2) → S1
  5. Sequence(k, k, 1, 2^(3), 2) → S2
  6. Sequence(k, k, 1, 2^(4), 2) → S3
  7. Sequence(k, k, 1, 2^(5), 2) → S4
  8. Sequence(k, k, 1, 2^(6), 2) → S5
  9. Sequence(k, k, 1, 2^(7), 2) → S6
  10. Sequence(k, k, 1, 2^(8), 2) → S7
  11. Remove(LN, {1}) → LK
  12. Zip("T" + (Text[n]), n, LK) → Tname
  13. Sequence(k, k, 1, 2^(3), 4) → T2
  14. Sequence(k, k, 1, 2^(4), 4) → T3
  15. Sequence(k, k, 1, 2^(5), 4) → T4
  16. Sequence(k, k, 1, 2^(6), 4) → T5
  17. Sequence(k, k, 1, 2^(7), 4) → T6
  18. Sequence(k, k, 1, 2^(8), 4) → T7
  19. Polygon(A, B, 4) → base, f, g, h, i, C, D
  20. Midpoint(C, D) → E
  21. Semicircle(D, C) → arc
  22. Point(arc) → F
  23. Angle(C, E, F) → α
  24. Rotate(C, α, E) → C'
  25. Rotate(C, α, E) → C'_1
  26. BasePoints(A, B, α) → points1
  27. Join(Zip[BasePoints[Element[points1, k], Element[points1, k + 1], α], k, S1]) → points2
  28. Join(Zip[BasePoints[Element[points2, k], Element[points2, k + 1], α], k, S2]) → points3
  29. Join(Zip[BasePoints[Element[points3, k], Element[points3, k + 1], α], k, S3]) → points4
  30. Join(Zip[BasePoints[Element[points4, k], Element[points4, k + 1], α], k, S4]) → points5
  31. Join(Zip[BasePoints[Element[points5, k], Element[points5, k + 1], α], k, S5]) → points6
  32. Join(Zip[BasePoints[Element[points6, k], Element[points6, k + 1], α], k, S6]) → points7
  33. Join(Zip[BasePoints[Element[points7, k], Element[points7, k + 1], α], k, S7]) → points8
  34. Zip(Polygon[Element[points1, k], Element[points1, k + 1], 4], k, S1) → squares1
  35. Zip(Polygon[Element[points2, k], Element[points2, k + 1], 4], k, S2) → squares2
  36. Zip(Polygon[Element[points3, k], Element[points3, k + 1], 4], k, S3) → squares3
  37. Zip(Polygon[Element[points4, k], Element[points4, k + 1], 4], k, S4) → squares4
  38. Zip(Polygon[Element[points5, k], Element[points5, k + 1], 4], k, S5) → squares5
  39. Zip(Polygon[Element[points6, k], Element[points6, k + 1], 4], k, S6) → squares6
  40. Zip(Polygon[Element[points7, k], Element[points7, k + 1], 4], k, S7) → squares7
  41. Polygon(points1) → triangles1
  42. Zip(Polygon[Element[points2, k], Element[points2, k + 1], Element[points2, k + 3]], k, T2) → triangles2
  43. Zip(Polygon[Element[points3, k], Element[points3, k + 1], Element[points3, k + 3]], k, T3) → triangles3
  44. Zip(Polygon[Element[points4, k], Element[points4, k + 1], Element[points4, k + 3]], k, T4) → triangles4
  45. Zip(Polygon[Element[points5, k], Element[points5, k + 1], Element[points5, k + 3]], k, T5) → triangles5
  46. Zip(Polygon[Element[points6, k], Element[points6, k + 1], Element[points6, k + 3]], k, T6) → triangles6
  47. Zip(Polygon[Element[points7, k], Element[points7, k + 1], Element[points7, k + 3]], k, T7) → triangles7

AI Drawing Prompt Reference

Start with a base segment and construct a square on it. Above the square, draw a semicircle using the top side as diameter. Pick a point on the semicircle and connect it to the midpoint of the top side, forming a right triangle; measure the angle at the midpoint. Use this angle to rotate the square around the midpoint, generating new branch points. Repeat the process for each new branch: build squares on adjacent point pairs, add semicircles above them, pick points, and rotate to create the next level. Iterate several levels to produce a fractal tree of shrinking squares and right triangles, known as the Pythagoras tree.
The prompt above was compiled from the original drawing commands and is for reference only.