Curve-Stitching the Cardioid Using Python

String Art Star Design from Wikimedia

Recently I came across a copy of an journal called the mathematics teacher from December of 1978. It is full of interesting math and computer related classroom ideas. This particular issue had an article titled Curves-Stitching the Cardioid and Related Curves.

These types of images were something you would have seen at that time in the 70s as string art – handmade art pieces made using small nails or tacks and lots of yarn or string. I had seen these pictures before but I haven’t made one nor did I know the simple rules behind making them. I think they look really great and might be an interesting enrichment activity for some students.

I have shared a Jupyter notebook that creates the graphic. It runs fully in the browser using the Basthon Notebook. This is like an online Jupyter / Python notebook with Processing in the form of P5. The code can easily run in regular Processing as well. The output looks great printed from a PDF on a laser printer. And I was also able to load this into a Cricket machine to draw the plot which was something I was wanting to try.

Creating the cardioid using Processing was a relatively simple sketch. The math required includes basic geometry and trig using SOHCAHTOA. The programming requires using a list and apply the math to create a drawing using lines. I think it was fun to code and they look great!

I think making the string art version would go a long way in helping a student to code this. The drawing process would be well and truly understood. Perhaps using a handout with the circle already drawn and divided into equal parts might go a long way in speeding up the process.