Logiciel libre de géométrie, d'analyse et de simulation multiplateforme par Yves Biton

Accueil Tutoriels l’API de MathGraph32

Programming a figure en Python : the Sierpinski mat

modification mercredi 1er mai 2024.

Toutes les versions de cet article : [English] [français]



Since 7.9.1 version, MathGraph32 allows to create object using Python langage Python.

Here we will generate a Sierpinski mat.

If you change the Python code here under, click on button Execute under the code frame.

See under the figure explanations on the figure construction.
See also another exemple of code to get the same result.


The bottom line to get this figure :

At level 0 we fill the central code A1B1C1D1 then we iterate the process for the 8 pink squares. See the figure underneath with the same notations for the points ad the Python code here under.


Another example of Python code to get the same result. This time the Sierpinski function takes only two parameters.