Sierpinski Triangles

On Saturday morning, my daughter had made some nice art with sketch pen on an A4 paper. It was rather “geometric” consisting of repeating patterns across the page. My wife took one look at it and said, “do you know that you can make such art with computers also? Your father has made some”.

Some drawings I had made using code, back in 2016

“Reallly?”, piped the daughter. I had been intending for a while to start teaching her to code (she is six), and figured this was the perfect trigger, and said I will teach her.

A quick search revealed that there is an “ACS Logo” for Mac (Logo was the first “programming language” I had learnt, when I was nine). I quickly downloaded it on her computer (my wife’s old Macbook Air) and figured I remembered most of the commands.

And then I started typing, and showed her what they had showed me back in  a “computer class” behind my house in 1992 – FD for “forward”. RT for right turn. HT for hide turtle. Etc. Etc.

Soon she was engrossed in it. Thankfully she has learnt angles in her school, though it took her some trial and error to figure out how much to turn by for different shapes (later I was thinking this can also serve as a good “angles revision” for her during her ongoing summer holidays).

With my wife having reminded me that I could produce images through code, I realised that as my daughter was engrossed in her “coding”, I should do some “coding art” on my own. All she needed was some occasional input, and for me to sit right next to her.

Last Monday I had got a bit of a scare – at work, I needed to generate randomly distributed points in a regular hexagon. A lookup online told me that I could just get a larger number of randomly distributed points in a bounding rectangle, and then only pick points within the hexagon. And then take a random sample of those.

This had meant that I needed to write equations for whether a point lay inside a hexagon. And I realised I’d forgotten ALL my coordinate geometry. It took me over half an hour to get the equation for the sides of the hexagon right – I’m clearly rusty.

And on Saturday, as I sat down to make some “computer art”, I decided I’ll make some fractals. Why don’t I make some Sierpinski Triangles, I thought. I started breaking down what code I needed to write.

First, given an equilateral triangle, I had to return three similar equilateral triangles, each of half the side length of the original triangles.

Then, given the centroid of an equilateral triangle and the length of each side, I had to return the vertices.

Once these two functions had been written, I could just chain them (after running the first one recursively) and then had to just plot to get the Sierpinski triangle.

And then I had my second scare of the week – not only had I forgotten my coordinate geometry – I had forgotten my trigonometry as well. Again I messed up a few times, but the good thing about programming with a computer is that i could do trial and error. Soon I had it right, and started producing Sierpinski triangles.

Then, there was another problem – my code was really inefficient. If I went beyond depth 4 or 5, the figures would take inordinately long to render. Since I was coding in R, I set about vectorising all my code. In R you don’t write loops if you can help it – instead, you apply functions on entire vectors. This again took some time, and then I had the triangles ready. I proudly showed them off to my daughter.

“Appa, why is it that as you increase the number it becomes greyer”, she asked . I explained how with each step, you were taking away more of the filled areas from the triangles. Then I figured this wasn’t that good-looking – maybe I should colour it.

And so I wrote code to colour the triangles. Basically, I started recursively colouring them – the top third green, left third red and right third blue (starting with a red base). This is what I ended up producing:

And this is what my daughter produced at the same time, using Logo:

I forgot to “HT” before taking the screenshot. This is a “lollipop” 

Ending a 33-year-old wait

When I was in upper kindergarten (UKG) in 1987-88, my teacher Chandrika Aunty had shown me how to do thread painting. It was a fascinating exercise. Cover a thread in paint, and then let it lie in a random pattern inside a folded piece of paper, and then pull out the thread. It creates a beautiful and symmetrical (thanks to the folding) pattern in the paper.

To my dismay, Chandrika Aunty failed to repeat this exercise, instead spending time to teach us other kinds of painting such as dipping ladies fingers in paint (I’ve always loathed ladies finger as a vegetable, so you can imagine my not being enthused by using it as a block-print).

Somehow my mother (who was generally interested in painting) wasn’t interested in doing this either. So as much as I loved it, I never ended up doing thread painting again as a child.

All that changed a few days back. With the lockdown on, my daughter’s school has been sending her “assignments” to do at home. Now, I find most of these assignments rather stressful. Sometimes they make me wonder what’s the point of sending her to a Montessori at all, if they are giving here homework that I have to supervise (thankfully none of these need to necessarily need to be turned in. They’re more for keeping her occupied. But looking at them as “pending” on the Google Classroom irritates me).

However, there was one assignment that I was rather excited to see. Thread painting! We sat on it for a few days without doing (basically NED happened). However, it was my wife’s birthday yesterday, and when we sat down to make a card for her on Tuesday, it seemed like the perfect opportunity to do thread painting.

And so we did, using a small string and water colour tablets (I was so excited by the idea of thread painting that I didn’t bother following the school’s instructions). Apply water to the colour tablet, put the thread on it (and use the brush to make sure the paint was coated on the thread). Then put it in a random pattern between the folded sheets. And then pull it out carefully (the last bit was done by the daughter with great interest).

This was the result:

I’m rather excited by this. For someone artistically challenged like me, this is a nice way to make nice-looking images.

I don’t intend to do a Chandrika Aunty. I plan to do thread painting on a regular basis with the daughter. It’s both fun to do and produces nice results, like what you see here.

The rest of her school assignments can remain undone. I don’t care.

Looking for porn in Ikkeri

A long time back I’d gone to Sringeri, and tried to use insights from Tyler Cowen’s Discover Your Inner Economist, which I had then just read. Cowen had written that the way to get interested in things you’re not normally interested about is in engaging in side bets.

So if you’re watching a game where you don’t know which team to root for (which makes it less interesting), you place a bet. When you go to an art gallery, think about which painting you would want to steal (if given a choice).

And a corollary is that when you visit a medieval Indian temple, you get yourself interested in the sculptures by looking for porn in them. At Sringeri I hadn’t had that much luck. Either I was bad at spotting figures (no pun intended) back in 2008, or the temple there is simply too “sanskari”, but I had completely failed to find porn there.

Last week, we did a family road trip through West-Central Karnataka. We went close to Sringeri but didn’t actually go there. Instead, we visited seven (I think) other medieval temples in that region, most of them off the beaten tourist track.

All seven temples (IIRC) are under control of the Archeological Survey of India, though all of them also see daily prayers (basically, the idols haven’t been destroyed). In many of them, we were the only people at the temple at the time of visit. We didn’t spend too long in each temple (30-45 minutes at max), and they weren’t particularly close to each other, so it was a real “road trip” that way (most time being spent in the car).

In any case, we were in luck at the Aghoreshwara Temple in Ikkeri.

It was the wife (who, you might remember, is a relationship guru) who first noticed this. “Is this guy shagging?”, she asked, looking at a sculpture on the side of the temple. “Oh wow! This woman is touching herself”, she went on.

We only looked closely at one side of the temple (we had gone in the afternoon and the floor on the other side of the temple was too hot so we didn’t spend much time there), but there was plenty of “good stuff”.

One series of people touching the penis of the guy in front. One person tugging at the penises of two people at the same time. Women sprawled out in an inviting manner. People getting anal. Interesting “positions”. The sculptor surely had superb imagination.

The wife diligently documented a lot of things we saw and put them on Instagram. You can check the stuff out here.

Most of our temple visits on the trip came after this one, and so we kept our eyes out for “interesting stuff” there. Unfortunately we didn’t come by much stuff. Some of the temples we visited later on (like the one in Banavasi) were much older. Other temples didn’t have that much sculpture around the outside walls (which is where this kind of stuff usually goes).

Nevertheless, this “discovery” early on in our trip made all our subsequent temple visits that much more interesting.

Understanding different kinds of art

There are some kinds of art that I intuitively understand – like an elegant mathematical proof, or a beautiful combination in a game of chess; a Sachin Tendulkar straight drive, or a long-distance beautifully threaded pass by Xabi Alonso. I can easily appreciate a well-done-up home when I see it. Some music makes me go delirious, and there have been times when I’ve actually started rolling on the floor in ecstasy after listening to certain songs.

But there is art that I simply don’t get. Poetry – for example – I’ve never got what is the big deal with that. To me it just looks like a bunch of sentences broken up in random ways, which is supposed to make it sound nice. In fact, I’ve argued earlier that poetry is a vestige of the pre-writing era.

It is the same with “literature”. Some people read books or articles because they are just “written beautifully”.  I absolutely fail to appreciate that phrase. As long as something is explained simply and intuitively, it is enough for me. In fact, when a writer tries to get too cute and makes a conscious effort to “write beautifully” it puts me off, for it makes the reading less intuitive. As a consequence, there’s hardly any fiction I’ve read in the last 5-6 years.

I was thinking of this last evening when I went to watch this dance show called “Prayog 4” here in Bangalore. I think it was good – the three performances looked extremely well choreographed and well-coordinated, and the dancers seemed to have put in considerable effort into the production. They were all supremely fit and were literally doing gymnastics during the course of the performance. But my appreciation of the performance ended there.

After one of the performances, the wife exclaimed “you know, this dance so represents your and my lives!”. I just couldn’t understand what she was hinting at. All I could see was this one guy dancing round and round in circles, and doing gymnastics on a rope! As I mentioned earlier, his movements were extremely graceful and aesthetically pleasing but I just couldn’t get anything more out of it.

Later last night, my wife asked me what I understood from the first performance (yesterday’s show essentially had three separate performances). “A bunch of chicks doing extremely graceful gymnastics on a bunch of parallel bars”, I replied. “Didn’t you notice how beautifully they represented different emotions during the course of the dance”, she asked. I admitted to recognizing nothing of the sort. Instead, I was sitting there, wondering what the big deal was, and trying to construct this blog post in my head.

“Art” is not unidimensional, and “appreciating art” is too broad a statement. After my experience yesterday I don’t know if there are people who can appreciate all kinds of art. For a moment I thought I was a philistine for I couldn’t appreciate yesterday’s performance, but then I remembered the pieces of art I mentioned in the beginning of this blog post that I truly appreciate. So, no – I’m not a philistine. It’s just that there are certain art forms I get and ones I don’t.

Have you felt similarly sometimes? Are there some art forms you “get” easily, and others that you absolutely fail to get? Or do you consider yourself to be the types that gets all kinds of art, and you argue that the ones you don’t get is simply not art? Or do you fail to get any art at all? Do leave a comment.